aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
AgeCommit message (Collapse)Author
2022-02-24Merge bitcoin/bitcoin#19013: test: add v0.20.1, v0.21.0 and v22.0 to ↵MarcoFalke
backwards compatibility test 24cec4b5c02e12cf0b6b56ba5055b8f5758627a5 test: Fix intermittent test failure in feature_backwards_compatibility (MarcoFalke) d8b705f1caeb3b4a6790cb26e4e5584ca791d965 test: previous releases: add v22.0 (Sjors Provoost) 40849eebd9c7a92f6b670b30c9338358d8306cfe test: bump sandbox argument minimum version (Sjors Provoost) 8a57a06a5062dd8dfdefca4e404d0ddbd2a3da1d test: previous releases: add v0.21.0 (Sjors Provoost) 8cba75f5fd758d7e59bd0a84dbd17b59fb8a5dd2 test: v0.20.1 backwards compatibility (Sjors Provoost) 0e4b695b6aee276005dc3dd6faaa1d9cb3abeacf test: backwards compatibility: misc fixes (Sjors Provoost) 76557cbe4cd067feb04bd270aa6ba532eae84963 test: Remove i686 from test/get_previous_releases.py (MarcoFalke) Pull request description: This also simplifies the tests a bit. ACKs for top commit: ryanofsky: Code review ACK 24cec4b5c02e12cf0b6b56ba5055b8f5758627a5. Only change since last review is rebasing and adding comment and whitelist args. Tree-SHA512: 85a603ddd70fd8f0180d00fb84eb2ad2f92d6199b7d3f7c1abd660bfba53f869faf40f1a4183a8ce15dbd496ee3132d879c1258651c9d443ece69e5fe328bd26
2022-02-15Merge bitcoin/bitcoin#24324: test: refactor: remove unneeded bytes<->hex ↵MarcoFalke
conversions in `byte_to_base58` f11dad22a506e10fbbfbcb6ccf32754bf8e72b72 test: refactor: remove unneeded bytes<->hex conversions in `byte_to_base58` (Sebastian Falbesoner) Pull request description: It seems like the only reason for using hex strings in this method was to have a convenient way to convert to an integer from the input data interpreted as big-endian. In Python3 we have `int.from_bytes(..., 'big')` for that purpose, hence there is no need for that anymore and we can simply operate on bytes only. ACKs for top commit: laanwj: Code review ACK f11dad22a506e10fbbfbcb6ccf32754bf8e72b72 Tree-SHA512: 9b1563010066ca74d85139c3b9259e9a5bb49e1f141c30b6506a0445afddb2bde7fd421fdd917dc516956e66f93610e2c21d720817640daee8f57f803be76ee4
2022-02-14test: remove `import socket` in test_ipv6_localbrunoerg
2022-02-14test: refactor: remove unneeded bytes<->hex conversions in `byte_to_base58`Sebastian Falbesoner
It seems like the only reason for using hex strings in this method was to have a convenient way to convert to an integer from the input data interpreted as big-endian. In Python3 we have `int.from_bytes(..., 'big')` for that purpose, hence there is no need for that anymore and we can simply operate on bytes only.
2022-02-07test: Call ceildiv helper with integerMartin Zumsande
It returns an incorrect result when called with a Decimal, for which the "//" operator works differently. Also drop unnecessary call to satoshi_round.
2022-01-31test: Fix feature_init intermittent issuesMarcoFalke
2022-01-28Merge bitcoin/bitcoin#23508: Add getdeploymentinfo RPCMarcoFalke
a3809228917b8f750090c8bfec8e283391dbb524 Release notes for getdeploymentinfo rpc (Anthony Towns) 240cad09baefcf363cce36a4b2795122adfce27f rpc: getdeploymentinfo: include signalling info (Anthony Towns) 376c0c6dae2bebbb3e1352377e71fb1996d09f64 rpc: getdeploymentinfo: include block hash/height (Anthony Towns) a7469bcd35692d56f57e91b3f21d30855bdf6531 rpc: getdeploymentinfo: change stats to always refer to current period (Anthony Towns) 7f15c1841b98de6931a7ac68e16635a05d3e96cf rpc: getdeploymentinfo: allow specifying a blockhash other than tip (Anthony Towns) fd826130a0a4e67fdc26f8064f4ecb4ff79b3333 rpc: move softfork info from getblockchaininfo to getdeploymentinfo (Anthony Towns) Pull request description: The aim of this PR is to improve the ability to monitor soft fork status. It first moves the softfork section from getblockchaininfo into a new RPC named getdeploymentinfo, which is then also able to query the status of forks at an arbitrary block rather than only at the tip. In addition, bip9 status is changed to indicate the status of the given block, rather than just for the next block, and an additional field is included to indicate whether each block in the signalling period signaled. ACKs for top commit: laanwj: Code review and lightly tested ACK a3809228917b8f750090c8bfec8e283391dbb524 Sjors: tACK a3809228917b8f750090c8bfec8e283391dbb524 fjahr: tACK a3809228917b8f750090c8bfec8e283391dbb524 Tree-SHA512: 7417d733b47629f229c5128586569909250481a3e94356c52fe67a03fd42cd81745246e384b98c4115fb61587714c879e4bc3e5f5c74407d9f8f6773472a33cb
2022-01-15rpc: move softfork info from getblockchaininfo to getdeploymentinfoAnthony Towns
2022-01-13test: use MiniWallet for mempool_accept.pySebastian Falbesoner
This test can now be run even with the Bitcoin Core wallet disabled.
2022-01-11test: MiniWallet: support default `from_node` for creating txsSebastian Falbesoner
If no `from_node` parameter is passed explicitely to the `create_self_transfer` method, the test node passed in the course of creating the MiniWallet instance is used. This seems to be the main use-case in most of the current functional tests, i.e. in many instances the calls can be shortened.
2022-01-11test: create txs with current `nVersion` (2) by defaultSebastian Falbesoner
This enables testing of BIP68 without the need of explicitly setting nVersion to 2. This is e.g. useful for transactions created with MiniWallet.
2022-01-11test: refactor: add constant for sequence number `SEQUENCE_FINAL`Sebastian Falbesoner
2021-12-29test: add TestNode.wait_for_debug_logJames O'Beirne
2021-12-29test: introduce TestNode.debug_log_bytesJames O'Beirne
2021-12-26test: introduce `address_to_scriptpubkey` helperSebastian Falbesoner
Works only with legacy addresses (Base58Check) right now.
2021-12-26test: introduce `getnewdestination` helper for generating various address typesSebastian Falbesoner
This serves as a replacement for the getnewaddress RPC if no wallet is available. In addition to the address, it also returns the corresponding public key and output script (scriptPubKey).
2021-12-16test: previous releases: add v22.0Sjors Provoost
2021-12-16test: bump sandbox argument minimum versionSjors Provoost
The -sandbox argument is not present in the v22.0 release. Changing the minimum version to 229900 ensures it's used when testing the master branch. If the argument is backported, the minimum version can be adjusted to e.g. 220100.
2021-12-14Merge bitcoin/bitcoin#22777: net processing: don't request tx relay on ↵MarcoFalke
feeler connections eaf6be0114a6d7763767da9496907fe8a670ff9e [net processing] Do not request transaction relay from feeler connections (John Newbery) 0220b834b175dc8c45a2c60213474a72c0ef8193 [test] Add testing for outbound feeler connections (John Newbery) Pull request description: Feelers are short-lived connections used to test the viability of peers. The bitcoind node will periodically open feeler connections to addresses in its addrman, wait for a `version` message from the peer, and then close the connection. Currently, we set `fRelay` to `1` in the `version` message for feeler connections, indicating that we want the peer to relay transactions to us. However, we close the connection immediately on receipt of the `version` message, and so never process any incoming transaction announcements. This PR changes that behaviour to instead set `fRelay` to `0` indicating that we do not wish to receive transaction announcements from the peer. This PR also extends the `addconnection` RPC to allow creating outbound feeler connections from the node to the test framework, and a test to verify that the node sets `fRelay` to `0` in the `version` message to feeler connections. ACKs for top commit: naumenkogs: ACK eaf6be0114a6d7763767da9496907fe8a670ff9e MarcoFalke: review ACK eaf6be0114a6d7763767da9496907fe8a670ff9e 🏃 Tree-SHA512: 1c56837dbd0a396fe404a5e39f7459864d15f666664d6b35ad109628b13158e077e417e586bf48946a23bd5cbe63716cb4bf22cdf8781b74dfce6047b87b465a
2021-12-10Merge bitcoin/bitcoin#19499: p2p: Make timeout mockable and type safe, speed ↵MarcoFalke
up test fadc0c80ae4e526fb2b503f7cc02f6122aaf1de5 p2p: Make timeout mockable and type safe, speed up test (MarcoFalke) fa6d5a238d2c94440105ddd4f1554f85659d6c5b scripted-diff: Rename m_last_send and m_last_recv (MarcoFalke) Pull request description: Use type-safe time for better code readability/maintainability and mockable time for better testability. This speeds up the p2p_timeout test. This is also a bugfix for intermittent test issues like: https://cirrus-ci.com/task/4769904156999680?command=ci#L2836 Fixes #20654 ACKs for top commit: laanwj: Code review ACK fadc0c80ae4e526fb2b503f7cc02f6122aaf1de5 naumenkogs: ACK fadc0c80ae4e526fb2b503f7cc02f6122aaf1de5 Tree-SHA512: 28c6544c97f188c8a0fbc80411c74ab74ffd055885322c325aa3d1c404b29c3fd70a737e86083eecae58ef394db1cb56bc122d06cff63742aa89a8e868730c64
2021-12-09test: Replace hashlib.new with named constructorMarcoFalke
2021-12-09Merge bitcoin/bitcoin#23715: test: feature_rbf.py: check specified wallet ↵MarcoFalke
type availability 84bc35d7a5b91c50cb58ff844e7fc7d9f026cc76 test: feature_rbf.py: check specified wallet type availability (Sebastian Falbesoner) Pull request description: The test currently leads to a failure if in general wallet support is compiled, but the library for the specified type (BDB/SQLite) is not, i.e. if started with the `--legacy-wallet` parameter, but bitcoind is compiled without BDB support, see e.g. https://github.com/bitcoin/bitcoin/pull/23682#issuecomment-989044207 Fix this by checking if the specified wallet type (BDB for legacy wallet, SQLite for descriptor wallet) is available. Also move the helper `is_specified_wallet_compiled()` to the test framework's class BitcoinTestFramework first, so it can be reused. Should further pave the way for #23682. On my local instance without BDB compiled, all targets in test_runner pass now. ACKs for top commit: mzumsande: ACK 84bc35d7a5b91c50cb58ff844e7fc7d9f026cc76, changes loook good for me and I confirmed that this fixes the error encountered on master when running the test `--without-bdb`. Tree-SHA512: 1575c03c793c8e0ac195d0914eff75d02604301c8fb77d0fdb7c0b245561569c0c7db387ef4de499044b68ab6e14b4b78b955f6e74c84197bcaed95f439c9824
2021-12-08Swap out hashlib.ripemd160 for own implementationPieter Wuille
2021-12-08Add pure Python RIPEMD-160Pieter Wuille
2021-12-08test: feature_rbf.py: check specified wallet type availabilitySebastian Falbesoner
The test currently leads to a failure if in general wallet support is compiled, but the library for the specified type (BDB/SQLite) is not, i.e. if started with the `--legacy-wallet` parameter, but bitcoind is compiled without BDB support. Fix this by checking if the specified wallet type (BDB for legacy wallet, SQLite for descriptor wallet) is available. Also move the helper `is_specified_wallet_compiled()` to the test framework's class BitcoinTestFramework first, so it can be reused.
2021-12-06p2p: Make timeout mockable and type safe, speed up testMarcoFalke
2021-12-02Merge bitcoin/bitcoin#23636: Remove GetAdjustedTime from init.cppMarcoFalke
fa551b3bdd380bcaa8fa929b378b3b6c81a6f65c Remove GetAdjustedTime from init.cpp (MarcoFalke) fa815f8473c56df66302340c5961d18226a60e6f Replace addrman.h include with forward decl in net.h (MarcoFalke) Pull request description: It seems confusing to call `GetAdjustedTime` there, because no offset could have been retrieved from the network at this point. Even if connman was started, `timedata` needs at least 5 peer connections to calculate an offset. Fix the confusion by replacing `GetAdjustedTime` with `GetTime`, which does not change behavior. Also: * Replace magic number with `MAX_FUTURE_BLOCK_TIME` to clarify the context * Add test, which passes both on current master and this pull request * An unrelated refactoring commit, happy to drop ACKs for top commit: dongcarl: Code Review ACK fa551b3bdd380bcaa8fa929b378b3b6c81a6f65c, noticed the exact same thing here: https://github.com/bitcoin/bitcoin/pull/23280/commits/e073634c37f3a1e140920c6e5e3f2c1ae47cd293 mzumsande: Code Review ACK fa551b3bdd380bcaa8fa929b378b3b6c81a6f65c jnewbery: Code review ACK fa551b3bdd380bcaa8fa929b378b3b6c81a6f65c shaavan: ACK fa551b3bdd380bcaa8fa929b378b3b6c81a6f65c theStack: Code-review ACK fa551b3bdd380bcaa8fa929b378b3b6c81a6f65c Tree-SHA512: 15807a0e943e3e8d8c5250c8f6d7b56afb26002b1e290bf93636a2c747f27e78f01f1de04ce1a83d6339e27284c69c43e077a8467545c4078746f4c1ecb1164d
2021-11-30Merge bitcoin/bitcoin#23289: test: add stress tests for initializationW. J. van der Laan
d9803f7a0a33688f7429cf10384244f4770851ca test: add stress tests for initialization (James O'Beirne) 23f85616a8d9c9a1b054e492eca4d199028f34dc test: add node.chain_path and node.debug_log_path (James O'Beirne) Pull request description: In the course of coming up with a test plan for #23280, I thought it would be neat to include a Python snippet showing how I tested the initialization process. I quickly realized I was reinventing the functional test framework... so here's a new test. This change bangs init around like the Fonz hitting a jukebox. It adds some interesting (read: lazy and random) coverage for the initialization process by - interrupting init with SIGTERM after certain log statements, - interrupting init at random points, and - starting init with some essential data missing (block files, block indices, etc.) to test init error paths. As far as I can tell, some of these code paths are uncovered otherwise (namely the startup errors). --- Incidentally, I think I may have uncovered some kind of a bug or race condition with indexing initialization based on an intermittent failure in this testcase. This test sometimes fails after shutting down immediately after `loadblk` thread start: ``` 2021-10-15T21:14:51.295000Z TestFramework (INFO): Starting node and will exit after line 'loadblk thread start' 36 │ 2021-10-15T21:14:51.296000Z TestFramework.node0 (DEBUG): bitcoind started, waiting for RPC to come up 37 │ 2021-10-15T21:14:51.493000Z TestFramework (INFO): terminating node after 110 log lines seen 38 │ 2021-10-15T21:14:51.625000Z TestFramework (INFO): Starting node and will exit after line 'txindex thread start' 39 │ 2021-10-15T21:14:51.625000Z TestFramework.node0 (DEBUG): bitcoind started, waiting for RPC to come up ------> [[ FAILURE HERE ]] 2021-10-15T21:15:21.626000Z TestFramework (WARNING): missed line {bail_line}; bailing now after {num_lines} lines ``` and then fails to start up afterwards. Combined logs showing `Error: txindex best block of the index goes beyond pruned data`, when the node under test is not pruned: ``` node0 2021-10-15T21:16:51.848439Z [shutoff] [validationinterface.cpp:244] [ChainStateFlushed] Enqueuing ChainStateFlushed: block hash=1014bc4ff4917602ae53d10e9dfe230af4b7d52a6cdaa8a47798b9c288180907 node0 2021-10-15T21:16:51.848954Z [shutoff] [init.cpp:302] [Shutdown] Shutdown: done test 2021-10-15T21:16:51.882000Z TestFramework (ERROR): Unexpected exception caught during testing Traceback (most recent call last): File "/home/james/src/bitcoin/test/functional/test_framework/test_framework.py", line 132, in main self.run_test() File "/home/james/src/bitcoin/./test/functional/stress_init.py", line 87, in run_test check_clean_start() File "/home/james/src/bitcoin/./test/functional/stress_init.py", line 60, in check_clean_start node.wait_for_rpc_connection() File "/home/james/src/bitcoin/test/functional/test_framework/test_node.py", line 224, in wait_for_rpc_connection raise FailedToStartError(self._node_msg( test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 1 during initialization test 2021-10-15T21:16:51.882000Z TestFramework (DEBUG): Closing down network thread test 2021-10-15T21:16:51.933000Z TestFramework (INFO): Stopping nodes test 2021-10-15T21:16:51.933000Z TestFramework.node0 (DEBUG): Stopping node node0 stderr Error: txindex best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again) node0 stderr Error: txindex best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again) node0 stderr Error: txindex best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again) node0 stderr Error: txindex best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again) node0 stderr Error: txindex best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again) ``` ACKs for top commit: laanwj: Code review ACK d9803f7a0a33688f7429cf10384244f4770851ca Tree-SHA512: 4d80dc399daf199a6222e81e47d12d830dc7af07355eddbb7f52479a676a645b8d3d45093ff54a9295f01a163b2f4fe0e038e83fc269969e03d4cfda69eaf111
2021-11-30Merge bitcoin/bitcoin#21327: net_processing: ignore transactions while in IBDW. J. van der Laan
6aed8b7e9b206e728367fee9edfeb85b536bba69 [test] tx processing before and after ibd (glozow) b9e105b6643bada4c80f8d521394be4d55e8e4fc [net_processing] ignore all transactions during ibd (glozow) Pull request description: This is basically a mini, IBD-only version of #21224 Incoming transactions aren't really relevant until we're caught up. That's why we send a giant feefilter and don't send tx getdatas, but we also shouldn't process them if peers send them anyway. Simply ignore them. ACKs for top commit: jnewbery: reACK 6aed8b7e9b laanwj: Code review ACK 6aed8b7e9b206e728367fee9edfeb85b536bba69 Tree-SHA512: 8e1616bf355f9d0b180bdbc5461f24c757dc5d7bc7bf651470f3b0bffcca5d5e68287106255b5cede2d96b42bce448a0f8c0649de35a530c5e079f7c89c70a35
2021-11-30Remove GetAdjustedTime from init.cppMarcoFalke
2021-11-29Merge bitcoin/bitcoin#23392: test: move check_node_connections to utilW. J. van der Laan
988024fe37fe00c2deff28e44593e330aa6191f4 test: add check_node_connections in util (brunoerg) Pull request description: This function (`check_node_connections`) exists in `feature_anchors.py` and `p2p_add_connections.py` and does the same thing in both, this PR moves this function to util to avoid repetition and facilitate maintenance. ACKs for top commit: laanwj: Code review ACK 988024fe37fe00c2deff28e44593e330aa6191f4 Tree-SHA512: bf86c5659933539c72cb91ad587552b45c918be74d36fb429e78f3b954f01ed0855a85dd49aea35b432fbd18227c05eb3fec8b99c139c3509c39b19bccf6b7fd
2021-11-26test: always rescan after importing private keys in `init_wallet` helperSebastian Falbesoner
This fixes the functional test feature_rbf.py for descriptor wallets.
2021-11-18test: add check_node_connections in utilbrunoerg
2021-11-16Merge bitcoin/bitcoin#23474: test: scripted-diff cleanups after generate* ↵fanquake
changes fac23c211407a77af82bb1491c48c8d37022c8b3 scripted-diff: Bump copyright headers (MarcoFalke) fa974f1f1417a536636347072e86bcb54a4c909c scripted-diff: Remove redundant sync_all and sync_blocks (MarcoFalke) fad13991aea6463ecf07dd907de1c1b23837d7e7 test: Properly set sync_fun in NodeNetworkLimitedTest (MarcoFalke) faeff577093c4de9eec9491486a2c3766d46dae6 test: Use 4 spaces for indentation (MarcoFalke) Pull request description: Some cleanups after commit 94db963de501e4aba6e5d8150a01ceb85753dee1 ACKs for top commit: fanquake: ACK fac23c211407a77af82bb1491c48c8d37022c8b3 Tree-SHA512: 5acfd5bb9679b41969d0fc6fc85801ccadcd6530ea692bac6352668e06fc7a9b0e1db3fd6fba435e84afe983d2eb07bd0a47c8364462bb7110004bd3d102b698
2021-11-16Merge bitcoin/bitcoin#23516: test: Force --nosandbox when --valgrindfanquake
fa9c26ab3a09c843cb598d188162403bbf8c9b36 test: Force --nosandbox when --valgrind (MarcoFalke) Pull request description: The two options are mutually exclusive and will result in a test failure. Fix that. Can be tested with: ``` $ ./test/functional/wallet_disable.py --valgrind ACKs for top commit: fanquake: ACK fa9c26ab3a09c843cb598d188162403bbf8c9b36 Tree-SHA512: 7d1c36c1b6627ca041757eb0515a0d6cc962a56d783ee4f5647a2ddc2d104491f0586a8ea0b8acebe0a203190f4f5567b349123dfd4c181bcc63361174a8ab63
2021-11-15Merge bitcoin/bitcoin#23394: Taproot wallet test vectors (generation+tests)W. J. van der Laan
f1c33ee4ac1056289f2e67b75755388549ada4ca tests: implement BIP341 test vectors (Pieter Wuille) ac3037df1196b1d95ade2dfad4699ad3a6074903 tests: BIP341 test vector generation (Pieter Wuille) ca83ffc2ea5fe08f16fff7df71c040d067f2afb0 tests: add deterministic signing mode to ECDSA (Pieter Wuille) c98c53f20cadeda53f6a9323f72363593d174f68 tests: abstract out precomputed BIP341 signature hash elements (Pieter Wuille) a5bde018b42cd38979fee71d870e0140b10c73d6 tests: give feature_taproot access to sighash preimages (Pieter Wuille) 51408250969e7ed171378369a995c90d4f813189 tests: add more fields to TaprootInfo (Pieter Wuille) 2478c6730a81dda3c56cb99087caf6abe49c85f5 Make signing follow BIP340 exactly w.r.t. aux randomness (Pieter Wuille) Pull request description: This PR adds code to `test/functional/feature_taproot.py` which runs through a (deterministic) scenario covering several aspects of the wallet side of BIP341 (scriptPubKey computation from keys/scripts, control block computation, key path spending), with the ability to output test vectors in mediawiki format based on this scenario. The generated tests are then also included directly in `src/test/script_tests.cpp` and `src/test/script_standard_tests.cpp`. I intend to add these test vectors to BIP341 itself: https://github.com/bitcoin/bips/pull/1225 ACKs for top commit: laanwj: Code review ACK f1c33ee4ac1056289f2e67b75755388549ada4ca Tree-SHA512: fcf7109539cb214d3190516b205cd32d2b1b452f14aa66f4107acfaa8bfc7d368f626857f1935665a4342eabc0b9ee8aba608a7c0a2494bec0b498e723439c9d
2021-11-15test: Force --nosandbox when --valgrindMarcoFalke
2021-11-15test: Return the largest utxo in MiniWallet.get_utxoMarcoFalke
2021-11-12tests: add deterministic signing mode to ECDSAPieter Wuille
This does the following: * Adds a rfc6979 argument to test_framework/key.py's sign_ecdsa to select (deterministic) RFC6979-based nonce generation. * Add a flag in feature_taproot.py's framework called "deterministic". * Make the Schnorr signing in feature_taproot.py randomized by default, reverting to the old deterministic (aux_rnd=0x0000...00) behavior if the deterministic context flag is set. * Make the ECDSA signing in feature_taproot.py use RFC6979-based nonces when the deterministic context flag is set (keeping the old randomized behavior otherwise).
2021-11-12tests: abstract out precomputed BIP341 signature hash elementsPieter Wuille
2021-11-12tests: give feature_taproot access to sighash preimagesPieter Wuille
2021-11-12tests: add more fields to TaprootInfoPieter Wuille
2021-11-10scripted-diff: Bump copyright headersMarcoFalke
The previous diff touched most files in ./test/, so bump the headers to avoid having to touch them again for a bump later. -BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./test/ -END VERIFY SCRIPT-
2021-11-09test: MiniWallet: add P2TR support and use it per defaultSebastian Falbesoner
2021-11-09Merge bitcoin/bitcoin#23300: test: Implicitly sync after generate*, unless ↵MarcoFalke
opted out facc352648e4fe1ed9b406400b6e4a9d51f30349 test: Implicitly sync after generate*, unless opted out (MarcoFalke) Pull request description: The most frequent failure in functional tests are intermittent races. Fixing such bugs is cumbersome because it involves: * Noticing the failure * Fetching and reading the log to determine the test case that failed * Adding a `self.sync_all()` where it was forgotten * Spamming out a pr and waiting for review, which is already sparse Also, writing a linter to catch those is not possible, nor is review effective in finding these bugs prior to merge. Fix all future intermittent races caused by a missing sync_block call by calling `sync_all` implicitly after each `generate*`, unless opted out. This ensures that the code is race-free (with regards to blocks) when the tests pass once, instead of our current approach where the code can never be guaranteed to be race-free. There are some scripted-diff cleanups (see https://github.com/bitcoin/bitcoin/pull/22567), but they will be submitted in a follow-up to reduce the conflicts in this pull. ACKs for top commit: lsilva01: tACK facc352 on Ubuntu 20.04 brunoerg: tACK facc352648e4fe1ed9b406400b6e4a9d51f30349 on MacOS 11.6 Tree-SHA512: 046a40a066b4a3bd28a3077bd654fa8887442dd1f0ec6fd11671865809ef02376f126eb667a1320ebd67b6e372c78c00dbf8bd25d86ed86f1d9a25363103ed97
2021-11-05Merge bitcoin/bitcoin#22949: fee: Round up fee calculation to avoid a lower ↵Samuel Dobson
than expected feerate 80dc829be7f8c3914074b85bb4c125baba18cb2c tests: Calculate fees more similarly to CFeeRate::GetFee (Andrew Chow) ce2cc44afd51f3df4ee7f14ea05b8da229183923 tests: Test for assertion when feerate is rounded down (Andrew Chow) 0fbaef9676a1dcb84bcf95afd8d994831ab327b6 fees: Always round up fee calculated from a feerate (Andrew Chow) Pull request description: When calculating the fee for a feerate, it is possible that the final calculation will have fractional satoshis. Currently those are ignored via truncation which results in the absolute fee being rounded down. Rounding down is problematic because it results in a feerate that is slightly lower than the feerate represented by the `CFeeRate` object. A slightly lower feerate particularly causes issues for coin selection as it can trigger an assertion error. To avoid potentially underpaying the feerate (and the assertion), always round up the calculated fee. A test is added for the assertion, along with a comment explaining what happens. It is unlikely that a user can trigger this as it requires a very specific set of rounding errors to occur as well as the transaction not needing any change and being right on the lower bound of the exact match window. However I was able to trigger the assertion while running coin selection simulations, albeit after thousands of transactions and with some weird feerates. ACKs for top commit: ryanofsky: Code review ACK 80dc829be7f8c3914074b85bb4c125baba18cb2c promag: Tested ACK 80dc829be7f8c3914074b85bb4c125baba18cb2c. lsilva01: tACK 80dc829 meshcollider: utACK 80dc829be7f8c3914074b85bb4c125baba18cb2c Tree-SHA512: fe26684c60f236cab48ea6a4600c141ce766dbe59504ec77595dcbd7fd0b34559acc617007f4f499c9155d8fda0a336954413410ba862b19c765c0cfac79d642
2021-10-29test: Implicitly sync after generate*, unless opted outMarcoFalke
2021-10-28[test] tx processing before and after ibdglozow
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
2021-10-27test: MiniWallet: more deterministic coin selection for coinbase UTXOs ↵Sebastian Falbesoner
(oldest first) The coin selection strategy for MiniWallet is quite straight-forward: simply pick a single UTXO with the largest value: self._utxos = sorted(self._utxos, key=lambda k: k['value']) utxo_to_spend = utxo_to_spend or self._utxos.pop() If there are several candidates with the same value, however, it is not clear which one is taken. This can be particularly problematic for coinbase outputs with fixed block subsidy, since spending could lead to a 'bad-txns-premature-spend-of-coinbase' reject if an UTXO from a too-recent block is picked. Introduce block height as second criteria (saved in self._utxos in the methods generate(...) and rescan_utxos(...)), in order to avoid potential issues with coinbases that are not matured yet.
2021-10-26test: add script_util helper for creating bare multisig scriptsSebastian Falbesoner