Fix: RBF-mechanism should check bitcoin RPC #4206
Merged
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.
Description
The stacks miner's bitcoin operation handling tracks submitted transactions via the
ongoing_op
mechanism. When deciding whether or not to attempt an RBF, it checks if theongoing_op
has been confirmed. Currently, it does this via the burnchain_db, however, this will not work if the transaction is confirmed, but it was unparseable. In this case, the miner will continuously attempt to RBF an already confirmed transaction, leading to bitcoin mempool rejections.Relevant Scenario
This scenario surfaced during the nakamoto "controlled testnet" testing through a pretty convoluted series of events:
wait_on_blocks
time)bitcoin_regtest_controller
normally performs a check to see if theongoing_op
matches the about-to-submit op, but since bitcoin block 2 has now been mined, ongoing_op is confirmed, so the 'resubmission' is submitted.Actually fixing the timing issue in step 3 above isn't possible: no matter how late the
stacks-node
checks for a new bitcoin block before submitting the block commit, it's always possible that the bitcoin block arrives right "before" the commit is submitted (or equivalently, the bitcoin block just doesn't include the commit). But fixing the tracking ofongoing_op
is possible, and that's what this PR does.Additional info (benefits, drawbacks, caveats)
In theory, this could be opened against
develop
rather thannext
. I don't get a sense that this is a huge issue in practice, otherwise I'd expect there'd be a bug report already. In which case, this seems mostly relevant for the testing infrastructures fornext
, so I just want to simplify the workstream by opening this againstnext
directly.