fix(btc): re-anchor against canonical chain at verify time#207
Open
dripsmvcp wants to merge 1 commit intoentrius:testfrom
Open
fix(btc): re-anchor against canonical chain at verify time#207dripsmvcp wants to merge 1 commit intoentrius:testfrom
dripsmvcp wants to merge 1 commit intoentrius:testfrom
Conversation
verify_miner_fulfillment read confirmations once and voted, both in the RPC and Blockstream paths. Between the read and vote inclusion (12s+), a reorg can drop the tx — Bitcoin Core's confirmations does update on reorg but the validator has already voted. Blockstream's status.confirmed is self-reported by whichever instance answered. After computing confirmations, fetch getblockhash(height) (RPC) or GET /block-height/<h> (Blockstream) and compare to the tx's recorded block_hash. Mismatch → tx's block is not on the canonical chain → drop to confirmed=False so the validator doesn't vote yet. Closes entrius#182
Contributor
Author
|
@anderdc @LandynDev ready for review |
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.
Summary
Closes #182.
verify_miner_fulfillmentread BTC confirmations once and voted, in both the Core RPC path and the Blockstream path. Between the read and vote inclusion (12s+), a reorg can drop the tx — Core'sconfirmationsupdates on reorg but the validator has already voted; Blockstream'sstatus.confirmedis self-reported by whichever instance answered.After computing confirmations, fetch the canonical blockhash at the tx's height (
getblockhashon RPC,GET /block-height/<h>on Blockstream) and compare to the tx's recordedblockhash. Mismatch → tx's block isn't on the canonical chain → drop toconfirmed=Falseso the validator doesn't vote.Test plan
confirmed=Trueconfirmed=Falseand emits warning