Skip to content

Conversation

@rustaceanrob
Copy link
Contributor

I noticed my home node got stuck on a block with the connection it had, but continued to exchange ping and pongs. This adds a very basic check to see if blocks are being withheld from us by disconnecting from a peer if they have not sent a block to us for 20 minutes.

@sedited
Copy link
Owner

sedited commented Dec 29, 2025

I've seen this too a couple of times. It doesn't really make sense to me. Seems fine to be rotating peers every now and again, but I wonder if at this point we should just introduce multi-peer messages handling.

@rustaceanrob
Copy link
Contributor Author

I think in that case we would still want to disconnect all connections if we haven't seen a block for a certain amount of time? Maybe it could be less aggressive in the first stale check (like 30 minutes), then move to something more aggressive?

Copy link
Owner

@sedited sedited left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this for a bit and saw a few re-connects. The warning seems a bit harsh, since this will print even during normal block rate variations. Maybe relegate the log level to info?

I noticed my home node got stuck on a block with the connection it had,
but continued to exchange ping and pongs. This adds a very basic check
to see if blocks are being withheld from us by disconnecting from a
peer if they have not sent a block to us for 20 minutes.
@rustaceanrob
Copy link
Contributor Author

Changed to info in 9e10d18

@yancyribbens
Copy link
Contributor

Just curious, how does bitcoin-core node handle this problem? It doesn't seem like this is a case of re-inventing the wheel?

@sedited
Copy link
Owner

sedited commented Dec 30, 2025

Just curious, how does bitcoin-core node handle this problem? It doesn't seem like this is a case of re-inventing the wheel?

We still only maintain a single connection at a time here. Running Core with many connections alleviates this, since there is some cycling between peers and the likelihood of finding a good peer is high. However even in Core, this is a problem during ibd, where blocks are fetched from a single peer at a time. To avoid stalling in that case, there are a bunch of timeouts (grep stalling in net_processing.cpp).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants