Skip to content

SpvClient loses the connection chain and stops providing blocks #223

@mariocynicys

Description

@mariocynicys

This is a hard to produce issue but basically what happens is that bitcoind prunes old block which aren't yet delivered to the tower. Thus the tower stops connecting blocks (watching).

Repro:

  • Keep your node shut for a couple of weeks/days (yeah really)
  • Start the node and the tower together (so the tower doesn't lag behind the prune length)

What will happen:

  • The tower will be able to go past the 100 blocks check when it's bootstrapping since these blocks aren't pruned yet
  • bitcoind should be (so) slow responding to RPC calls after sometime, probably because it's busy validating blocks
  • The tower will hang waiting for RPC calls from bitcoind but bitcoind will move quickly that it prunes blocks that the tower hasn't yet received.

At this point spv_client.poll_best_tip will stop connecting blocks (blocks are connected sequentially, if one is missing we can't connect later ones), which is indicated by the boolean returned.

    /// Polls for the best tip and updates the chain listener with any connected or disconnected
    /// blocks accordingly.
    ///
    /// Returns the best polled chain tip relative to the previous best known tip and whether any
    /// blocks were indeed connected or disconnected.
	pub async fn poll_best_tip(&mut self) -> BlockSourceResult<(ChainTip, bool)> { ... }

The tower will not get any blocks after this point nor will it report errors.

Such an issue could be triggered with the loss of internet connection of some long time. So it might be worth resolving it automatically and not requiring manual interference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions