mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:47:36 +00:00
test: spend an existing output in TestBasicMining double spend case #36798
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36798
Loading…
Reference in a new issue
No description provided.
Delete branch "test-miner-double-spend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The double spend case in
TestBasicMiningis meant to check that block template creation fails when two mempool transactions spend the same coin. It reuses the transaction from the preceding coinbase case, whose prevout was cleared withSetNull(), and only overwrites the prevout hash. The output index therefore staysCOutPoint::NULL_INDEX, so both transactions spend an output oftxFirst[0]that does not exist.Set the output index to 0, so the first transaction is a valid spend and only the second one makes template creation fail.
Found while working on #36692 and https://github.com/yuvicc/bitcoin/pull/19.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.No verified findings are available from this review.
Review coverage was incomplete.
Reviewed:
b2c7f2545e9a· Full review report · Previous reportspermalink
ACK
b2c7f2545eACK
b2c7f2545eVerified by commenting out the second
TryAddToMempool:std::runtime_error expected but not raised(miner_tests.cpp:557), as expectedClean run on this PR passes.
The case lost its valid
prevout.nin18e071841e, which moved the p2sh case (which set n = 0) after this check, so the double-spend case started inheritingNULL_INDEXfrom the coinbase case.lgtm ACK
b2c7f2545e