aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2023-11-08test: enable --v2transport in combination with --usecliMartin Zumsande
By renaming the "command" send_cli arg. The old name was unsuitable because the "addnode" RPC has its own "command" arg, leading to ambiguity when included in kwargs. Can be tested with "python3 wallet_multiwallet.py --usecli --v2transport" which fails on master because of this (python throws a TypeError).
2023-11-08test: persist -v2transport over restarts and respect -v2transport=0Martin Zumsande
Before, a global -v2transport provided to the test would be dropped when restarting the node within a test and specifying any extra_args. Fix this by adding "v2transport=1" to args (not extra_args) based on the global parameter, and deciding for each (re)start of the node based on this default and test-specific extra_args (which take precedence over args) whether v2 should be used.
2023-11-03Merge bitcoin/bitcoin#28762: MiniMiner changes for package linearizationAndrew Chow
d9cc99d04e813caed51c5f7b6ebdc4c39c8823c9 [test] MiniMiner::Linearize and manual construction (glozow) dfd6a3788c35be121eba1ad84f20effadcb7e7dc [refactor] unify fee amounts in miniminer_tests (glozow) f4b1b24a3bcd0199a6d2e828ad46033e1368336e [MiniMiner] track inclusion order and add Linearize() function (glozow) 004075963f12f17c3c399d81e3b48d6a8151aebd [test] add case for MiniMiner working with negative fee txns (glozow) fe6332c0badf07e99044b00084fc6b07f735a051 [MiniMiner] make target_feerate optional (glozow) 5a83f55c96661a886dd6f5231920b2f730cf6773 [MiniMiner] allow manual construction with non-mempool txns (glozow) e3b2e630b219ca15fe0b2640ca422712c86ac33d [refactor] change MiniMinerMempoolEntry ctor to take values, update includes (glozow) 4aa98b79b266cd526efa577762b0bcfccbdeda11 [lint] update expected boost includes (glozow) Pull request description: This is part of #27463. It splits off the `MiniMiner`-specific changes from #26711 for ease of review, as suggested in https://github.com/bitcoin/bitcoin/pull/26711#issuecomment-1786392253. - Allow using `MiniMiner` on transactions that aren't in the mempool. - Make `target_feerate` param of `BuildMockTemplate` optional, meaning "don't stop building the template until all the transactions have been selected." - Add clarification for how this is different from `target_feerate=0` (https://github.com/bitcoin/bitcoin/pull/26711#discussion_r1377019133) - Track the order in which transactions are included in the template to get the "linearization order" of the transactions. - Tests Reviewers can take a look at #26711 to see how these functions are used to linearize the `AncestorPackage` there. ACKs for top commit: TheCharlatan: ACK d9cc99d04e813caed51c5f7b6ebdc4c39c8823c9 kevkevinpal: reACK [d9cc99d](https://github.com/bitcoin/bitcoin/pull/28762/commits/d9cc99d04e813caed51c5f7b6ebdc4c39c8823c9) achow101: re-ACK d9cc99d04e813caed51c5f7b6ebdc4c39c8823c9 Tree-SHA512: 32b80064b6679536ac573d674825c5ca0cd6245e49c2fd5eaf260dc535335a57683c74ddd7ce1f249b5b12b2683de4362a7b0f1fc0814c3b3b9f14c682665583
2023-11-03[lint] update expected boost includesglozow
2023-11-02Merge bitcoin/bitcoin#27852: test: add coverage to rpc_blockchain.pyAndrew Chow
376dc2cfb32806a8aa450589effe4d384e648398 test: add coverage to rpc_blockchain.py (kevkevin) Pull request description: Included a test that checks the functionality of setting the first param of getnetworkhashps to negative value returns the average network hashes per second from the last difficulty change. ACKs for top commit: jlopp: tACK https://github.com/bitcoin/bitcoin/commit/376dc2cfb32806a8aa450589effe4d384e648398 achow101: ACK 376dc2cfb32806a8aa450589effe4d384e648398 ismaelsadeeq: Tested ACK 376dc2cfb32806a8aa450589effe4d384e648398 pablomartin4btc: tACK 376dc2cfb32806a8aa450589effe4d384e648398 Tree-SHA512: 02d52f622e9cb7a1240c5d124510dd75d03f696f119b2625b0befd60b004ec50ff1a2d5515e0e227601adeecd837e0778ed131ee2a8c5f75f1b824be711213a7
2023-11-01refactor: Remove unused circular include dependency from validation.cppMarcoFalke
2023-11-01Merge bitcoin/bitcoin#28632: test: make python p2p not send getaddr on ↵fanquake
incoming connections 9cfc1c94407359379f10906affd2b837851c1b84 test: check that we don't send a getaddr msg to an inbound peer (Martin Zumsande) 88c33c6748da3c4fdadc554ebca43ce7267e9178 test: make python p2p not send getaddr messages when it's being connected to (Martin Zumsande) Pull request description: `bitcoind` nodes send `getaddr` messages only to outbound nodes (and ignore `getaddr` received by outgoing connections). The python p2p node should mirror this behavior by not sending a `getaddr` message when it is not the initiator of the connection. This is currently causing several unnecessary messages being sent and then ignored (`Ignoring "getaddr" from outbound-full-relay connection.`) in tests like `p2p_add_connections.py`. ACKs for top commit: pinheadmz: concept ACK 9cfc1c9440 pablomartin4btc: re ACK 9cfc1c94407359379f10906affd2b837851c1b84 BrandonOdiwuor: re ACK 9cfc1c94407359379f10906affd2b837851c1b84 Tree-SHA512: 812bec5d8a4828b4384d4cdd4362d6eec09acb2363e888f2b3e3bf8b925e0e17f15e13dc297d6b616c68b93ace9ede7245b07b405d3f5f8eada98350f74230dc
2023-11-01Merge bitcoin/bitcoin#28729: addrman: log AS only when using asmapfanquake
02a4f1a3859ed7e865641b35ca1bc9ce711e696f addrman: log AS only when using asmap (brunoerg) Pull request description: This PR changes the log to just print the ASN when using asmap, same logic presented in other logs: https://github.com/bitcoin/bitcoin/blob/afa081a39bde77d3959aa35b6e6c75a2fe988d68/src/net_processing.cpp#L3552-L3556 https://github.com/bitcoin/bitcoin/blob/afa081a39bde77d3959aa35b6e6c75a2fe988d68/src/net_processing.cpp#L3598-L3604 ACKs for top commit: naumenkogs: ACK 02a4f1a3859ed7e865641b35ca1bc9ce711e696f mzumsande: Code Review ACK 02a4f1a3859ed7e865641b35ca1bc9ce711e696f Tree-SHA512: adad5904ab163660d47554b32dc2dc3dfdff8dd64b94e5320ad11706381264d1e338654fa8239430eed4ccbebc8f6670698b4278895794055c37fc4bcefe71bc
2023-10-30addrman: log AS only when using asmapbrunoerg
2023-10-30Remove feature_txindex_compatibility.py in V27Brandon Odiwuor
2023-10-29Merge bitcoin/bitcoin#28698: assumeutxo, blockstorage: Prevent core dump on ↵fanquake
invalid hash 811067ca1cbbd4a697791cbe3ecd4bee19fe6193 test: add coverage for snapshot chainstate not matching AssumeUTXO parameters (pablomartin4btc) 4a5be10b928d4ed33d223972537c1cb79163e79c assumeutxo, blockstorage: prevent core dump on invalid hash (pablomartin4btc) Pull request description: While reviewing #27596 (ran `loadtxoutset` in `mainnet` before `m_assumeutxo_data` is empty as [currently](https://github.com/jamesob/bitcoin/blob/434495a8c1496ca23fe35b84499f3daf668d76b8/src/kernel/chainparams.cpp#L175-L177) in master - back to 1b1d711), got a `core dumped`, so it seems there's a potential issue if new releases ever remove snapshot details or a semi-experienced user performs a `loadtxoutset` on a different "customised" binary version (not sure if this is a real use case). ``` 2023-10-18T17:42:52Z [init] Using obfuscation key for /tmp/.test_utxo_2/blocks/index: 0000000000000000 node/blockstorage.cpp:390 LoadBlockIndex: Assertion `GetParams().AssumeutxoForBlockhash(*snapshot_blockhash)' failed. Aborted (core dumped) ``` <details> <summary>This is also happening before IBD is completed (<code>background validation</code> still being performed as it can be seen in rpc <code>getchainstates</code>)</summary> ``` /src/bitcoin-cli -datadir=${AU_DATADIR} getchainstates { "headers": 813097, "chainstates": [ { "blocks": 368249, "bestblockhash": "00000000000000000b7a08224a1cb00d337100ba7a46c03d04b2c2d8964efc37", "difficulty": 52278304845.59168, "verificationprogress": 0.086288278873286, "coins_db_cache_bytes": 7969177, "coins_tip_cache_bytes": 14908338995, "validated": true }, { "blocks": 813097, "bestblockhash": "0000000000000000000270c9fdce7b17db64cca91f90106964b58e33a4d91089", "difficulty": 61030681983175.59, "verificationprogress": 0.999997140098457, "coins_db_cache_bytes": 419430, "coins_tip_cache_bytes": 784649420, "snapshot_blockhash": "00000000000000000002a7c4c1e48d76c5a37902165a270156b7a8d72728a054", "validated": false } ] } ``` </details> <details> <summary>Steps to reproduce the core dump error and its output:</summary> 1. Perform a `loadtxoutset` in `mainnet` on compiled `bitcoind` adding the block hash from Sjors's [commit](https://github.com/Sjors/bitcoin/commit/24deb2022b822f22fba9fcbee201e37a83225eb2). 2. Once step 1 finishes, remove the added code from step 1 and compile again or just compile `master` without any changes on top. 3. Run `bitcoind`, soon it'll crash with: ``` 2023-10-18T17:42:52Z [init] init message: Loading block index… 2023-10-18T17:42:52Z [init] Assuming ancestors of block 00000000000000000001a0a448d6cf2546b06801389cc030b2b18c6491266815 have valid signatures. 2023-10-18T17:42:52Z [init] Setting nMinimumChainWork=000000000000000000000000000000000000000052b2559353df4117b7348b64 2023-10-18T17:42:52Z [init] Prune configured to target 3000 MiB on disk for block and undo files. 2023-10-18T17:42:52Z [init] [snapshot] detected active snapshot chainstate (/tmp/.test_utxo_2/chainstate_snapshot) - loading 2023-10-18T17:42:52Z [init] [snapshot] switching active chainstate to Chainstate [snapshot] @ height -1 (null) 2023-10-18T17:42:52Z [init] Opening LevelDB in /tmp/.test_utxo_2/blocks/index 2023-10-18T17:42:52Z [init] Opened LevelDB successfully 2023-10-18T17:42:52Z [init] Using obfuscation key for /tmp/.test_utxo_2/blocks/index: 0000000000000000 node/blockstorage.cpp:390 LoadBlockIndex: Assertion `GetParams().AssumeutxoForBlockhash(*snapshot_blockhash)' failed. Aborted (core dumped) ``` </details> <details> <summary>After original change, error message output:</summary> ``` 2023-10-20T15:49:12Z [init] init message: Loading block index… 2023-10-20T15:49:12Z [init] Assuming ancestors of block 00000000000000000001a0a448d6cf2546b06801389cc030b2b18c6491266815 have valid signatures. 2023-10-20T15:49:12Z [init] Setting nMinimumChainWork=000000000000000000000000000000000000000052b2559353df4117b7348b64 2023-10-20T15:49:12Z [init] Prune configured to target 3000 MiB on disk for block and undo files. 2023-10-20T15:49:12Z [init] [snapshot] detected active snapshot chainstate (/tmp/.test_utxo_2/chainstate_snapshot) - loading 2023-10-20T15:49:12Z [init] [snapshot] switching active chainstate to Chainstate [snapshot] @ height -1 (null) 2023-10-20T15:49:12Z [init] Opening LevelDB in /tmp/.test_utxo_2/blocks/index 2023-10-20T15:49:12Z [init] Opened LevelDB successfully 2023-10-20T15:49:12Z [init] Using obfuscation key for /tmp/.test_utxo_2/blocks/index: 0000000000000000 2023-10-20T15:49:13Z [init] *** Assumeutxo data not found for the given blockhash '00000000000000000002a7c4c1e48d76c5a37902165a270156b7a8d72728a054'. 2023-10-20T15:49:13Z [init] Error: Assumeutxo data not found for the given blockhash '00000000000000000002a7c4c1e48d76c5a37902165a270156b7a8d72728a054'. Error: Assumeutxo data not found for the given blockhash '00000000000000000002a7c4c1e48d76c5a37902165a270156b7a8d72728a054'. 2023-10-20T15:49:13Z [init] Shutdown requested. Exiting. 2023-10-20T15:49:13Z [init] Shutdown: In progress... 2023-10-20T15:49:13Z [scheduler] scheduler thread exit 2023-10-20T15:49:13Z [shutoff] Flushed fee estimates to fee_estimates.dat. 2023-10-20T15:49:13Z [shutoff] Shutdown: done ``` </details> <details> <summary>Alternative on error handling using <code>return error()</code> instead of <code>return FatalError()</code> used in this PR, which produces a different output and perhaps confusing:</summary> ``` 2023-10-20T21:45:58Z [init] Using obfuscation key for /tmp/.test_utxo_2/blocks/index: 0000000000000000 2023-10-20T21:45:59Z [init] ERROR: Assumeutxo data not found for the given blockhash '00000000000000000002a7c4c1e48d76c5a37902165a270156b7a8d72728a054'. 2023-10-20T21:45:59Z [init] : Error loading block database. Please restart with -reindex or -reindex-chainstate to recover. : Error loading block database. Please restart with -reindex or -reindex-chainstate to recover. 2023-10-20T21:45:59Z [init] Aborted block database rebuild. Exiting. 2023-10-20T21:45:59Z [init] Shutdown: In progress... 2023-10-20T21:45:59Z [scheduler] scheduler thread exit 2023-10-20T21:45:59Z [shutoff] Flushed fee estimates to fee_estimates.dat. 2023-10-20T21:45:59Z [shutoff] Shutdown: done ``` </details> <details> <summary>Current state (including ryanofsky <a href="https://github.com/bitcoin/bitcoin/pull/28698#discussion_r1368635965">suggestion</a>), after code change, error message output:</summary> ``` 2023-10-25T02:29:57Z [init] Using obfuscation key for /home/pablo/.test_utxo_2/regtest/blocks/index: 0000000000000000 2023-10-25T02:29:57Z [init] *** Assumeutxo data not found for the given blockhash 'f09b5835f3f8b39481f2af3257bbc2e82845552d4d2d6d31cf520fc24263ed5b'. 2023-10-25T02:29:57Z [init] Error: A fatal internal error occurred, see debug.log for details Error: A fatal internal error occurred, see debug.log for details 2023-10-25T02:29:57Z [init] Shutdown requested. Exiting. 2023-10-25T02:29:57Z [init] Shutdown: In progress... 2023-10-25T02:29:57Z [scheduler] scheduler thread exit 2023-10-25T02:29:57Z [shutoff] Flushed fee estimates to fee_estimates.dat. 2023-10-25T02:29:57Z [shutoff] Shutdown: done ``` </details> ACKs for top commit: naumenkogs: ACK 811067ca1cbbd4a697791cbe3ecd4bee19fe6193 theStack: ACK 811067ca1cbbd4a697791cbe3ecd4bee19fe6193 ryanofsky: Code review ACK 811067ca1cbbd4a697791cbe3ecd4bee19fe6193. Tree-SHA512: cfc137b0a4f638b99fd7dac2c35cc729ef71ae1166a2a8960a91055ec90841cb33aed589834012cfe0e157937e2a76a88d1020ea1df2bc98e1114eb1fc8eaae4
2023-10-29Merge bitcoin/bitcoin#28727: test: replace random_bytes with random.randbytesfanquake
fe3ac3700d31a6329056fee983d91dd8e4c987c1 test: replace random_bytes with randbytes #28720 (ns-xvrn) Pull request description: With Python upgraded to 3.9 replaced the `random_bytes` function in util of functional tests and replaced it's usage with `random.randbytes`. Closes #28720. ACKs for top commit: maflcko: lgtm ACK fe3ac3700d31a6329056fee983d91dd8e4c987c1 BrandonOdiwuor: ACK fe3ac3700d31a6329056fee983d91dd8e4c987c1 stickies-v: ACK fe3ac3700d31a6329056fee983d91dd8e4c987c1, thanks for picking this up kristapsk: utACK fe3ac3700d31a6329056fee983d91dd8e4c987c1 Tree-SHA512: f65a75e73ebd840c2936eb133d42bccd552f25b717c8ca25c18d06e0593e12f292389cfcc0a0b0759004b67a46ea0c8ac237973ef90f246139778230be1e64e1
2023-10-25Merge bitcoin/bitcoin#28264: test: refactor: support sending funds with ↵Andrew Chow
outpoint result 50d1ac120716ab17f32b28513c0ac9940001a783 test: remove unused `find_output` helper (Sebastian Falbesoner) 73a339abc3c864461c8b8830e139c8ec51570243 test: refactor: support sending funds with outpoint result (Sebastian Falbesoner) Pull request description: In wallet-related functional tests we often want to send funds to an address and use the resulting (non-change) UTXO directly after as input for another transaction. Doing that is currently tedious, as it involves finding the index part of the outpoint manually by calling helpers like `find_vout_for_address` or `find_output` first. This results in two different txid/vout variables which then again have to be combined to a single dictionary `{"txid": ..., "vout": ...}` in order to be specified as input for RPCs like `createrawtransaction` or `createpsbt`. For example: ``` txid1 = node1.sendtoaddress(addr1, value1) vout1 = find_vout_for_address(node1, txid1, addr1) txid2 = node2.sendtoaddress(addr2, value2) vout2 = find_vout_for_address(node2, txid2, addr2) node.createrawtransaction([{'txid': txid1, 'vout': vout1}, {'txid': txid2, 'vout': vout2}], .....) ``` This PR introduces a helper `create_outpoints` to immediately return the outpoint as UTXO dictionary in the common format, making the tests more readable and avoiding unnecessary duplication: ``` utxo1 = self.create_outpoints(node1, outputs=[{addr1: value1}])[0] utxo2 = self.create_outpoints(node2, outputs=[{addr2: value2}])[0] node.createrawtransaction([utxo1, utxo2], .....) ``` Tests are switched to work with UTXO-objects rather than two individual txid/vout variables accordingly. The `find_output` helper is removed, as it seems generally a bad idea to search for an outpoint only based on the output value. If that's really ever needed in the future, it makes probably more sense to add it as an additional parameter to `find_vout_of_address`. Note that `find_output` supported specifying a block-hash for where to look for the transaction (being passed on to the `getrawtransaction` RPC). This seems to be unneeded, as txids are always unique and for the only test that used that parameter (rpc_psbt.py) there was no observed difference in run-time, so it was not reintroduced in the new helper. There are still some `find_vout_of_address` calls remaining, used for detecting change outputs or for whenever the sending happens via `sendrawtransaction` instead, so this PR tackles not all, but the most common case. ACKs for top commit: achow101: ACK 50d1ac120716ab17f32b28513c0ac9940001a783 BrandonOdiwuor: ACK 50d1ac120716ab17f32b28513c0ac9940001a783 maflcko: ACK 50d1ac120716ab17f32b28513c0ac9940001a783 🖨 Tree-SHA512: af2bbf13a56cc840fefc1781390cf51625f1e41b3c030f07fc9abb1181b2d414ddbf795e887db029e119cbe45de14f7c987c0cba72ff0b8953080ee218a7915a
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-25test: replace random_bytes with randbytes #28720ns-xvrn
2023-10-25Merge bitcoin-core/gui#771: Avoid error-prone leading whitespace in ↵Hennadii Stepanov
translatable strings 856325fac17465d102da621f1282b6d8ed02f679 lint: Add `lint-qt-translation.py` (Hennadii Stepanov) 294a018bf5106b03af39a2a8cfa4d5f2ebf6912b qt: Avoid error prone leading spaces in translatable strings (Hennadii Stepanov) d8298e7f069f961fc077ceacff2c332d58734688 qt, refactor: Drop superfluous type conversions (Hennadii Stepanov) Pull request description: While working on the GUI translation via Transifex web interface, I found it error-prone to have leading whitespace in translatable strings. This is because it is very easy to unintentionally drop them in translations unnoticed. Fixed all current cases. Added a linter to prevent similar cases in the future. ACKs for top commit: furszy: utACK 856325f Tree-SHA512: b1ca5effb2db6649e1e99382de79acf3a9f81cc9dad434db5623338489e597897e8addd60c1ab3dcc7506ae62753a7a4ad5a41d7a865f8fcdf94348b54baa7e7
2023-10-24Merge bitcoin/bitcoin#28211: Bump python minimum supported version to 3.9fanquake
fa25e8b0a1610553014c786428f146ef9c694678 doc: Recommend lint image build on every call (MarcoFalke) faf70c1f330a92612cf381d32c791e9ba445d3f2 Bump python minimum version to 3.9 (MarcoFalke) fa8996b930886da712c09ffe4b58016b36c2ae5b ci: Bump i686_multiprocess.sh to latest Ubuntu LTS (MarcoFalke) Pull request description: All supported operating systems ship with python 3.9 (or later), so bumping the minimum should not cause any issues. A bump will allow new code to use new python 3.9 features. For reference: * https://packages.debian.org/bullseye/python3 * https://packages.ubuntu.com/focal/python3.9 * FreeBSD 12/13 also ships with 3.9 * CentOS-like 8/9 also ships with 3.9 (and 3.11) * OpenSuse Leap also ships with 3.9 (and 3.11) https://software.opensuse.org/package/python311-base This is for Bitcoin Core 27.0 in 2024 (next year), not the soon upcoming 26.0 next month. ACKs for top commit: Sjors: ACK fa25e8b0a1610553014c786428f146ef9c694678 jamesob: ACK fa25e8b0a1610553014c786428f146ef9c694678 ([`jamesob/ackr/28211.1.MarcoFalke.bump_python_minimum_supp`](https://github.com/jamesob/bitcoin/tree/ackr/28211.1.MarcoFalke.bump_python_minimum_supp)) Tree-SHA512: 86c9f6ac4b5ba94a62ee6a6062dd48a8295d8611a39cdb5829f4f0dbc77aaa1a51edccc7a99275bf699143ad3a6fe826de426d413e5a465e3b0e82b86d10c32e
2023-10-24Merge bitcoin/bitcoin#28660: test: enable reindex readonly test on *BSDfanquake
5a0688a20d88a9641c02436abbd7b49e227f1a37 test: enable reindex readonly test on *BSD and macOS as root (Matthew Zipkin) Pull request description: see https://github.com/bitcoin/bitcoin/pull/27850#discussion_r1349505585 OpenBSD and FreeBSD don't have `chattr` but they do have `chflags`, use that method to make the block file immutable for the reindex_readonly test. Written and tested on a VPS running FreeBSD: ``` FreeBSD freebsd-13-1 13.2-RELEASE-p4 FreeBSD 13.2-RELEASE-p4 GENERIC amd64 ``` ACKs for top commit: maflcko: re-cr-lgtm-ACK 5a0688a20d88a9641c02436abbd7b49e227f1a37 jonatack: ACK 5a0688a20d88a9641c02436abbd7b49e227f1a37 tested on macOS only theStack: ACK 5a0688a20d88a9641c02436abbd7b49e227f1a37 Tree-SHA512: 8c88d282d09c00355d22c4c504b779f60e420327a5e07bcf80fa77b97fefcb04952af9ceaf439d9033a0a2448cb26a02663fe6bddcd4a74792857cfbaf1c5162
2023-10-24test: remove unused `find_output` helperSebastian Falbesoner
2023-10-24test: refactor: support sending funds with outpoint resultSebastian Falbesoner
This commit introduces a helper `create_outpoints` to execute the `send` RPC and immediately return the target address outpoints as UTXO dictionary in the common format, making the tests more readable and avoiding unnecessary duplication.
2023-10-23Merge bitcoin/bitcoin#28609: wallet: Reload watchonly and solvables wallets ↵Ryan Ofsky
after migration 4814e4063e674ad9b0a5c7e56059cd6a2bf9b764 test: Check tx metadata is migrated to watchonly (Andrew Chow) d616d30ea5fdfb897f8375ffd8b9f4536ae7835b wallet: Reload watchonly and solvables wallets after migration (Andrew Chow) 118f2d7d70b584eee7b89e58b5cd2d61c59a9bbf wallet: Copy all tx metadata to watchonly wallet (Andrew Chow) 9af87cf3485ce3fac553a284cde37a35d1085c25 test: Check that a failed wallet migration is cleaned up (Andrew Chow) Pull request description: Some incomplete/incorrect state as a result of migration can be mitigated/cleaned up by simply restarting the migrated wallets. We already do this for a wallet when it is migrated, but we do not for the new watchonly and solvables wallets that may be created. This PR introduces this behavior, in addition to creating those wallets initially without an attached chain. While implementing this, I noticed that not all `CWalletTx` metadata was being copied over to the watchonly wallet and so some data, such as time received, was being lost. This PR fixes this as a side effect of not having a chain attached to the watchonly wallet. A test has also been added. ACKs for top commit: ishaanam: light code review ACK 4814e4063e674ad9b0a5c7e56059cd6a2bf9b764 ryanofsky: Code review ACK 4814e4063e674ad9b0a5c7e56059cd6a2bf9b764. Just implemented the suggested orderpos, copyfrom, and path set comments since last review furszy: ACK 4814e406 Tree-SHA512: 0b992430df9f452cb252c2212df8e876613f43564fcd1dc00c6c31fa497adb84dfff6b5ef597590f9b288c5f64cb455f108fcc9b6c9d1fe9eb2c39e7f2c12a89
2023-10-23Merge bitcoin/bitcoin#28685: coinstats, assumeutxo: fix hash_serialized2 ↵Andrew Chow
calculation 4bfaad4eca01674a9c84a447a17594dc2b9a4c39 chainparams, assumeutxo: Fix signet txoutset hash (Fabian Jahr) a503cd0f0b55736743bcf8d2c46d271064772bef chainparams, assumeutxo: Fix testnet txoutset hash (Fabian Jahr) f6213929c519d0e615cacd3d6f479f1517be1662 assumeutxo: Check deserialized coins for out of range values (Fabian Jahr) 66865446a771327be9e972cdaf01154ea1bdff6d docs: Add release notes for #28685 (Fabian Jahr) cb0336817edc2b6aee2eca818f133841f613a767 scripted-diff: Rename hash_serialized_2 to hash_serialized_3 (Fabian Jahr) 351370a1d211615e3d5b158ccb0400cd79c5c085 coinstats: Fix hash_serialized2 calculation (Fabian Jahr) Pull request description: Closes #28675 The last commit demonstrates that theStack's analysis [here](https://github.com/bitcoin/bitcoin/issues/28675#issuecomment-1770389468) seems to be correct. There will be more changes needed for the rest of the test suite but the `feature_assumeutxo.py` with my additional tests pass. ACKs for top commit: achow101: ACK 4bfaad4eca01674a9c84a447a17594dc2b9a4c39 theStack: Code-review ACK 4bfaad4eca01674a9c84a447a17594dc2b9a4c39 ryanofsky: Code review ACK 4bfaad4eca01674a9c84a447a17594dc2b9a4c39 Tree-SHA512: 2f6abc92b282f7c5da46391803cf0804d13978d191d541f2509b532c538abccd0a081e46cda23d80d47206a05fa2b5d41b7ab246e6a263db7a7461d6292116ef
2023-10-23test: enable reindex readonly test on *BSD and macOS as rootMatthew Zipkin
2023-10-23lint: Add `lint-qt-translation.py`Hennadii Stepanov
2023-10-23Merge bitcoin/bitcoin#28697: fuzz: Increase merge -rss_limit_mbfanquake
fa21535551e300eaa988d209ad64cdc17fd7f66b fuzz: Increase merge -rss_limit_mb (MarcoFalke) Pull request description: For some reason, the limit is hit. (Presumably due to `-set_cover_merge=1` eating more memory, or by simply having more fuzz inputs). Fix it by increasing it for the merge operation. ACKs for top commit: dergoegge: ACK fa21535551e300eaa988d209ad64cdc17fd7f66b hebasto: ACK fa21535551e300eaa988d209ad64cdc17fd7f66b, considering the discussion in https://github.com/bitcoin-core/qa-assets/pull/155. Tree-SHA512: 4fed0f254eccc6fe0b53656bc345ff898b13811dc39387387317d34b521ab77cee03d82b0896dd92d253b7546b6a7e4bdcd478749f47064374ab44ad759ab9ff
2023-10-20scripted-diff: Rename hash_serialized_2 to hash_serialized_3Fabian Jahr
-BEGIN VERIFY SCRIPT- sed -i 's/hash_serialized_2/hash_serialized_3/g' $( git grep -l 'hash_serialized_2' ./src ./contrib ./test ) -END VERIFY SCRIPT-
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-20fuzz: Increase merge -rss_limit_mbMarcoFalke
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-19test: Check tx metadata is migrated to watchonlyAndrew Chow
2023-10-19wallet: Reload watchonly and solvables wallets after migrationAndrew Chow
When migrating, create the watchonly and solvables wallets without a context. Then unload and reload them after migration completes, as we do for the actual wallet. There is also additional handling for a failed reload.
2023-10-19Merge bitcoin/bitcoin#28617: test: Add Wallet Unlock Context Managerfanquake
004903ebade38ba47c5ddc17b756d605b963528e test: Add Wallet Unlock Context Manager (Brandon Odiwuor) Pull request description: Fixes #28601, see https://github.com/bitcoin/bitcoin/pull/28403#discussion_r1325426430 Add Context Manager to manage the locking and unlocking of locked wallets with a passphrase during testing. ACKs for top commit: kevkevinpal: lgtm ACK [004903e](https://github.com/bitcoin/bitcoin/pull/28617/commits/004903ebade38ba47c5ddc17b756d605b963528e) maflcko: lgtm ACK 004903ebade38ba47c5ddc17b756d605b963528e Tree-SHA512: ab234c167e71531df0d974ff9a31d444f7ce2a1d05aba5ea868cc9452f139845eeb24ca058d88f058bc02482b762adf2d99e63a6640b872cc71a57a0068abfe8
2023-10-19Merge bitcoin/bitcoin#28671: test: Fix failing time check in rpc_net.pyfanquake
fa4c6836c9366c3cc575cb386a397840d5f1aa57 test: Fix failing time check in rpc_net.py (MarcoFalke) Pull request description: This check fails on slow runners, such as s390x qemu. Fix it by using mocktime. See https://github.com/bitcoin/bitcoin/pull/28523#discussion_r1357980527 ACKs for top commit: 0xB10C: ACK fa4c6836c9366c3cc575cb386a397840d5f1aa57 pinheadmz: ACK fa4c6836c9366c3cc575cb386a397840d5f1aa57 brunoerg: crACK fa4c6836c9366c3cc575cb386a397840d5f1aa57 Tree-SHA512: 83fb534682e11e97537dc89de8c16f206f38af1a892a2d5970c02684c05eaea8fc9adba3159f16b2440ca0b3871d513a0562a6f3a38f19a5574a47be0919e42f
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-18test: Fix failing time check in rpc_net.pyMarcoFalke
2023-10-17test: Check that a failed wallet migration is cleaned upAndrew Chow
2023-10-17test: assumeutxo file with unknown block hashFabian Jahr
2023-10-17test: Add assumeutxo test for wrong hashMarcoFalke
2023-10-17Merge bitcoin/bitcoin#28652: assumeutxo: fail early if snapshot block hash ↵fanquake
doesn't match AssumeUTXO parameters 9620cb449374f234f72c1a9e1bae3d4b8c0ff171 assumeutxo: fail early if snapshot block hash doesn't match AssumeUTXO parameters (Sebastian Falbesoner) Pull request description: Right now the `loadtxoutset` RPC call treats literally all files with a minimum size of 40 bytes (=size of metadata) as potential valid snapshot candidates and the waiting loop for seeing the metadata block hash in the headers chain is always entered, e.g.: ``` $ ./src/bitcoin-cli loadtxoutset ~/.vimrc <wait> bitcoind log: ... 2023-10-15T14:55:45Z [snapshot] waiting to see blockheader 626174207465730a7265626d756e207465730a656c62616e65207861746e7973 in headers chain before snapshot activation ... ``` There is no point in doing any further action though if we already know from the start that the UTXO snapshot loading won't be successful. This PR adds an assumeutxo parameter check immediately after the metadata is read in, so we can fail immediately on a mismatch: ``` $ ./src/bitcoin-cli loadtxoutset ~/.vimrc error code: -32603 error message: Unable to load UTXO snapshot, assumeutxo block hash in snapshot metadata not recognized (626174207465730a7265626d756e207465730a656c62616e 65207861746e7973) ``` This way, users who mistakenly try to load files that are not snapshots don't have to wait 10 minutes (=the block header waiting timeout) anymore to get a negative response. If a file is loaded which is a valid snapshot (referencing to an existing block hash), but one which doesn't match the parameters, the feedback is also faster, as we don't have to wait anymore to see the hash in the headers chain before getting an error. This is also partially fixes #28621. ACKs for top commit: maflcko: lgtm ACK 9620cb449374f234f72c1a9e1bae3d4b8c0ff171 ryanofsky: Code review ACK 9620cb449374f234f72c1a9e1bae3d4b8c0ff171. This should fix an annoyance and bad UX. pablomartin4btc: tACK 9620cb449374f234f72c1a9e1bae3d4b8c0ff171 Tree-SHA512: f88b865e9d46254858e57c024463f389cd9d8760a7cb30c190aa1723a931e159987dfc2263a733825d700fa612e7416691e4d8aab64058f1aeb0a7fa9233ac9c
2023-10-17Merge bitcoin/bitcoin#28656: fuzz: Allow multiple --m_dir argsfanquake
faa5e061c2f63b868367015561fd376b6ef6052c fuzz: Allow multiple --m_dir args (MarcoFalke) Pull request description: This allows to merge the result from several servers (or just several folders) at the same time, instead of having to iterate over them. This should also allow the fuzz engine (libFuzzer) to optimize the final merge result more, because all fuzz inputs from all folders are available at the same time. ACKs for top commit: dergoegge: tACK faa5e061c2f63b868367015561fd376b6ef6052c Tree-SHA512: bf0da418b1f7b8a8af16bb7cc1e148b1ccd0f17062ce70758d1ca5b35c3eee77c0c30377d376befdd55480adfd1f1a1073cfc47118e7a710e6760e020abe24bb
2023-10-17Merge bitcoin/bitcoin#28628: lint: Include test_utxo_snapshots in ↵fanquake
lint_shell, fix linter errors 348e79f7c6030c9bcbec6bd25e246a779081152a lint: Include test_utxo_snapshots in lint_shell (Fabian Jahr) Pull request description: jamesob excluded `test_utxo_snapshots.sh` from the shell linter with this explanation: "Add the script to the shellcheck exception list since the quoted variables rule needs to be violated in order to get bitcoind to pick up on $EARLY_IBD_FLAGS." However, macrofake pointed out that single lines can be excluded from linting. This fixes one fixable rule violation, excludes the rest of the offending lines from the linter and then removes the exclusion of the `test_utxo_snapshots.sh` file. Also adds documentation. ACKs for top commit: Empact: ACK 348e79f7c6030c9bcbec6bd25e246a779081152a maflcko: lgtm ACK 348e79f7c6030c9bcbec6bd25e246a779081152a pablomartin4btc: tACK 348e79f7c6030c9bcbec6bd25e246a779081152a Tree-SHA512: a904cc1cc3c94488dfbd39ea69a3ef17259f991708a797009001669448fef81eed086ecbce1ec433988d88baef293849698e2e0eb86a969b949cc7ef93af7b4b
2023-10-16assumeutxo: fail early if snapshot block hash doesn't match AssumeUTXO ↵Sebastian Falbesoner
parameters
2023-10-16fuzz: Allow multiple --m_dir argsMarcoFalke
2023-10-16Merge bitcoin/bitcoin#28565: rpc: getaddrmaninfo followupsfanquake
e6e444c06cbf09380f9924dff3d21c1be15d1753 refactor: add and use EnsureAnyAddrman in rpc (stratospher) bf589a50a0d6a7b94f1ba1ddf24a1497fd35ad44 doc: add release notes for #27511 (stratospher) 3931e6abc39b8aee1472028dbf76eeb10708d2b4 rpc: `getaddrmaninfo` followups (stratospher) Pull request description: - make `getaddrmaninfo` RPC public since it's not for development purposes only and regular users might find it useful. [#26988 (comment)](https://github.com/bitcoin/bitcoin/pull/26988#issuecomment-1738371584) - add missing `all_networks` key to RPC help. [#27511 (comment)](https://github.com/bitcoin/bitcoin/pull/27511#discussion_r1335084087) - fix clang format spacing - add and use `EnsureAddrman` in RPC code. [#27511 (comment)](https://github.com/bitcoin/bitcoin/pull/27511#discussion_r1331501491) ACKs for top commit: 0xB10C: Code Review re-ACK e6e444c06cbf09380f9924dff3d21c1be15d1753 theStack: Code-review ACK e6e444c06cbf09380f9924dff3d21c1be15d1753 pablomartin4btc: tested ACK e6e444c06cbf09380f9924dff3d21c1be15d1753 Tree-SHA512: c14090d5c64ff15e92d252578de2437bb2ce2e1e431d6698580241a29190f0a3528ae5b013c0ddb76a9ae538507191295c37cab7fd93469941cadbde44587072
2023-10-15Merge bitcoin/bitcoin#28650: fuzz: Merge with -set_cover_merge=1fanquake
fa858d63a0a5d794aab38c26f60c593513fe08de fuzz: Merge with -set_cover_merge=1 (MarcoFalke) Pull request description: This should be less controversial than commit 151a2b189c3561dda2bb7de809306c1cfeb40e23. The overall size of the qa-assets repo is reduced further from 1.9GB to 1.6GB. Also, the runtime to iterate on the resulting folder is reduced further from ~1699s to ~1149s (N=1). ACKs for top commit: murchandamus: crACK fa858d63a0a5d794aab38c26f60c593513fe08de dergoegge: ACK fa858d63a0a5d794aab38c26f60c593513fe08de Tree-SHA512: e23fa93bd48f01d11c551b035004c678bd6d76bc24ac7d0d0a7883060804e6711763cbd0cd0ded3aad3e4c40da764decae81c2703388cc11961def3c89a4f9ba
2023-10-13fuzz: Merge with -set_cover_merge=1MarcoFalke
2023-10-13lint: Include test_utxo_snapshots in lint_shellFabian Jahr
2023-10-13test: fix `assert_debug_log` call-site bugs, add type checksSebastian Falbesoner
Two recently added tests (PR #28625 / commit 2e31250027ac580a7a72221fe2ff505b30836175 and PR #28634 / commit 3bb51c29df596aab2c1fde184667cee435597715) introduced a bug by wrongly using the `assert_debug_log` helper. Instead of passing the expected debug string in a list as expected, it was passed as bare string, which is then interpretered as a list of characters, very likely leading the debug log assertion pass even if the intended message is not appearing. In order to avoid bugs like this in the future, enforce that the `{un}expected_msgs` parameters are lists.
2023-10-13Merge bitcoin/bitcoin#28639: refactor: Remove unused nchaintx from ↵fanquake
SnapshotMetadata constructor, fix test, add test fafde92f84fb7c245bc3c1cd946a32c891861e5e test: Check snapshot file with wrong number of coins (MarcoFalke) faa90f6e7b6b8c531e1ae142a5c2f568b48502a9 refactor: Remove unused nchaintx from SnapshotMetadata constructor (MarcoFalke) Pull request description: See commit messages ACKs for top commit: Sjors: utACK fafde92f84fb7c245bc3c1cd946a32c891861e5e theStack: ACK fafde92f84fb7c245bc3c1cd946a32c891861e5e Tree-SHA512: 9ed2720b50d1c0938f30543ba143e1a4c6af3a0ff166f8b3eb452e1d99ddee6e3443a4c99f77efe94b8c3eb2feff984bf5259807ee8085e1e0e1e0d1de98227e