aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/util.py
AgeCommit message (Collapse)Author
2021-04-12tests: Skip SQLite fsyncs while testingAndrew Chow
Since we want tests to run quickly, and since tests do a lot more db operations than expected we expect to see in actual usage, we disable sqlite's syncing behavior to make db operations run much faster. This syncing behavior is necessary for normal operation as it helps guarantee that data won't become lost or corrupted, but in tests, we don't care about that.
2021-03-23rpc: deprecate `addresses` and `reqSigs` from rpc outputsMichael Dietz
1) add a new sane "address" field (for outputs that have an identifiable address, which doesn't include bare multisig) 2) with -deprecatedrpc: leave "reqSigs" and "addresses" intact (with all weird/wrong behavior they have now) 3) without -deprecatedrpc: drop "reqSigs" and "addresses" entirely, always.
2021-02-21test: Avoid connecting to real network when running testsMarcoFalke
Can be reviewed with --word-diff-regex=.
2021-01-21Merge #17556: test: Change feature_config_args.py not to rely on strange ↵MarcoFalke
regtest=0 behavior ff44cae279bef7997f76db18deb1e41b39f05cb6 test: Change feature_config_args.py not to rely on strange regtest=0 behavior (Russell Yanofsky) Pull request description: Update test to simply generate a normal mainnet configuration file instead of using a crazy setup where a regtest=1 config file using an includeconf in the [regtest] section includes another config file that specifies regtest=0, retroactively switching the network to mainnet. This setup was fragile and only worked because the triggered InitError happened early enough that none of the ignored [regtest] options mattered (only affecting log output). This change was originally made as part of #17493 Top commit has no ACKs. Tree-SHA512: 3f77305454f04438493dfc2abd78a00434b30869454d1c3f54587b9c1f63239c49c90fb3b4d3a777ad130f2184e0f2dac87cee4cd23c50f1b3496a375943da01
2021-01-07net: Add -natpmp command line optionHennadii Stepanov
2020-11-16Merge #18836: wallet: upgradewallet fixes and additional testsWladimir J. van der Laan
5f9c0b6360215636cfa62a70d3a70f1feb3977ab wallet: Remove -upgradewallet from dummywallet (MarcoFalke) a314271f08215feba53ead27096ac7fda34acb3c test: Remove unused wallet.dat (MarcoFalke) bf7635963c03203e7189ddaa56c6b086a0108cbf tests: Test specific upgradewallet scenarios and that upgrades work (Andrew Chow) 4b418a9decc3e855ee4b0bbf9e61121c8e9904e5 test: Add test_framework/bdb.py module for inspecting bdb files (Andrew Chow) 092fc434854f881330771a93a1280ac67b1d3549 tests: Add a sha256sum_file function to util (Andrew Chow) 0bd995aa19be65b0dd23df1df571c71428c2bc32 wallet: upgrade the CHDChain version number when upgrading to split hd (Andrew Chow) 8e32e1c41c995e832e643f605d35a7aa112837e6 wallet: remove nWalletMaxVersion (Andrew Chow) bd7398cc6258c258e9f4411c50630ec4a552341b wallet: have ScriptPubKeyMan::Upgrade check against the new version (Andrew Chow) 5f720544f34dedf75b063b962845fa8eca604514 wallet: Add GetClosestWalletFeature function (Andrew Chow) 842ae3842df489f1b8d68e67a234788966218184 wallet: Add utility method for CanSupportFeature (Andrew Chow) Pull request description: This PR cleans up the wallet upgrade mechanism a bit, fixes some probably bugs, and adds more test cases. The `nWalletMaxVersion` member variable has been removed as it made `CanSupportFeature` unintuitive and was causing a couple of bugs. The reason this was introduced originally was to allow a wallet upgrade to only occur when the new feature is first used. While this makes sense for the old `-upgradewallet` option, for an RPC, this does not quite make sense. It's more intuitive for an upgrade to occur if possible if the `upgradewallet` RPC is used as that's an explicit request to upgrade a particular wallet to a newer version. `nWalletMaxVersion` was only relevant for upgrades to `FEATURE_WALLETCRYPT` and `FEATURE_COMPRPUBKEY` both of which are incredibly old features. So for such wallets, the behavior of `upgradewallet` will be that the feature is enabled immediately without the wallet needing to be encrypted at that time (note that `FEATURE_WALLETCRYPT` indicates support for encryption, not that the wallet is encrypted) or for a new key to be generated. `CanSupportFeature` would previously indicate whether we could upgrade to `nWalletMaxVersion` not just whether the current wallet version supported a feature. While this property was being used to determine whether we should upgrade to HD and HD chain split, it was also causing a few bugs. Determining whether we should upgrade to HD or HD chain split is resolved by passing into `ScriptPubKeyMan::Upgrade` the version we are upgrading to and checking against that. By removing `nWalletMaxVersion` we also fix a bug where you could upgrade to HD chain split without the pre-split keypool. `nWalletMaxVersion` was also the version that was being reported by `getwalletinfo` which meant that the version reported was not always consistent across restarts as it depended on whether `upgradewallet` was used. Additionally to make the wallet versions consistent with actually supported versions, instead of just setting the wallet version to whatever is given to `upgradewallet`, we normalize the version number to the closest supported version number. For example, if given 150000, we would store and report 139900. Another bug where CHDChain was not being upgraded to the version supporting HD chain split is also fixed by this PR. Lastly several more tests have been added. Some refactoring to the test was made to make these tests easier. These tests check specific upgrading scenarios, such as from non-HD (version 60000) to HD to pre-split keypool. Although not specifically related to `upgradewallet`, `UpgradeKeyMetadata` is now being tested too. Part of the new tests is checking that the wallet files are identical before and after failed upgrades. To facilitate this, a utility function `sha256sum_file` has been added. Another part of the tests is to examine the wallet file itself to ensure that the records in the wallet.dat file have been correctly modified. So a new `bdb.py` module has been added to deserialize the BDB db of the wallet.dat file. This format isn't explicitly documented anywhere, but the code and comments in BDB's source code in file `dbinc/db_page.h` describe it. This module just dumps all of the fields into a dict. ACKs for top commit: MarcoFalke: approach ACK 5f9c0b6360 laanwj: Code review ACK 5f9c0b6360215636cfa62a70d3a70f1feb3977ab jonatack: ACK 5f9c0b6360215636cfa62a70d3a70f1feb3977ab, approach seems fine, code review, only skimmed the test changes but they look well done, rebased on current master, debug built and verified the `wallet_upgradewallet.py` test runs green both before and after running `test/get_previous_releases.py -b v0.19.1 v0.18.1 v0.17.2 v0.16.3 v0.15.2` Tree-SHA512: 7c4ebf420850d596a586cb6dd7f2ef39c6477847d12d105fcd362abb07f2a8aa4f7afc5bfd36cbc8b8c72fcdd1de8d2d3f16ad8e8ba736b6f4f31f133fe5feba
2020-11-04tests: Add a sha256sum_file function to utilAndrew Chow
2020-10-20test: Move (dis)?connect_nodes globals into TestFramework as helpersElliott Jin
2020-10-16test: remove unused helpers random_transaction(), make_change() and ↵Sebastian Falbesoner
gather_inputs()
2020-09-03Merge #19816: test: Rename wait until helper to wait_until_helperfanquake
fa1cd9e1ddc6918c3d600d36eadea71eebb242b6 test: Remove unused lock arg from BitcoinTestFramework.wait_until (MarcoFalke) fad2794e93b4f5976e81793a4a63aa03a2c8c686 test: Rename wait until helper to wait_until_helper (MarcoFalke) facb41bf1d1b7ee552c627f9829b4494b817ce28 test: Remove unused p2p_lock in VersionBitsWarningTest (MarcoFalke) Pull request description: This avoids confusion with the `wait_until` member functions, which should be preferred because they take the appropriate locks and scale the timeout appropriately on their own. ACKs for top commit: laanwj: Code review ACK fa1cd9e1ddc6918c3d600d36eadea71eebb242b6 hebasto: ACK fa1cd9e1ddc6918c3d600d36eadea71eebb242b6, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: 319d400085606a4c738e314824037f72998e6657d8622b363726842aba968744f23c56d27275dfe506b8cbbb6e97fc39ca1d325db05d4d67df0e8b35f2244d5c
2020-09-02test: Change feature_config_args.py not to rely on strange regtest=0 behaviorRussell Yanofsky
Update test to simply generate a normal mainnet configuration file instead of using a crazy setup where a regtest=1 config file using an includeconf in the [regtest] section includes another config file that specifies regtest=0, retroactively switching the network to mainnet. This setup was fragile and only worked because the triggered InitError happened early enough that none of the ignored [regtest] options mattered (only affecting log output).
2020-09-01Merge #19105: Add Muhash3072 implementation in PythonWladimir J. van der Laan
36ec9801a4edb9663ef9ce9ad298233766b903e8 test: Add chacha20 test vectors in muhash (Fabian Jahr) 0e2b400fea890e769b75da5b55fa1902fd9f9851 test: Add basic Python/C++ Muhash implementation parity unit test (Fabian Jahr) b85543cb7361d6ba27c0eeca756eec9fd5395b36 test: Add Python MuHash3072 implementation to test framework (Pieter Wuille) ab30cece0e84a8b917cb9a219c2466574362f300 test: Move modinv to util and add unit test (Fabian Jahr) Pull request description: This is the second in a [series of pull requests](https://github.com/bitcoin/bitcoin/pull/18000) to implement an Index for UTXO set statistics. This pull request adds a Python implementation of Muhash3072, a homomorphic hashing algorithm to be used for hashing the UTXO set. The Python implementation can then be used to compare behavior with the C++ version. ACKs for top commit: jnewbery: utACK 36ec9801a laanwj: Code review ACK 36ec9801a4edb9663ef9ce9ad298233766b903e8 Tree-SHA512: a3519c6e11031174f1ae71ecd8bcc7f3be42d7fc9c84c77f2fbea7cfc5ad54fcbe10b55116ad8d9a52ac5d675640eefed3bf260c58a02f2bf3bc0d8ec208baa6
2020-08-27test: Rename wait until helper to wait_until_helperMarcoFalke
2020-08-26test: Add docstring to wait_until() in util.py to warn about its usageSeleme Topuz
2020-08-06refactor: test: use _ variable for unused loop countersSebastian Falbesoner
substitutes "for x in range(N):" by "for _ in range(N):" indicates to the reader that a block is just repeated N times, and that the loop counter is not used in the body
2020-07-16test: Move modinv to util and add unit testFabian Jahr
2020-06-21Merge #19208: test: move sync_blocks and sync_mempool functions to ↵MarcoFalke
test_framework.py cc84460c164bcb2a874d4f08b3a2624e5ee9ff0a test: move sync_blocks and sync_mempool functions to test_framework.py (Roy Shao) Pull request description: This PR moves `sync_blocks` and `sync_mempool` out from `test_framework/util.py` to `test_framework/test_framework.py` so they can take contextual information of test framework into account. * Change all reference callers to call functions from `test_framework.py` * Remove `**kwargs` which is not used * Take into account of `timeout_factor` when respecting timeout in function implementations. * Pass all tests by running `./test/functional/test_runner.py` fixes #18930 ACKs for top commit: MarcoFalke: ACK cc84460c164bcb2a874d4f08b3a2624e5ee9ff0a , reviewed with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space 💫 Tree-SHA512: a79b2a3fa842fc26a7aacb834bb2aea88b3049916c0b754e60002a77ce94bb5954e0ea3b436bf268e9295efb62d721dfef263a09339a55c684ac3fda388c275e
2020-06-18test: move sync_blocks and sync_mempool functions to test_framework.pyRoy Shao
2020-06-16pep-8 test/functional/test_framework/util.pyMarcoFalke
Can be reviewed with --word-diff-regex=. -U0
2020-06-16test: refactor: Inline adjust_bitcoin_conf_for_pre_17MarcoFalke
2020-06-08Merge #18890: test: disconnect_nodes should warn if nodes were already ↵MarcoFalke
disconnected 34e641a564531853342b03db2d9f0bf52b6e439e test: Remove unnecessary disconnect_nodes call in rpc_psbt.py (Danny Lee) e6e7abd51a9a6027acac7a9964e36357f25e242c test: remove redundant two-way disconnect_nodes calls (Danny Lee) a9bd1f9adf869a95f70b3a40615a2f8e8e52db1d test: warn if nodes not connected before disconnect_nodes (Danny Lee) Pull request description: There's no harm in calling `disconnect_nodes` for nodes that weren't connected (in this case it's a no-op). However, detecting this case and logging a warning can help ensure that tests are behaving as expected. In addition, since `disconnect_nodes` works bidirectionally, I removed all instances of this pattern: ``` disconnect_nodes(self.nodes[0], 1) disconnect_nodes(self.nodes[1], 0) ``` ACKs for top commit: MarcoFalke: review ACK 34e641a564531853342b03db2d9f0bf52b6e439e 👔 amitiuttarwar: ACK 34e641a564. Thanks for this test improvement! Tree-SHA512: 344855ceb46c012d43c13d7c09f44d32dcb7645706d10ae1e4645d9edca54c6c6c13fee26b79480755cdfcdf39b4b5770b36bb03ce71ba002d5be8a27fe008af
2020-05-18test: Add capability to disable RPC timeout in functional tests.codeShark149
Modifies the existing --factor flag to --timeout-factor to better express intent. Adds rules to disable timeout if --timeout-factor is set to 0. Modfies --timeout-factor help doc to inform users about this feature.
2020-05-08Merge #18866: test: Fix verack race to avoid intermittent test failuresMarcoFalke
fae153b40968bfd974a4709bcd841a59447abf18 test: Fix verack race to avoid intermittent test failures (MarcoFalke) Pull request description: Fixes #18832 ACKs for top commit: laanwj: ACK fae153b40968bfd974a4709bcd841a59447abf18 Tree-SHA512: 071de8c8e2b2787c9433c7460e18b9a54beaf471a52ce848c5ac7263fc2a40f5b976d4f558ecc494fd0fa07284b7c98d29267cade58f80ab74fe9a7d18d94298
2020-05-07test: warn if nodes not connected before disconnect_nodesDanny Lee
2020-05-04test: Fix verack race to avoid intermittent test failuresMarcoFalke
2020-05-03Merge #18617: test: add factor option to adjust test timeoutsMarcoFalke
2742c3428633b6ceaab6714635dc3adb74bf121b test: add factor option to adjust test timeouts (Harris) Pull request description: This PR adds a new option **factor** that can be used to adjust timeouts in various functional tests. Several timeouts and functions from `authproxy`, `mininode`, `test_node` and `util` have been adapted to use this option. The factor-option definition is located in `test_framework.py`. Fixes https://github.com/bitcoin/bitcoin/issues/18266 Also Fixes https://github.com/bitcoin/bitcoin/issues/18834 ACKs for top commit: MarcoFalke: Thanks! ACK 2742c3428633b6ceaab6714635dc3adb74bf121b Tree-SHA512: 6d8421933ba2ac1b7db00b70cf2bc242d9842c48121c11aadc30b0985c4a174c86a127d6402d0cd73b993559d60d4f747872d21f9510cf4806e008349780d3ef
2020-05-03test: add factor option to adjust test timeoutsHarris
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2020-04-29test: added test for upgradewallet RPCHarris
2020-04-19test: Increase debugging to hunt down mempool_reorg intermittent failureMarcoFalke
2020-04-16scripted-diff: Bump copyright headersMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-03-30test: check that peer is connected when calling sync_*MarcoFalke
2019-12-09test: re-enable CLI test support by using EncodeDecimal in json.dumps()fanquake
As mentioned in https://github.com/bitcoin/bitcoin/pull/17675#issuecomment-563188648
2019-10-31[qa] Add shrinkdebugfile=0 to regtest bitcoin.confSuhas Daftuar
This helps avoid accidentally truncating the debug.log while manually debugging.
2019-10-06Fix Python Docstring to include all Args.John Bampton
2019-10-02Merge #16524: Wallet: Disable -fallbackfee by defaultMarcoFalke
ea4cc3a7b36a9c77dbf0aff439da3ef0ea58e6e4 Truly decouple wallet from chainparams for -fallbackfee (Jorge Timón) Pull request description: Before it was 0 by default for main and 20000 for test and regtest. Now it is 0 by default for all chains, thus there's no need to call Params(). Also now the default for main is properly documented. Suggestion for release notes: -fallbackfee was 0 (disabled) by default for the main chain, but 20000 by default for the test chains. Now it is 0 by default for all chains. Testnet and regtest users will have to add fallbackfee=20000 to their configuration if they weren't setting it and they want it to keep working like before. Should I propose them to the wiki for the release notes or only after merge? For more context, see https://github.com/bitcoin/bitcoin/pull/16402#issuecomment-515701042 ACKs for top commit: MarcoFalke: ACK ea4cc3a7b36a9c77dbf0aff439da3ef0ea58e6e4 Tree-SHA512: fdfaba5d813da4221e405e0988bef44f3856d10f897a94f9614386d14b7716f4326ab8a6646e26d41ef3f4fa61b936191e216b1b605e9ab0520b0657fc162e6c
2019-10-02Truly decouple wallet from chainparams for -fallbackfeeJorge Timón
Before it was 0 by default for main and 20000 for test and regtest. Now it is 0 by default for all chains, thus there's no need to call Params(). Also now the default for main is properly documented
2019-09-22Merge #16918: test: Make PORT_MIN in test runner configurableMarcoFalke
fa69588537bc91c0aedbc89ef1760d89cbffad75 test: Make PORT_MIN in test runner configurable (MarcoFalke) Pull request description: This is needed when some ports in the port range are used by other processes. Note that simply assigning the ports dynamically does not work: * We spin up several nodes per test (each node gets its own port) * We run several tests in parallel So to avoid nodes from different tests colliding on ports, the port assignment must be deterministic (can not be dynamic). Fixes: #10869 ACKs for top commit: practicalswift: ACK fa69588537bc91c0aedbc89ef1760d89cbffad75 -- diff looks correct promag: ACK fa69588537bc91c0aedbc89ef1760d89cbffad75. Tree-SHA512: e79adb015e7de79064e2d14336c38bc9672bd779ad6c52917721897e73f617c39d32c068a369c26670002a6c4ab95a71ef3a6878ebdd9710e02f410e2f7bcd14
2019-09-19test: Make PORT_MIN in test runner configurableMarcoFalke
2019-09-19Test: Move common function assert_approx() into util.pyfridokus
2019-09-17test: Remove unused connect_nodes_biMarcoFalke
2019-09-12Merge #16551: test: Test that low difficulty chain fork is rejectedMarcoFalke
333317ce6b67aa92f7363d48cd750712190b4b6b test: Test that low difficulty chain fork is rejected (MarcoFalke) fa31dc1bf4ee471c4641eef8de02702ba0619ae7 test: Pass down correct chain name in tests (MarcoFalke) Pull request description: To prevent OOM, Bitcoin Core will reject chain forks at low difficulty by default. This is the only use-case of checkpoints, so add a test for it to make sure the feature works as expected. If it didn't work, checkpoints would have no use-case and we might as well remove them ACKs for top commit: Sjors: Thanks for adding the node 1 example. Code review ACK 333317c Tree-SHA512: 90dffa540d0904f3cffb61d2382b1a26f84fe9560b7013e4461546383add31a8757b350616a6d43217c59ef7b8b2a1b62bb3bab582c679cbb2c660a782ce7be1
2019-09-03test: Print both messages on failure in assert_raises_messageMarcoFalke
2019-08-19Bugfix: QA: Run tests with UPnP disabledLuke Dashjr
Needed for builds configured with --enable-upnp-default
2019-08-16test: Pass down correct chain name in testsMarcoFalke
2019-08-15Merge #16060: Bury bip9 deploymentsMarcoFalke
e78aaf41f43d0e2ad78fa6d8dad61032c8ef73d0 [docs] Add release notes for burying bip 9 soft fork deployments (John Newbery) 8319e738f9f118025b332e4fa804d4c31e4113f4 [tests] Add coverage for the content of getblockchaininfo.softforks (James O'Beirne) 0328dcdcfcb56dc8918697716d7686be048ad0b3 [Consensus] Bury segwit deployment (John Newbery) 1c93b9b31c2ab7358f9d55f52dd46340397c906d [Consensus] Bury CSV deployment height (John Newbery) 3862e473f0cb71a762c0306b171b591341d58142 [rpc] Tidy up reporting of buried and ongoing softforks (John Newbery) Pull request description: This hardcodes CSV and segwit activation heights, similar to the BIP 90 buried deployments for BIPs 34, 65 and 66. CSV and segwit have been active for over 18 months. Hardcoding the activation height is a code simplification, makes it easier to understand segwit activation status, and reduces technical debt. This was originally attempted by jl2012 in #11398 and again by me in #12360. ACKs for top commit: ajtowns: ACK e78aaf41f43d0e2ad78fa6d8dad61032c8ef73d0 ; checked diff to previous acked commit, checked tests still work ariard: ACK e78aaf4, check diff, run the tests again and successfully activated csv/segwit heights on mainnet as expected. MarcoFalke: ACK e78aaf41f43d0e2ad78fa6d8dad61032c8ef73d0 (still didn't check if the mainnet block heights are correct, but the code looks good now) Tree-SHA512: 7e951829106e21a81725f7d3e236eddbb59349189740907bb47e33f5dbf95c43753ac1231f47ae7bee85c8c81b2146afcdfdc11deb1503947f23093a9c399912
2019-08-14[Consensus] Bury segwit deploymentJohn Newbery
Hardcode segwit deployment height to 481824 for mainnet.
2019-08-14[Consensus] Bury CSV deployment heightJohn Newbery
Hard code CSV deployment height to 419328 for mainnet.
2019-08-13[rpc] Tidy up reporting of buried and ongoing softforksJohn Newbery
This combines reporting of buried (formally ISM) softfork deployments and BIP9 versionbits softfork deployments into one JSON object in the getblockchaininfo return object.
2019-08-13Moved and renamed hash256 from util.py to zmq_interface.pyElichai Turkel
2019-07-31test: Adapt test framework for chains other than "regtest"MarcoFalke
Co-Authored-By: Jorge Timón <jtimon@jtimon.cc>