Repository navigation
Translate block inventory announcements from sendheaders peers. - #1265
echennells wants to merge 1 commit into
Conversation
|
This describes bad bitcoind behavior that we do not want to emulate. It's not a protocol requirement. It is a single threaded network message pump operating on send cycles across peers. In the case of a catch-up sync it may be processing hundreds or thousands of blocks. And it accumulates the outgoing INV in a buffer for each peer. The 8 element cap etc. is protection against it overflowing its own buffers. We don't do that, we send one announcement per block, per peer, as they occur. If the peer is too slow, they get dropped at high water. If we send 1000 headers, that's fine. Sending a single tip INV isn't better, as the peer must still request the headers, adding a round trip. The actual gap could be that when we fall behind we don't let the peer know until we catch up, since we stop announcements altogether when not current. We consider that good behavior. And peers get announcements once we are caught up, not while we are trying to do so (just like IBD). |
A peer that was sent
sendheadersis never subscribed to inventory.protocol_header_in_70012::completesetssubscribedand then calls the 31800complete, which subscribes to inventory only whilesubscribedis clear. From 70012 up the one flag stands for both, sohandle_receive_inventoryis not attached.bitcoind announces by inv to such a peer when more than eight blocks are new or its headers would not connect, and keeps doing so. bs then learns of no block from that peer until it reconnects.
This gives the inv translation its own flag. It stays conditional on a current chain, so a node that is not current ignores inv as before.
The tests announce an unknown block by inv to a bip130 peer. Regtest, one bitcoind 31.0 peer, compact blocks off, bs at the tip, bitcoind mines 100, 30 or 12 blocks in one call: without the change bs stays at the old tip with the connection up in 12 of 24 runs over two heads; with it 24 of 24 sync.