Skip to content

Conversation

theStack
Copy link
Contributor

This PR extends the AssumeUTXO functional test by submitting a spending transaction for an UTXO that is only available in a the snapshot chainstate (after loading via loadtxoutset), i.e. it hasn't been seen in a block before. With that we can verify that snapshot coins are visible to the mempool.

Note that we unfortunately can't use MiniWallet here, as the only available UTXO to spend from the snapshot chainstate is at height 200, where a P2PKH created from the test framework's deterministic private key is used (see TestNode.generate(...) and the PRIV_KEYS array). Coinbase outputs with smaller heights (<= 199) would be part of the pre-generated chain and hence not qualify for the "UTXO is only in snapshot chainstate and has never been seen in a block" scenario, coinbase outputs with larger heights (>= 201) can't be spent due to immaturity, as the snapshot chainstate block height is 299.

One could of course mine a different chain with outputs that MiniWallet supports (e.g. taproot anyone-can-spend), but this would change the hardcoded AssumeUTXO hash, colliding with other PRs like #28838, so I wanted to avoid that.

Check that an UTXO that is only available in the snapshot chainstate
is also visible to the mempool by submitting a spending transaction.
@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 10, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK maflcko, jamesob

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@DrahtBot DrahtBot added the Tests label Jan 10, 2024
@maflcko
Copy link
Member

maflcko commented Jan 10, 2024

lgtm ACK 9315754

@jamesob
Copy link
Contributor

jamesob commented Jan 10, 2024

ACK 9315754

Tested locally. Thanks, stackman!

@glozow glozow self-assigned this Jan 10, 2024
@glozow glozow merged commit 632a2bb into bitcoin:master Jan 10, 2024
@theStack theStack deleted the 202401-test-assumeutxo-spend_coin_from_snapshot_chainstate branch January 10, 2024 16:57
@glozow glozow removed their assignment Jan 10, 2024
@bitcoin bitcoin locked and limited conversation to collaborators Jan 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants