aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
AgeCommit message (Collapse)Author
2023-04-04test: Remove windows workaround in authproxyMarcoFalke
2023-03-31test: Remove python3.5 workaround in authproxyMarcoFalke
Also, move the burden of checking for a timeout to the client and disable the timeout on the server. This should avoid intermittent issues in slow tests (for example mining_getblocktemplate_longpoll.py, or feature_dbcrash.py), or possibly when the server is running slow (for example in valgrind). There shouldn't be any downside in tests caused by a high rpcservertimeout.
2023-03-28refactor: use address_to_scriptpubkey to retrieve addresses scriptpubkeyismaelsadeeq
This commit updates the code by replacing the RPC call used to decode an address and retrieve its corresponding scriptpubkey with the address_to_scriptpubkey function. address_to_scriptpubkey function can now decode all addresses formats, which makes it more efficient to use.
2023-03-28refactor: move address_to_scriptpubkey to address.pyismaelsadeeq
The COINBASE_MATURITY constant in blocktools.py is imported in wallet.py. However, importing address_to_scriptpubkey to blocktools.py will generate a circular import error. Since the method is related to addresses, it is best to move it to address.py, which will also fix the circular import error. Update imports of address_to_scriptpubkey accordingly.
2023-03-24Merge bitcoin/bitcoin#27269: test: Support decoding segwit address in ↵fanquake
address_to_scriptpubkey() d178082996dc3000f42816f89afcf3fa4d31e159 test: add bech32 decoding support to address_to_scriptpubkey() (ismaelsadeeq) aac8793c7a2ee7630641dd74be6ba2ead50c2aee test: test_bech32_decode in address.py (ismaelsadeeq) Pull request description: [rpc_scantxoutset.py](https://github.com/bitcoin/bitcoin/blob/e695d8536e534f1e59de4a62a0d87a93e7a73456/test/functional/rpc_scantxoutset.py#L26) sendtodestination only sends to legacy addresses and scriptPubkeys because [wallet.py](https://github.com/bitcoin/bitcoin/blob/e695d8536e534f1e59de4a62a0d87a93e7a73456/test/functional/test_framework/wallet.py#L415) address_to_scriptpubkey does not support conversion of segwit address. This update enables address_to_scriptpubkey to support the conversion of testnet segwit addresses to scriptPubkeys. This change will enable [rpc_scantxoutset.py](https://github.com/bitcoin/bitcoin/blob/e695d8536e534f1e59de4a62a0d87a93e7a73456/test/functional/rpc_scantxoutset.py#L22) ScantxoutsetTest to have more test coverage by adding more sendtodestination calls with bech32 and bech32m testnet addresses, then test the bech32 and bech32m derivation subsets UTXO amount in [Test extended key derivation](https://github.com/bitcoin/bitcoin/blob/e695d8536e534f1e59de4a62a0d87a93e7a73456/test/functional/rpc_scantxoutset.py#L84). I will add the test coverage in a subsequent Pull request. ACKs for top commit: josibake: ACK https://github.com/bitcoin/bitcoin/pull/27269/commits/d178082996dc3000f42816f89afcf3fa4d31e159 theStack: ACK d178082996dc3000f42816f89afcf3fa4d31e159 ✔️ willcl-ark: ACK d17808299 Tree-SHA512: 312c20ce192c648faf7dd178622700c9b871d755db56c246250e25508c3c19e7b02c0ae901dda11a1794629b9a9429c877168c05e1c4c1dbf41493316e30e7e9
2023-03-23test: add bech32 decoding support to address_to_scriptpubkey()ismaelsadeeq
This permits functional tests to decode bech32 addresses to scriptpubkeys.
2023-03-23test: test_bech32_decode in address.pyismaelsadeeq
Adds bech32_to_bytes() which can decode a bech32 address and return the version as an `int` and the payload in bytes. bech32_to_bytes() is used by the test_bech32_decode unit test to test decoding of segwit addresses.
2023-03-20test: Fix TypeError in wait_for_debug_logMarcoFalke
Traceback: print_log = " - " + "\n - ".join(log.splitlines()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: sequence item 0: expected str instance, bytes found
2023-03-16Merge bitcoin/bitcoin#27200: test: psbt: check non-witness UTXO removal for ↵Andrew Chow
segwit v1 input 3dd2f6461b4bb28b2b212c691a3df28ac793ad91 test: psbt: check non-witness UTXO removal for segwit v1 input (Sebastian Falbesoner) dd78e3fa439d57e148a2a5e312021da962c4a394 test: speedup rpc_psbt.py by whitelisting peers (immediate tx relay) (Sebastian Falbesoner) e194e3e93dd0665181bafeb162bf4c9f3621d6f1 test: PSBT: eliminate magic numbers for global unsigned tx key (0) (Sebastian Falbesoner) Pull request description: This PR adds missing test coverage for dropping non-witness UTXOs from PSBTs for segwit v1+ inputs (see commit 103c6fd2791f7e73eeab7f3900fbedd5b550211d). The formerly [disabled](https://github.com/bitcoin/bitcoin/commit/46004790588c24174a0bec49b540d158ce163ffd) method `test_utxo_conversion` is re-enabled and adapted to spend a Taproot (`bech32m`) instead of a wrapped SegWit (`p2sh-segwit`) output. Note that in contrast to the original test, we have to add the non-witness UTXO manually here using the test framework's PSBT module, since the constructing node knows that the output is segwit v1 and hence doesn't add the non-witness UTXO in the first place (see also [BIP371]( https://github.com/bitcoin/bips/blob/master/bip-0371.mediawiki#user-content-UTXO_Types)). I strongly assume that most wallets would behave the same as Bitcoin Core here and wouldn't create PSBTs with non-witness UTXOs for Taproot inputs, but it's still good to test everything works as expected if it's still done and that the non-witness UTXO is simply dropped in that case. The first two commits contain a small refactor (magic number elimination in PSBT module) and test speedup of ~2-3x (using whitelisting peers / immediate tx relay). ACKs for top commit: achow101: ACK 3dd2f6461b4bb28b2b212c691a3df28ac793ad91 instagibbs: ACK 3dd2f6461b4bb28b2b212c691a3df28ac793ad91 Tree-SHA512: b8d7f7ea5d7d21def024b70dfca61991cc96a4193be8857018b4d7cf3ca1465d185619fd4a77623803d9da309aa489c53273e9b7683d970ce12e2399b5b50031
2023-03-13Merge bitcoin/bitcoin#27221: test: Default timeout factor to 4 under --valgrindfanquake
fa27cf4cc7c24aa00a66dffabab849d4b3cb1c41 test: Default timeout factor to 4 under --valgrind (MarcoFalke) Pull request description: valgrind will incur a slowdown of at least 2, so increase the default timeout factor. This should reduce the number of reported issues. See also https://github.com/bitcoin/bitcoin/issues/27112#issuecomment-1455762739 ACKs for top commit: fanquake: ACK fa27cf4cc7c24aa00a66dffabab849d4b3cb1c41 - I still see at least one actual issue when running the functional tests under `--valgrind` (outside the CI system), but will follow up separately with that. Increasing the timeout here seems fine. Tree-SHA512: 4467559a3bfd98f5735f300f6ed54c68f951191d65a2b1294d71d72cc5d0864964de562d5dfa0a4855fc541ccb269a538b7aeb3d408d2d012a5369513397c395
2023-03-08test: Use self.wait_until over wait_until_helperMarcoFalke
2023-03-07test: Default timeout factor to 4 under --valgrindMarcoFalke
2023-03-04test: PSBT: eliminate magic numbers for global unsigned tx key (0)Sebastian Falbesoner
2023-02-22Merge bitcoin/bitcoin#27137: test: Raise PRNG seed log to INFOfanquake
4d84eaec82e7b5a450d47cd30e5936a717035f77 Raise PRNG seed log to INFO. (roconnor-blockstream) Pull request description: Some build infrastructure, such as Nix, will delete failed builds by default, keeping only the log (stdout/stderr) of the failed build. For flaky tests, it would be very helpful to have the PRNG seed in the default log in order to redo the failed test. By simply raising the PRNG seed logging to INFO, we can, by default, record the seed in the log of every build. ACKs for top commit: MarcoFalke: lgtm ACK 4d84eaec82e7b5a450d47cd30e5936a717035f77 theStack: ACK 4d84eaec82e7b5a450d47cd30e5936a717035f77 Tree-SHA512: 3ccb4a4e7639a3babc3b2a6456a6d0bffc090da34e4545b317f7bfbed4e9950d1b38ea5b2a90c37ccb49b3454bdeff03a6aaf86770b9c4dd14b26320aba50b94
2023-02-22Merge bitcoin/bitcoin#25867: lint: enable E722 do not use bare exceptfanquake
61bb4e783b3acc62b121a228f6b14c2462e23315 lint: enable E722 do not use bare except (Leonardo Lazzaro) Pull request description: Improve test code and enable E722 lint check. If you want to catch all exceptions that signal program errors, use except Exception: (bare except is equivalent to except BaseException:). Reference: https://peps.python.org/pep-0008/#programming-recommendations ACKs for top commit: MarcoFalke: lgtm ACK 61bb4e783b3acc62b121a228f6b14c2462e23315 Tree-SHA512: c7497769d5745fa02c78a20f4a0e555d8d3996d64af6faf1ce28e22ac1d8be415b98e967294679007b7bda2a9fd04031a9d140b24201e00257ceadeb5c5d7665
2023-02-21Raise PRNG seed log to INFO.roconnor-blockstream
Some build infrastructure, such as Nix, will delete failed builds by default, keeping only the log of the failed build. For flaky tests, it would be very helpful to have the PRNG seed in the default log in order to redo the failed test. By simply raising the PRNG seed logging to INFO, we can, by default, record the seed in the log of every build.
2023-02-20Merge bitcoin/bitcoin#25950: test: fix test abort for high timeout values ↵fanquake
(and `--timeout-factor 0`) 14302a4802e2dbb41f5189de88f99ddd5dda7736 test: fix test abort for high timeout values (and `--timeout-factor 0`) (Sebastian Falbesoner) Pull request description: On master, the functional tests's option `--timeout-factor 0` (which according to the test docs and parameter description should disable the RPC timeouts) currently fails, same as high values like `--timeout-factor 999999`: ``` $ ./test/functional/wallet_basic.py --timeout-factor 0 2022-08-29T01:26:39.561000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_f24yxzp5 2022-08-29T01:26:40.262000Z TestFramework (ERROR): Assertion failed Traceback (most recent call last): File "/home/honey/bitcoin/test/functional/test_framework/test_framework.py", line 549, in start_nodes node.wait_for_rpc_connection() File "/home/honey/bitcoin/test/functional/test_framework/test_node.py", line 234, in wait_for_rpc_connection rpc.getblockcount() File "/home/honey/bitcoin/test/functional/test_framework/coverage.py", line 49, in __call__ return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs) File "/home/honey/bitcoin/test/functional/test_framework/authproxy.py", line 142, in __call__ response, status = self._request('POST', self.__url.path, postdata.encode('utf-8')) File "/home/honey/bitcoin/test/functional/test_framework/authproxy.py", line 107, in _request self.__conn.request(method, path, postdata, headers) File "/usr/local/lib/python3.9/http/client.py", line 1285, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output self.send(msg) File "/usr/local/lib/python3.9/http/client.py", line 980, in send self.connect() File "/usr/local/lib/python3.9/http/client.py", line 946, in connect self.sock = self._create_connection( File "/usr/local/lib/python3.9/socket.py", line 844, in create_connection raise err File "/usr/local/lib/python3.9/socket.py", line 832, in create_connection sock.connect(sa) OSError: [Errno 22] Invalid argument ``` This is caused by a high timeout value that Python's HTTP(S) client library can't cope with. Fix this by clamping down the connection's set timeout value in AuthProxy. The change can easily be tested by running an arbitrary test with `--timeout-factor 0` on master (should fail), on this PR (should pass) and on this PR with the clamping value increased by 1 (should fail). // EDIT: The behaviour was observed on OpenBSD 7.1 and Python 3.9.12. ACKs for top commit: MarcoFalke: lgtm ACK 14302a4802e2dbb41f5189de88f99ddd5dda7736 Tree-SHA512: 6469e8ac699f1bb7dea11d5fb8b3ae54d895bb908570587c5631144cd41fe980ca0b1e6d0b7bfa07983307cba15fb26ae92e6766375672bf5be838d8e5422dbc
2023-02-18lint: enable E722 do not use bare exceptLeonardo Lazzaro
2023-02-17test: fix test abort for high timeout values (and `--timeout-factor 0`)Sebastian Falbesoner
2023-02-06test: Add test for file system permissionsHennadii Stepanov
2023-01-28test: refactor: introduce `replace_in_config` helperSebastian Falbesoner
2023-01-18scripted-diff: Use new python 3.7 keywordsMarcoFalke
-BEGIN VERIFY SCRIPT- sed -i 's/universal_newlines/text/g' $(git grep -l universal_newlines) -END VERIFY SCRIPT-
2023-01-17test: Run mempool_packages.py with MiniWalletMarcoFalke
2023-01-17test: Return fee from MiniWalletMarcoFalke
2023-01-17test: Return chain of MiniWallet txs from MiniWallet chain methodMarcoFalke
2023-01-17test: Refactor MiniWallet sign_txMarcoFalke
To make the code less verbose and easier to read.
2023-01-17test: Return wtxid from create_self_transfer_multiMarcoFalke
This is not used right now, but may be in the future. Also, it simplifies the create_self_transfer return logic
2023-01-16test: add `rescan_utxos` in MiniWallet's initializationkouloumos
this simplifies usage when MiniWallet is used with a pre-mined chain.
2023-01-16Merge bitcoin/bitcoin#26657: test: Run feature_bip68_sequence.py with MiniWalletMarcoFalke
4159ccd03142899028019a7cb44ee4120e68505a test: Run feature_bip68_sequence.py with MiniWallet (Miles Liu) fc0caaf4aa3d4b26a8673cca48df1a4f0b964a59 test: Add "include mempool" flag to MiniWallet rescan_utxos (Miles Liu) d0a909ae54a34ecd925c9d5064d530eaeeba46eb test: Add "include immature coinbase" flag to MiniWallet get_utxos (Miles Liu) e5b9127d9e9d25bf8825b671ddb97529e877f593 test: Add signs P2TR and RAWSCRIPT to MiniWallet sign_tx (Miles Liu) Pull request description: This PR enables one more of the non-wallet functional tests (feature_bip68_sequence.py) to be run even when no wallet is compiled in by using the MiniWallet instead, as proposed in #20078. ACKs for top commit: achow101: ACK 4159ccd03142899028019a7cb44ee4120e68505a MarcoFalke: review ACK 4159ccd03142899028019a7cb44ee4120e68505a 🤸 Tree-SHA512: e891b189381e961c840b45fc30d058363707fd54c1c4bdc3d29623b03309981f1d3ebfac27e6aecf621bdbcd7e31754a3ef7c53f86346f7dd241c137e64c92bd
2023-01-16Merge bitcoin/bitcoin#26631: test: add coverage for dust mempool policy ↵MarcoFalke
(`-dustrelayfee` setting) d6fc1d6a3393c571a1691a6bda60433216643616 test: add coverage for dust mempool policy (`-dustrelayfee` setting) (Sebastian Falbesoner) 8a5dbe28793d2e2ad85242f2191a6e1956b980dc test: add `CScript` method for checking for witness program (Sebastian Falbesoner) Pull request description: This PR adds missing test coverage for the `-dustrelayfee` setting, which specifies the fee-rate used to define dust. Output scripts for all common types that are treated as standard by default (P2PK, P2(W)PKH, P2(W)SH, P2TR, bare multisig, null data, unknown witness versions v2+) are created and then checked for dust-mempool-policy each via the `testmempoolaccept` RPC: a tx with an output's nValue equal to the dust threshold should be accepted, one with an nValue of just one 1 satoshi below that should be rejected with reason `dust`. This is repeatedly done for a fixed (but obviously somewhat arbitrary) list of different `-dustrelayfee` settings on a single node, including the default and zero (i.e. no dust limit) settings. Note that the first commit introduces a necessary `CScript` helper method `IsWitnessProgram` (using PascalCase in Python is likely controversial; in this case the style for the already existing method `GetSigOpCount` was followed, which also refers to a method in the core `CScript` class). Some historical information about dust, contributed by pablomartin4btc: "The concept of dust was first introduced in https://github.com/bitcoin/bitcoin/pull/2577. This [commit](https://github.com/bitcoin/bitcoin/pull/9380/commits/eb30d1a5b215c6dd3763d7f7948f2dd8cb61f6bf) from https://github.com/bitcoin/bitcoin/pull/9380 introduced the -dustrelayfee option. Previous to that PR, the dust feerate was whatever -minrelaytxfee was set to." ACKs for top commit: LarryRuane: ACK d6fc1d6a3393c571a1691a6bda60433216643616 glozow: ACK d6fc1d6a3393c571a1691a6bda60433216643616 kouloumos: ACK d6fc1d6a3393c571a1691a6bda60433216643616 Tree-SHA512: 35ea2b2497dfb466395af5665bb217f7250aa7cab9dc43539a5658ab69a454e3623ff58fce7489fcc1105b37f8cb4840a93cec658c5df1de611732bc6439ccad
2023-01-12test: skip sqlite3 tests if it isn't availablefanquake
Fixes #26819. Related too #26873.
2023-01-11test: Fix intermittent timeout in p2p_permissions.pyMarcoFalke
2023-01-06test: Add "include mempool" flag to MiniWallet rescan_utxosMiles Liu
2023-01-06test: Add "include immature coinbase" flag to MiniWallet get_utxosMiles Liu
2023-01-06test: Add signs P2TR and RAWSCRIPT to MiniWallet sign_txMiles Liu
2023-01-03script, test: fix python linter E275 errors with flake8 5.0.4Jon Atack
2022-12-24scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: - 2021: f47dda2c58b5d8d623e0e7ff4e74bc352dfa83d7 - 2020: fa0074e2d82928016a43ca408717154a1c70a4db - 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2022-12-21Merge bitcoin/bitcoin#26265: POLICY: Relax MIN_STANDARD_TX_NONWITNESS_SIZE ↵Andrew Chow
to 65 non-witness bytes b2aa9e85289fc654106a890c35935e9c76c411fb Add release note for MIN_STANDARD_TX_NONWITNESS_SIZE relaxation (Greg Sanders) 8c5b3646b5afe8a61f5c66478d8e11f0d2ce5108 Relax MIN_STANDARD_TX_NONWITNESS_SIZE to 65 non-witness bytes (Greg Sanders) Pull request description: Since the original fix was set to be a "reasonable" transaction to reduce allocations and the true motivation later revealed, it makes sense to relax this check to something more principled. There are more exotic transaction patterns that could take advantage of a relaxed requirement, such as 1 input, 1 output OP_RETURN to burn a utxo to fees for CPFP purposes when change isn't practical. Two changes could be accomplished: 1) Anything not 64 bytes could be allowed 2) Anything above 64 bytes could be allowed In the Great Consensus Cleanup, suggestion (2) was proposed as a consensus change, and is the simpler of the two suggestions. It would not allow an "empty" OP_RETURN but would reduce the required padding from 22 bytes to 5. The functional test is also modified to test the actual case we care about: 64 bytes Related mailing list discussions here: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-October/020995.html And a couple years earlier: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-May/017883.html ACKs for top commit: achow101: reACK b2aa9e85289fc654106a890c35935e9c76c411fb glozow: reACK b2aa9e85289fc654106a890c35935e9c76c411fb pablomartin4btc: re-ACK https://github.com/bitcoin/bitcoin/commit/b2aa9e85289fc654106a890c35935e9c76c411fb jonatack: ACK b2aa9e85289fc654106a890c35935e9c76c411fb with some suggestions Tree-SHA512: c1ec1af9ddcf31b2272209a4f1ee0c5607399f8172e5a1dfd4604cf98bfb933810dd9369a5917ad122add003327c9fcf6ee26995de3aca41d5c42dba527991ad
2022-12-20Merge bitcoin/bitcoin#26638: test: prefer sqlite for wallet testsAndrew Chow
17554efb6095f6ec273e52568efe1678253cb7c0 test: prefer sqlite for wallet tests (S3RK) 8e0fabaabf8f45b82256c1934c2507d03351acaa test: make wallet_migration.py pass with both wallet flags (S3RK) Pull request description: Fixes #26511 ACKs for top commit: MarcoFalke: review ACK 17554efb6095f6ec273e52568efe1678253cb7c0 achow101: ACK 17554efb6095f6ec273e52568efe1678253cb7c0 Tree-SHA512: 97cae275998f07032feffe1b533d4747b8ff03c3c1fb830af69ee38cadb75fd58532956f66f79c0d275b00620ce53b0b5240f885e4f29b8bd4d0b6e6cbc683fa
2022-12-19Relax MIN_STANDARD_TX_NONWITNESS_SIZE to 65 non-witness bytesGreg Sanders
Since the original fix was set to be a "reasonable" transaction to reduce allocations and the true motivation later revealed, it makes sense to relax this check to something more principled. There are more exotic transaction patterns that could take advantage of a relaxed requirement, such as 1 input, 1 output OP_RETURN to burn a utxo to fees for CPFP purposes when change isn't practical. Two changes could be accomplished: 1) Anything not 64 bytes could be allowed 2) Anything above 64 bytes could be allowed In the Great Consensus Cleanup, suggestion (2) was the route taken. It would not allow an "empty" OP_RETURN but would reduce the required padding from 22 bytes to 5. The functional test is also modified to test the actual case we care about: 64 bytes
2022-12-19Merge bitcoin/bitcoin#26656: tests: Improve runtime of some tests when ↵MarcoFalke
`--enable-debug` 1647a11f39cfa2c2847c52100bb69cfdfc63723f tests: Reorder longer running tests in test_runner (Andrew Chow) ff6c9fe02743c9628e49a504b6b879d687c7390f tests: Whitelist test p2p connection in rpc_packages (Andrew Chow) 8c20796aacbbf5261e1922d45fc8afe75f54fefb tests: Use waitfornewblock for work queue test in interface_rpc (Andrew Chow) 6c872d5e656a7117bbdf19a0220572b93de16f31 tests: Initialize sigops draining script with bytes in feature_taproot (Andrew Chow) 544cbf776cf25d90ea4b96d92e7ee6e316576038 tests: Use batched RPC in feature_fee_estimation (Andrew Chow) 4ad7272f8b24843582e05e7dfc15f1e058e1a0f3 tests: reduce number of generated blocks for wallet_import_rescan (Andrew Chow) Pull request description: When configured with `--enable-debug`, many tests become dramatically slower. These slow downs are particularly noticed in tests that generate a lot of blocks in separate calls, make a lot of RPC calls, or send a lot of data from the test framework's P2P connection. This PR aims to improve the runtime of some of the slower tests and improve the overall runtime of the test runner. This has improved the runtime of the test runner from ~400s to ~140s on my computer. The slowest test by far was `wallet_import_rescan.py`. This was taking ~320s. Most of that time was spent waiting for blocks to be mined and then synced to the other nodes. It was generating a new block for every new transaction it was creating in a setup loop. However it is not necessary to have one tx per block. By mining a block only every 10 txs, the runtime is improved to ~61s. The second slowest test was `feature_fee_estimation.py`. This test spends most of its time waiting for RPCs to respond. I was able to improve its runtime by batching RPC requests. This has improved the runtime from ~201s to ~140s. In `feature_taproot.py`, the test was constructing a Python `CScript` using a very large list of `OP_CHECKSIG`s. The constructor for the Python implementation of `CScript` was iterating this list in order to create a `bytes` from it even though a `bytes` could be created from it without iterating. By making the `bytes` before passing it into the constructor, we are able to improve this test's runtime from ~131s to ~106s. Although `interface_rpc.py` was not typically a slow test, I found that it would occasionally have a super long runtime. It typically takes ~7s, but I have observed it taking >400s to run on occasion. This longer runtime occurs more often when `--enable-debug`. This long runtime was caused by the "exceeding work queue" test which is really just trying to trigger a race condition. In this test, it would create a few threads and try an RPC in a loop in the hopes that eventually one of the RPCs would be added to the work queue while another was processing. It used `getrpcinfo` for this, but this function is fairly fast. I believe what was happening was that with `--enable-debug`, all of the code for receiving the RPC would often take longer to run than the RPC itself, so the majority of the requests would succeed, until we got lucky after 10's of thousands of requests. By changing this to use a slow RPC, the race condition can be triggered more reliably, and much sooner as well. I've used `waitfornewblock` with a 500ms timeout. This improves the runtime to ~3s consistently. The last test I've changed was `rpc_packages.py`. This test was one of the higher runtime variability tests. The main source of this variation appears to be waiting for the test node to relay a transaction to the test framework's P2P connection. By whitelisting that peer, the variability is reduced to nearly 0. Lastly, I've reordered the tests in `test_runner.py` to account for the slower runtimes when configured with `--enable-debug`. Some of the slow tests I've looked at were listed as being fast which was causing overall `test_runner.py` runtime to be extended. This change makes the test runner's runtime be bounded by the slowest test (currently `feature_fee_estimation.py` with my usual config (`-j 60`). ACKs for top commit: willcl-ark: ACK 1647a11 Tree-SHA512: 529e0da4bc51f12c78a40d6d70b3a492b97723c96a3526148c46943d923c118737b32d2aec23d246392e50ab48013891ef19fe6205bf538b61b70d4f16a203eb
2022-12-16Merge bitcoin/bitcoin#24865: rpc: Enable wallet import on pruned nodes and ↵Andrew Chow
add test 564b580bf07742483a140c7c095b896a6d5d6cad test: Introduce MIN_BLOCKS_TO_KEEP constant (Aurèle Oulès) 71d9a7c03b44236c2fea2b74f92a69234d29f717 test: Wallet imports on pruned nodes (Aurèle Oulès) e6906fcf9e4d5692ead6c9bf5a2e11673315a1f5 rpc: Enable wallet import on pruned nodes (Aurèle Oulès) Pull request description: Reopens #16037 I have rebased the PR, addressed the comments of the original PR and added a functional test. > Before this change importwallet fails if any block is pruned. This PR makes it possible to importwallet if all required blocks aren't pruned. This is possible because the dump format includes key timestamps. For reviewers: `python test/functional/wallet_pruning.py --nocleanup` will generate a large blockchain (~700MB) that can be used to manually test wallet imports on a pruned node. Node0 is not pruned, while node1 is. ACKs for top commit: kouloumos: ACK 564b580bf07742483a140c7c095b896a6d5d6cad achow101: reACK 564b580bf07742483a140c7c095b896a6d5d6cad furszy: ACK 564b580 w0xlt: ACK https://github.com/bitcoin/bitcoin/pull/24865/commits/564b580bf07742483a140c7c095b896a6d5d6cad Tree-SHA512: b345a6c455fcb6581cdaa5f7a55d79e763a55cb08c81d66be5b12794985d79cd51b9b39bdcd0f7ba0a2a2643e9b2ddc49310ff03d16b430df2f74e990800eabf
2022-12-15test: Introduce MIN_BLOCKS_TO_KEEP constantAurèle Oulès
2022-12-15test: Wallet imports on pruned nodesAurèle Oulès
Co-authored-by: Ryan Ofsky <ryan@ofsky.org> Co-authored-by: Andreas Kouloumos <kouloumosa@gmail.com>
2022-12-12test: add add_wallet_options to TestShelljosibake
without this, testShell runs with -disablewallet
2022-12-09tests: Use batched RPC in feature_fee_estimationAndrew Chow
feature_fee_estimation has a lot of loops that hit the RPC many times in succession in order to setup scenarios. Using batched requests for these can reduce the test's runtime without effecting the test's behavior.
2022-12-09test: Move feature_backwards_compatibility.py to ↵MarcoFalke
wallet_backwards_compatibility.py
2022-12-06test: prefer sqlite for wallet testsS3RK
2022-12-05Merge bitcoin/bitcoin#26414: test: Move tx creation to ↵MarcoFalke
create_self_transfer_multi 0b78110f73965fd827748107e0f3497d3352be71 test: Move tx creation to create_self_transfer_multi (kouloumos) Pull request description: Two birds with one stone: replacement of https://github.com/bitcoin/bitcoin/pull/26278 with simplification of the MiniWallet's transaction creation logic. Currently the MiniWallet creates simple txns (1 input, 1 output) with `create_self_transfer`. https://github.com/bitcoin/bitcoin/pull/24637 introduced `create_self_transfer_multi` **which uses** `create_self_transfer` to create a "transaction template" which then adjusts (copy and mutate inputs and outputs) in order to create more complex multi-input multi-output transactions. This can more easily lead to issues such as https://github.com/bitcoin/bitcoin/pull/26278 and is more of a maintenance burden. This PR simplifies the logic by going the other way around. Now `create_self_transfer` **uses** `create_self_transfer_multi`. The transaction creation logic has been moved to `create_self_transfer_multi` which is being called by `create_self_transfer` to construct the simple case of 1 input 1 output transaction. ACKs for top commit: MarcoFalke: ACK 0b78110f73965fd827748107e0f3497d3352be71 👒 Tree-SHA512: 147e577ed5444bee57865bd375b37c9b49d6539e9875c30c2667e70fcba27fe80bcb4552a4e6efb42760d34b40d5dad826883b778eaeefe29425ec081787b4bd
2022-12-04test: add `CScript` method for checking for witness programSebastian Falbesoner
This is needed in the next commit to calculate the dust threshold for a given output script and min feerate for defining dust.