Repository navigation
Skip a requested block that is already associated. - #1266
Closed
echennells wants to merge 1 commit into
Closed
echennells wants to merge 1 commit into
echennells wants to merge 1 commit into
Conversation
A block requested from one peer can arrive first as a compact block from another. The compact path associates it and the request stays outstanding, so the later copy was stored again: new tx records and an overwritten txs entry, under a strong table that still refers to the first records.
Member
|
This is a real issue, but fix preserves the same race. Resolution requires a different approach, so closing this and reopening as an issue. |
Member
|
resolved, please verify. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A block can be stored twice. Requested from one peer, it arrives first as a compact block from another; the compact path associates it and the request stays in the first channel's map. When the requested copy arrives,
handle_receive_blockstores it again: new tx records and an overwritten txs entry under a strong table that still refers to the first records.get_tx_positionthen fails for those transactions, so address history and unspent fail for their addresses. libbitcoin/libbitcoin-database@21c8f597 counts only the strong instance in address totals; history and unspent still fail.This skips a requested block that is already associated, as
do_submit_compactdoes for the other order, and clears its request. A request the peer never answers is not cleared, so that peer is still dropped as stalled; that may be the better place to fix it.The tests deliver the requested copy after its compact block. Regtest, two bitcoind peers, reorg cycles: history faults in 20 of 20 runs without the change, none in 14 runs of 60 cycles with it. Sync to testnet3 2,000,000: 398.2 s without, 398.7 s with.