aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_assumeutxo.py
AgeCommit message (Collapse)Author
2024-03-21node: Make translations of fatal errors consistentTheCharlatan
The extra `bilingual_str` argument of the fatal error notifications and `node::AbortNode()` is often unused and when used usually contains the same string as the message argument. It also seems to be confusing, since it is not consistently used for errors requiring user action. For example some assumeutxo fatal errors require the user to do something, but are not translated. So simplify the fatal error and abort node interfaces by only passing a translated string. This slightly changes the fatal errors displayed to the user. Also de-duplicate the abort error log since it is repeated in noui.cpp.
2024-03-18test: assumeutxo snapshot block CheckBlockIndex crash testRyan Ofsky
Add a test for a CheckBlockIndex crash that would happen before previous "assumeutxo: Get rid of faked nTx and nChainTx values" commit. The crash was an assert failure in the (pindex->nChainTx == pindex->nTx + prev_chain_tx) check that would previously happen if the snapshot block was submitted after loading the snapshot and downloading a few blocks after the snapshot. In that case ReceivedBlockTransactions() previously would overwrite the nChainTx value of the submitted snapshot block with a fake value based on the previous block, so the (pindex->nChainTx == pindex->nTx + prev_chain_tx) check would later fail on the first block after the snapshot. This test was originally posted by Martin Zumsande <mzumsande@gmail.com> in https://github.com/bitcoin/bitcoin/pull/29370#issuecomment-1974096225 Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
2024-03-18test: assumeutxo stale block CheckBlockIndex crash testRyan Ofsky
Add a test for a CheckBlockIndex crash that would happen before previous "assumeutxo: Get rid of faked nTx and nChainTx values" commit. The crash was an assert failure in the (pindex->nChainTx == pindex->nTx + prev_chain_tx) check that would previously happen if a snapshot was loaded, and a block was submitted which forked from the chain before the snapshot block and after the last downloaded background chain block. This block would not be marked assumed-valid because it would not be an ancestor of the snapshot, and it would have nTx set, nChainTx unset, and prev->nChainTx set with a fake value, so the assert would fail. After the fix, prev->nChainTx is unset instead of being set to a fake value, so the assert succeeds. This test was originally posted by maflcko in https://github.com/bitcoin/bitcoin/issues/29261#issuecomment-1918947945 Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2024-03-18assumeutxo: Get rid of faked nTx and nChainTx valuesRyan Ofsky
The `PopulateAndValidateSnapshot` function introduced in f6e2da5fb7c6406c37612c838c998078ea8d2252 from #19806 has been setting fake `nTx` and `nChainTx` values that can show up in RPC results (see #29328) and make `CBlockIndex` state hard to reason about, because it is difficult to know whether the values are real or fake. Revert to previous behavior of setting `nTx` and `nChainTx` to 0 when the values are unknown, instead of faking them. This commit fixes at least two assert failures in the (pindex->nChainTx == pindex->nTx + prev_chain_tx) check that would happen previously. Tests for these failures are added separately in the next two commits. Compatibility note: This change could result in -checkblockindex failures if a snapshot was loaded by a previous version of Bitcoin Core and not fully validated, because fake nTx values will have been saved to the block index. It would be pretty easy to avoid these failures by adding some compatibility code to `LoadBlockIndex` and changing `nTx` values from 1 to 0 when they are fake (when `(pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_TRANSACTIONS`), but a little simpler not to worry about being compatible in this case.
2024-03-18assumeutxo test: Add RPC test for fake nTx and nChainTx valuesRyan Ofsky
The fake values will be removed in an upcoming commit, so it is useful to have test coverage confirming the change in behavior.
2024-02-26test: Add test for loadtxoutset when headers are not syncedFabian Jahr
2024-02-26test: Remove unnecessary sync_blocks in assumeutxo testsFabian Jahr
The nodes are not connected at this point and no blocks have been mined, so it does not seem do anything
2024-02-09test, assumeutxo: Add test to ensure failure when mempool not emptyHernan Marino
2024-01-31test: Assumeutxo with more than just coinbase transactionsMarcoFalke
2024-01-10test: assumeutxo: spend coin from snapshot chainstate after loadingSebastian Falbesoner
Check that an UTXO that is only available in the snapshot chainstate is also visible to the mempool by submitting a spending transaction.
2023-11-16Merge bitcoin/bitcoin#28605: Fix typosfanquake
43de4d3630274e1287179c86896ed4c2d8b9eff4 doc: fix typos (Sjors Provoost) Pull request description: This PR fixes typos found by lint-spelling.py using codespell 2.2.6. Our CI linter job uses codespell 2.2.5 and found fewer typos that I did locally. In any case it's happy now. ACKs for top commit: pablomartin4btc: re ACK 43de4d3630274e1287179c86896ed4c2d8b9eff4 Tree-SHA512: c032fe86cb49c924a468385653b31f309a9db68c478d70335bba3e65a1ff3826abe80284fe00a090ab5a509e1edbf17e476f6922fb15d055e50f1103dad2ccb0
2023-11-09test, assumeutxo: Use assert_debug_log for error detailspablomartin4btc
This is a follow-up on the invalid hash dump fix PR #28698. https://github.com/bitcoin/bitcoin/pull/28698#pullrequestreview-1698178157
2023-11-07doc: fix typosSjors Provoost
As found by lint-spelling.py using codespell 2.2.6.
2023-10-25test: add coverage for snapshot chainstate not matching AssumeUTXO parameterspablomartin4btc
Co-authored-by: Russell Yanofsky <russ@yanofsky.org> Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
2023-10-20coinstats: Fix hash_serialized2 calculationFabian Jahr
The legacy serialization was vulnerable to maleation and is fixed by adopting the same serialization procedure as was already in use for MuHash. This also includes necessary test fixes where the hash_serialized2 was hardcoded as well as correction of the regtest chainparams. Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
2023-10-20test: De-dublicate/optimize assumeutxo test for further extensionsFabian Jahr
2023-10-20test: check au file with changed outpoint indexFabian Jahr
2023-10-18Merge bitcoin/bitcoin#28666: test: assumeutxo file with unknown block hashRyan Ofsky
621db2f00486d8fd6f06dca91c1b95ce61f64bc4 test: assumeutxo file with unknown block hash (Fabian Jahr) Pull request description: Takes care of one of the open Todos in the assumeutxo functional test. Since an unknown block could be any hash, I simply chose one placeholder, it could also be a random string though. ACKs for top commit: maflcko: lgtm ACK 621db2f00486d8fd6f06dca91c1b95ce61f64bc4 pablomartin4btc: cr ACK 621db2f00486d8fd6f06dca91c1b95ce61f64bc4 theStack: ACK 621db2f00486d8fd6f06dca91c1b95ce61f64bc4 ryanofsky: Code review ACK 621db2f00486d8fd6f06dca91c1b95ce61f64bc4 Tree-SHA512: ee0438ce619f7348c6f88e39b0ea7ddddb8832956d9034ecc795c6033d5d905c09d11b7d0d5afc38231b2fd091ea7c1bd0a0be99d9c32c4e6357a25d76294142
2023-10-17test: assumeutxo file with unknown block hashFabian Jahr
2023-10-17test: Add assumeutxo test for wrong hashMarcoFalke
2023-10-16assumeutxo: fail early if snapshot block hash doesn't match AssumeUTXO ↵Sebastian Falbesoner
parameters
2023-10-12test: Check snapshot file with wrong number of coinsMarcoFalke
Also, fix a bug in an assert_debug_log call.
2023-10-10test: check that loading snapshot not matching AssumeUTXO parameters failsSebastian Falbesoner
2023-10-06test: Improvements of feature_assumeutxoFabian Jahr
- Remove usage of the internal wait_until_helper function - Use framework self.no_op instead of new no_sync function co-authored-by: Andrew Chow <github@achow101.com>
2023-10-05assumeutxo: change getchainstates RPC to return a list of chainstatesRyan Ofsky
Current getchainstates RPC returns "normal" and "snapshot" fields which are not ideal because it requires new "normal" and "snapshot" terms to be defined, and the definitions are not really consistent with internal code. (In the RPC interface, the "snapshot" chainstate becomes the "normal" chainstate after it is validated, while in internal code there is no "normal chainstate" and the "snapshot chainstate" is still called that temporarily after it is validated). The current getchainstatees RPC is also awkward to use if you to want information about the most-work chainstate because you have to look at the "snapshot" field if it exists, and otherwise fall back to the "normal" field. Fix these issues by having getchainstates just return a flat list of chainstates ordered by work, and adding new chainstate "validated" field alongside the existing "snapshot_blockhash" so it is explicit if a chainstate was originally loaded from a snapshot, and whether the snapshot has been validated.
2023-10-04tests: assumeutxo: accept final height from either chainstateJames O'Beirne
2023-10-04test: assumeutxo: avoid race in functional testJames O'Beirne
2023-09-30test: add feature_assumeutxo functional testJames O'Beirne
Most ideas for test improvements (TODOs) provided by Russ Yanofsky.