fix confirmed spender height lookup#806
Merged
evoskuil merged 1 commit intoJun 3, 2026
Merged
Conversation
evoskuil
reviewed
Jun 3, 2026
return a terminal height when a prevout has no confirmed spender, instead of zero. previously, unspent outputs could get a height of zero which implies they were spent by the genesis block. more specifically, outputs that are unspent because the spending transaction was not confirmed would get marked as already spent by the genesis block when attempting to broadcast the transaction. also check the computed block link when short-circuiting find_strong(tx_link), so unconfirmed duplicate tx links fall back to hash-based strong lookup instead of returning a terminal block link.
d69a764 to
7792cfc
Compare
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.
Ran into this while testing a silent payments scan table in libbitcoin-server, pulling the fix into its own PR per #804 (comment).
This fixes a bug where an unconfirmed transaction is sent to the server (e.g. a wallet broadcasting a transaction) gets rejected. the server will claim that the unspent output was already spent at block zero. This is due to the cast returning 0 after no spends had been found, which incorrectly implies the output was spent in the genesis block.