Skip to content

fix confirmed spender height lookup#806

Merged
evoskuil merged 1 commit into
libbitcoin:masterfrom
josibake:fix-strong-spender-height-terminal
Jun 3, 2026
Merged

fix confirmed spender height lookup#806
evoskuil merged 1 commit into
libbitcoin:masterfrom
josibake:fix-strong-spender-height-terminal

Conversation

@josibake
Copy link
Copy Markdown
Contributor

@josibake josibake commented Jun 3, 2026

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.

Comment thread include/bitcoin/database/impl/query/consensus/consensus_strong.ipp
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.
@josibake josibake force-pushed the fix-strong-spender-height-terminal branch from d69a764 to 7792cfc Compare June 3, 2026 14:10
@evoskuil evoskuil merged commit 5f1916d into libbitcoin:master Jun 3, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants