Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
3d5a6af to
963611c
Compare
963611c to
bf7ea08
Compare
|
Could the new cases use the existing Tested bf7ea08 on regtest with a 299-coin snapshot. The new cases fail on the merge base (a8b69bd) and pass on the PR head. A file with duplicated records and a doubled count is accepted on the base ( With 30M empty groups (990 MB) before a valid body, the base accepts the file in 2.13 s and exits 1.00 s after The count check also catches a single repeated outpoint, both within a group and in a repeated group. In either case, the head rejects it with "Bad snapshot coins count: expected 300, got 299" and leaves one chainstate.
Not tested: mainnet-size snapshots. |
A repeated snapshot payload preserves the unique UTXO set and content hash while doubling the announced record count. Record that current loading accepts this mismatch before enforcing the metadata contract. Also preserve the content-hash error when the announced count differs from the unique UTXO count.
Repeated records can produce the committed set while overstating the announced coin count. Check the unique count from the existing statistics scan after the content hash, preserving hash-error precedence.
An empty transaction group adds no coin and leaves the committed UTXO hash unchanged. Record its current acceptance before requiring every group to contain a coin.
bf7ea08 to
e7a3816
Compare
Reject transaction groups with no coins instead of accepting bytes that contribute nothing to the checked UTXO set. Snapshots generated by dumptxoutset already contain only nonempty groups.
e7a3816 to
e8e8cbc
Compare
|
tACK e8e8cbc A repeated outpoint need not repeat the same coin. I appended a second record for an existing outpoint to the regtest snapshot, with a 500-byte script, and raised the count by one. On the base (cce32b1) the file loads with The loaded UTXO set is still the committed one. What the base leaves unchecked is the reported count and the extra bytes in the file. I built bitcoind at the head and at the base, and ran the head's |
|
tACK e8e8cbc (re-ACK) The test uses four nodes and reuses nodes[1] for the invalid snapshot cases. My saved 25 October run record (aarch64, Release) compares merge base cce32b1 with this head:
These results cover this PR head alone; I have not tested it combined with #36603 or on mainnet-size snapshots. |
danielabrozzoni
left a comment
There was a problem hiding this comment.
light code review ACK e8e8cbc
Code looks good to me, only a light ACK as I'm new to this part of the code :)
|
Closing in favor of #36598 |

Problem: Snapshot loading doesn't validate the announced coin count against the unique UTXOs loaded.
Repeated outpoints collapse into one coin, so a snapshot can repeat every record, announce the doubled count, and still match the committed UTXO hash.
loadtxoutsetthen reports the inflated count ascoins_loaded.Snapshot loading also accepts transaction groups with no coins.
They leave the UTXO hash unchanged and don't advance the coin count, so parsing them bypasses the interrupt check and can delay shutdown.
Fix: Compare the announced count with the unique coin count already produced by the existing UTXO statistics scan, and reject zero-count transaction groups while parsing the snapshot.
When both the content hash and coin count are wrong, loading reports the hash error first.