Commit graph

7119 commits

Author SHA1 Message Date
MarcoFalke
fa6a007b8e
fuzz: Avoid integer sanitizer warnings in policy_estimator target 2025-03-27 11:54:39 +01:00
merge-script
b131e1bfc0
Merge bitcoin/bitcoin#32101: Accept unordered tracepoints in interface_usdt_utxocache.py
248fdd88dc test: accept unordered tracepoints in... (willcl-ark)

Pull request description:

  We have encountered an instance where the tracepoints were not collected in the same order they were fired (#31951).

  Tracepoint ordering is not guaranteed in userspace for a number of reasons.

  As this test does not require a strict collection/processing order collect `expected` and `actual` events into dicts and compare them.

  This will gracefully handle both the number of events, and out-of-order events should they reoccur in the future.

  Fixes: #31951

ACKs for top commit:
  0xB10C:
    re-ACK 248fdd88dc
  laanwj:
    Code review ACK 248fdd88dc

Tree-SHA512: 78d1aa936194d386d919ed26133aac3af5fc6d3d0b1fe1e767288d9e6226e2c701d640e71e994a63ccd48344bd2a0db508cb353cdd5ce1f644cd6f7313654623
2025-03-27 15:50:57 +08:00
merge-script
5dd6ebc7e1
Merge bitcoin/bitcoin#32148: test: fix intermittent timeout in p2p_ibd_stalling.py
9f35d4d070 test: fix intermittent timeout in p2p_ibd_stalling.py (Martin Zumsande)

Pull request description:

  After sending the headers message add a sync, so that we wait until the header message from the previous peer has been received before connecting additional peers.
  In the failed NetBSD run linked in #32090, the second node managed to complete the handshake and send its own headers message before the message from the first node was received.

  Fixes #32090

ACKs for top commit:
  maflcko:
    lgtm ACK 9f35d4d070

Tree-SHA512: 30a98c6ec04f819c892ab5ce76a309df81b3a4644be021f938eefddbd00ec4141e055c3cf735c9e04ce2fe9e950470a99d54cb6be43230110348a802a6a6c252
2025-03-27 15:42:18 +08:00
Martin Zumsande
9f35d4d070 test: fix intermittent timeout in p2p_ibd_stalling.py
by adding a sync, so that we wait until the header message from the
previous peer has been received before connecting additional peers.
2025-03-26 13:22:07 -04:00
Chandra Pratap
d065208f0f test: get rid of redundant TODO tag
The 'FEE' parameter in test/functional/feature_dbcrash.py::
generate_small_transaction() is not a fee rate, but an
absolute fee. Hence, it doesn't make sense to replace it
with node relay based fee calculation. Get rid of the TODO
comment suggesting otherwise.
2025-03-26 16:44:48 +00:00
willcl-ark
248fdd88dc
test: accept unordered tracepoints in...
...interface_usdt_utxocache.py

We have encountered an instance where the tracepoints were not collected
in the same order they were fired (#31951).

Tracepoint ordering is not guaranteed in userspace for a number of
reasons.

As this test does not require a strict collection/processing order
collect `expected` and `actual` events into dicts and compare them.

This will gracefully handle both the number of events, and out-of-order
events should they reoccur in the future.
2025-03-26 14:13:09 +00:00
TheCharlatan
ca55613fd1
test: Add functional test for bitcoin-chainstate
Adds basic coverage for successfully validating a mainnet block as well
as some duplicate and invalid data.
2025-03-26 15:05:17 +01:00
Sjors Provoost
d424bd5941
test: drop unused testnet3 magic bytes 2025-03-26 12:29:04 +01:00
Sjors Provoost
8cfc09fafe
test: cover testnet4 magic in assumeutxo.py
Replace testnet3 and use MAGIC_BYTES constants.
2025-03-26 12:29:04 +01:00
TheCharlatan
3f9c716e7f
test: Fix docstring for cmake migration 2025-03-26 10:57:23 +01:00
Hodlinator
35d17cd5ee
qa wallet: Actually make use of expressions
They were basically no-ops.
2025-03-26 09:47:38 +01:00
dennsikl
e3ce2bd982 Remove needless borrow to fix Clippy warning 2025-03-26 09:07:11 +02:00
merge-script
dfb7d58108
Merge bitcoin/bitcoin#31897: mining: drop unused -nFees and sigops from CBlockTemplate
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
226d81f8b7 mining: drop unused -nFees and sigops from CBlockTemplate (Sjors Provoost)
53ad845fb9 test: check fees and sigops in getblocktemplate (Sjors Provoost)

Pull request description:

  For the coinbase `vTxFees` used a dummy value of -nFees.

  Similarly the first `vTxSigOpsCost` entry was calculated from
  the dummy coinbase transaction.

  This was introduced in #2115, but the values were never returned by the RPC or used in a test.

  Drop 'm and add code comments to prevent confusion.

  This PR also adds test coverage for the `fees` and `sigops` fields in `getblocktemplate`, so it closes #32053.

ACKs for top commit:
  ismaelsadeeq:
    re-ACK 226d81f8b7
  ryanofsky:
    Code review ACK 226d81f8b7. New test was added since last review, which seems very cleanly written and fixes some missing coverage.
  glozow:
    ACK 226d81f8b7

Tree-SHA512: 79c534e6bc4810d29114b04dd6db798877732cb473e773bf3cc28f83d14ee3982392587bd0baa39857bd53a79eae3b730d7a7029b08a9b6c3b5c51f86657ca5d
2025-03-25 08:41:59 -04:00
naiyoma
535b874707 test: Combine rpcwhitelistdefault functions
Replace test_rpcwhitelistdefault_0_no_permissions and
test_rpcwhitelistdefault_1_no_permissions with a single
test_rpcwhitelistdefault_permissions function.
2025-03-25 12:50:23 +03:00
naiyoma
2b6ce9254d test: Update permissions and string formatting
Update get_permissions function to remove unnecessary replace() and
improve password for strangedude6. Change all string concatenation to f-strings.
2025-03-25 12:37:30 +03:00
Ryan Ofsky
5f3848c63b
Merge bitcoin/bitcoin#31278: wallet, rpc: deprecate settxfee and paytxfee
2f2ab47bf7 Release notes (Pol Espinasa)
bf194c920c wallet, rpc: deprecate settxfee and paytxfee (Pol Espinasa)

Pull request description:

  **Summary**

  This PR deprecates the settxfee RPC and paytxfee setting, marking it for removal in Bitcoin Core 31.0.

  **Motivation**

  The PR was initially motivated by https://github.com/bitcoin/bitcoin/issues/31088. The intention was to create a new function `settxfeerate` to allow users to set a static fee rate in `sat/vB` instead of `btc/kvB`.

  The `settxfee` RPC allows users to set a static fee rate for all transactions created by the wallet. However, in a dynamic fee environment, this can lead to poor fee choices, either overpaying when the mempool is empty or underpaying when congestion is high. The preferred approach is to rely on fee estimation, which is designed to adapt to network conditions, and is the one by default. Same argument apply for `paytxfee` setting.

  During discussion the consensus was that static fee settings are a footgun and that users should instead specify the fee rate per transaction if they don't want to rely on the fee estimation. Given this, rather than introducing a `settxfeerate` alternative, this PR goes towards removing `settxfee` and `paytxfee` entirely.

  **Key Changes**

  `settxfee` and `paytxfee` is now deprecated and will be removed in Bitcoin Core 31.0.
  Users should rely on fee estimation or explicitly specify a fee rate when constructing transactions.

  **Impact on Users**

  If users currently use settxfee or paytxfee, they should transition to specifying fees per transaction.
  No immediate breakage in 30.0 (must use `-deprecatedrpc=settxfee`), but `settxfee` and `paytxfee` will be removed in 31.0.

  **Alternative Approaches Considered**

  A settxfeerate alternative (using sat/vB) was initially proposed but ultimately rejected in favor of deprecating static fee setting entirely.

  **Notes for removal**
  - When removing paytxfee we should also update txconfirmtarget startup option help text.
  - Get back the comment from `rpc_deprecated.py` test. [+info](https://github.com/bitcoin/bitcoin/pull/31278#discussion_r1998876768)

ACKs for top commit:
  fjahr:
    re-ACK 2f2ab47bf7
  ismaelsadeeq:
    re-ACK 2f2ab47bf7
  rkrux:
    Concept and utACK 2f2ab47bf7

Tree-SHA512: 0272812cbe5a519737c5d0683acc2072e67559792b4a6472bca8b23426e5ce9e88a3a1eba987feda70a082b8b474b3126893848628d7bf11e1520357b18c8d3e
2025-03-24 13:40:31 -04:00
merge-script
85feb094d4
Merge bitcoin/bitcoin#32092: test: Fix intermittent issue in p2p_orphan_handling.py
fa310cc6f4 test: Fix intermittent issue in p2p_orphan_handling.py (MarcoFalke)

Pull request description:

  The test may fail intermittently when the `net` thread is lagging while calling `DeleteNode`. This may result in a split `getdata`, meaning that `peer2.wait_for_parent_requests([int(parent_peekaboo_AB["txid"], 16), int(parent_missing["txid"], 16)])` fails.

  Fix it by adding a sync on the `net` thread.

  Fixes #31700

ACKs for top commit:
  mzumsande:
    Code Review ACK fa310cc6f4

Tree-SHA512: e4a58093ab5b9e280c479b845fecb5d228e65519ea3dc2111b393202225fd0feded423e8812452454b6b9348cb37a9c1b01b9d1b1802e9f4aa76b9e56b4b54ef
2025-03-21 13:46:11 +08:00
Ryan Ofsky
998386d446
Merge bitcoin/bitcoin#31866: test, refactor: Add TestNode.binaries to hold binary paths
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
d190f0facc test, contrib: Fix signer/miner command line escaping (Ryan Ofsky)
0d2eefca8b test, refactor: Add TestNode.binaries to hold binary paths (Ryan Ofsky)

Pull request description:

  Add new `TestNode.binaries` object to manage paths to bitcoin binaries.

  The `binaries` object makes it possible for the test framework to exercise the bitcoin wrapper executable introduced in https://github.com/bitcoin/bitcoin/pull/31375 and also makes it easier in general to add new binaries, and new options and environment variables controlling how they are invoked, because logic for invoking them that was previously spread out is now consolidated in one place.

  These changes were originally part of #31375 but made that PR harder to review because they were unrelated to the other changes there. If this PR can get merged first, python changes in #31375 will be simple, and the test framework changes here should also get a higher quality review.

ACKs for top commit:
  maflcko:
    re-review-ACK d190f0facc 🍓
  Sjors:
    ACK d190f0facc
  vasild:
    ACK d190f0facc

Tree-SHA512: 5a6c0553cd2822585810d827ef1c1772cbf3097d3336daf733f8378dd3da79c00fc3721e50ed0f7455908fbd7a509e9739f9be33f588d6bc1aaa400b9d75c650
2025-03-20 09:06:19 -04:00
merge-script
780bcf80b5
Merge bitcoin/bitcoin#32091: test: replace assert with assert_equal and assert_greater_than
387385ba1e test: replace assert with assert_equal and assert_greater_than (Chandra Pratap)

Pull request description:

  In `test/functional/interface_usdt_net.py`, `assert_equal` is already used to check for equality between objects. Replace `assert.*==` with `assert_equal` and `assert.*>` with `assert_greater_than` to further easify debugging.

  Relevant issue: #23119

ACKs for top commit:
  maflcko:
    lgtm ACK 387385ba1e
  0xB10C:
    had a quick look, lgtm ACK 387385ba1e
  theStack:
    utACK 387385ba1e
  brunoerg:
    code review ACK 387385ba1e
  i-am-yuvi:
    Great! ACK 387385ba1e

Tree-SHA512: 741a3d98288c9999f62bcbaa3806716b0519ec9b521e1e6e17aa458392245f6eff886af6cb601c66f2147e0265ff1eae57cea3dcfd67af93bef6dff25b056935
2025-03-20 12:59:35 +08:00
MarcoFalke
fa310cc6f4
test: Fix intermittent issue in p2p_orphan_handling.py 2025-03-19 20:21:14 +01:00
merge-script
e568c1dd13
Merge bitcoin/bitcoin#32088: test: switch wallet_crosschain.py to signet and drop testnet4
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
cec14ee47d test: switch wallet_crosschain.py to signet (Sjors Provoost)
9c2951541c test: drop testnet4 from wallet_crosschain.py (Sjors Provoost)

Pull request description:

  It's sufficient to check only one test network, so this PR reverts the addition of testnet4 from #29775.

  Testnet3 is deprecated. Instead of moving to testnet4, which might also be deprecated in the future, use signet.

ACKs for top commit:
  fjahr:
    utACK cec14ee47d
  maflcko:
    lgtm ACK cec14ee47d 🌰

Tree-SHA512: c5aad6e7d251957f090145eac906f7985fddc3e3ba82df7184d72b961f9c856d324a1065ac98323b75501d136bd7b669fcc2565b9e66b0743eb3f3906ef37570
2025-03-19 07:39:30 +08:00
merge-script
e8f6a48e31
Merge bitcoin/bitcoin#32057: test: avoid disk space warning for non-regtest
20fe41e9e8 test: avoid disk space warning for non-regtest (Sjors Provoost)

Pull request description:

  `feature_config_args.py` incorrectly assumed that its testnet4 node would not log a disk space warning.

  But when #31978 increased `m_assumed_blockchain_size` on testnet4 from 1 to 11 GiB, it triggered this bug on my RAM disk, see https://github.com/bitcoin/bitcoin/tree/master/test#speed-up-test-runs-with-a-ram-disk

  This PR fixes the issue by using `-prune` which prevents the warning.

ACKs for top commit:
  fjahr:
    ACK 20fe41e9e8
  maflcko:
    lgtm ACK 20fe41e9e8
  rkrux:
    ACK 20fe41e9e8

Tree-SHA512: f4bbb3ede307e06bf097a3cf7a4099eacc9388e33f551e1d0c4c5f53747bfa593a4b22e5d2e713ce6dd8adf91602fade36fbec9cfc2b250a6b1cf09f11bc8473
2025-03-19 07:22:00 +08:00
Chandra Pratap
387385ba1e test: replace assert with assert_equal and assert_greater_than
In test/functional/interface_usdt_net.py, assert_equal is already
used to check for equality between objects. Replace 'assert.*=='
with 'assert_equal' and 'assert.*>' with 'assert_greater_than'
to further easify debugging.
2025-03-18 14:05:43 +00:00
Ryan Ofsky
d190f0facc test, contrib: Fix signer/miner command line escaping
Pass bitcoin binary command lines from test framework to signet/miner utility
using shell escaping so they are unambigous and don't get mangled if they
contain spaces.

This change is not needed for tests to pass currently, but is a useful change
to avoid CI failures in followup PR
https://github.com/bitcoin/bitcoin/pull/31375 and to avoid other bugs.
2025-03-18 07:36:41 -05:00
Ryan Ofsky
223fc24c4e
Merge bitcoin/bitcoin#31603: descriptor: check whitespace in keys within fragments
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
21e9d39a37 docs: add release notes for 31603 (brunoerg)
a8b548d75d test: `getdescriptorinfo`/`importdescriptors` with whitespace in pubkeys (brunoerg)
c7afca3d62 test: descriptor: check whitespace into keys (brunoerg)
cb722a3cea descriptor: check whitespace in ParsePubkeyInner (brunoerg)
50856695ef test: fix descriptors in `ismine_tests` (brunoerg)

Pull request description:

  Currently, we successfully parse descriptors which contains spaces in the beginning or end of the public/private key within a fragment (e.g. `pk( KEY)`, `pk(KEY )` or `pk( KEY )`). I have noticed that one of the reasons is that the `DecodeBase58` function simply ignore these whitespaces.

  This PR changes the `ParsePubkeyInner ` to reject pubkeys that contain a whitespace at the beginning and/or at the end. We will only check the whitespace in some RPCs (e.g. `importdescriptors`), but an already imported descriptor won't be affected by this check, especially because we store descriptors from `ToString`.

  For context: https://github.com/brunoerg/bitcoinfuzz/issues/72

ACKs for top commit:
  rkrux:
    tACK 21e9d39a37
  darosior:
    re-ACK 21e9d39a37
  sipa:
    utACK 21e9d39a37

Tree-SHA512: 54f48a89a235517e5cdc29a46dceeb7dabbee93c7616a166288ff3f90131808eb0ece43b0797a11fe827a5f7bd51d65e3e75c16789b0a42020934cabb684cc8f
2025-03-18 08:36:41 -04:00
Ryan Ofsky
0d2eefca8b test, refactor: Add TestNode.binaries to hold binary paths
Add new TestNode.binaries object to manage paths to bitcoin binaries.

Having this object makes it possible for the test framework to exercise the
bitcoin wrapper executable introduced in
https://github.com/bitcoin/bitcoin/pull/31375 and also makes it easier to add
new binaries and options and environment variables controlling how they are
invoked, because logic for invoking them that was previously spread out is now
consolidated in one place.

Co-authored-by: Sjors Provoost <sjors@sprovoost.nl>
2025-03-18 07:36:41 -05:00
Sjors Provoost
cec14ee47d
test: switch wallet_crosschain.py to signet
Testnet3 is deprecated. Instead of moving to testnet4, which might
also be deprecated in the future, use signet.
2025-03-18 09:45:04 +01:00
Sjors Provoost
9c2951541c
test: drop testnet4 from wallet_crosschain.py
This reverts the changes to test/functional/wallet_crosschain.py
in commit 74a04f9e7a.

It's sufficient to check only one test network. The next commit
will change that network away from testnet3.
2025-03-18 09:20:13 +01:00
Hennadii Stepanov
257fd27e4b
Merge bitcoin/bitcoin#32033: test: Check datadir cleanup after assumeutxo was successful
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
52482cb244 test: Check datadir cleanup after assumeutxo was successful (Fabian Jahr)

Pull request description:

  I noticed that the proper datadir cleanup after a successful restart of an assumutxo node does not seem to be covered in our tests. This is added here.

ACKs for top commit:
  l0rinc:
    utACK 52482cb244
  mabu44:
    Re-ACK 52482cb244
  Prabhat1308:
    re-ACK [`52482cb`](52482cb244)
  TheCharlatan:
    Re-ACK 52482cb244

Tree-SHA512: cc941afeba250050eaccf5112255d961253fec9b2683545454a0d2fbe4d542178394b301d169a9dd79edbf6b5d478d95282727dbb0aca96ee79d4cd1ff80f19b
2025-03-17 13:43:45 +00:00
merge-script
5f4422d68d
Merge bitcoin/bitcoin#32010: qa: Fix TxIndex race conditions
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
3301d2cbe8 qa: Wait for txindex to avoid race condition (Hodlinator)
9bfb0d75ba qa: Remove unnecessary -txindex args (Hodlinator)
7ac281c19c qa: Add missing coverage of corrupt indexes (Hodlinator)

Pull request description:

  - Add synchronization in 3 places where if the Transaction Index happens to be slow, we get rare test failures when querying it for transactions (one such case experienced on Windows, prompting investigation).
  - Remove unnecessary TxIndex initialization in some tests.
  - Add some test coverage where TxIndex aspect could be tested in feature_init.py.

ACKs for top commit:
  fjahr:
    re-ACK 3301d2cbe8
  mzumsande:
    Code Review ACK 3301d2cbe8
  furszy:
    Code review ACK 3301d2cbe8
  Prabhat1308:
    Concept ACK [`3301d2c`](3301d2cbe8)

Tree-SHA512: 7c2019e38455f344856aaf6b381faafbd88d53dc88d13309deb718c1dcfbee4ccca7c7f1b66917395503a6f94c3b216a007ad432cc8b93d0309db9805f38d602
2025-03-17 10:28:14 +08:00
Fabian Jahr
52482cb244
test: Check datadir cleanup after assumeutxo was successful 2025-03-16 18:48:15 +01:00
merge-script
cd8089c20b
Merge bitcoin/bitcoin#32069: test: fix intermittent failure in wallet_reorgsrestore.py
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
36b0713edc test: fix intermittent failure in wallet_reorgsrestore.py (furszy)

Pull request description:

  In response to #32066 intermittent failure.

  Wait until the node's process has fully stopped before starting a new instance of it.
  Same behavior as in the [tool_wallet.py](698f86964c/test/functional/tool_wallet.py (L540)) test.

ACKs for top commit:
  maflcko:
    lgtm ACK 36b0713edc
  Chand-ra:
    tACK [36b0713](36b0713edc)

Tree-SHA512: 8e01493ef1fb58589479f3e12d7429d02ca75a2183d5f79d3b6a2fbf13334878926274a20857f1b4729afc1d30b65789daed229ce06ba236b91d949b73f45d5a
2025-03-16 22:29:14 +08:00
merge-script
70a0ee89c6
Merge bitcoin/bitcoin#32063: test: fix intermittent failure in p2p_orphan_handling.py
02942056fd test: fix intermittent failure in p2p_orphan_handling.py (Martin Zumsande)

Pull request description:

  If the mocktime is bumped before the node has successfully disconnected the peer, the requests for both parents could be spread over two GETDATAS: The first time `GetRequestsToSend` is invoked it would only request one tx from peer2, because the other one would only be available after peer1  was disconnected and its outstanding txrequest cleared.
  So two GETDATAs would be sent, which would make the test fail.

  Fixes #31700

ACKs for top commit:
  maflcko:
    lgtm ACK 02942056fd
  instagibbs:
    ACK 02942056fd

Tree-SHA512: 769200898345da197d86d673d9506f08f0a64b72a456e7e7c988ac37450d9c54ec65da1c8447c566c8578f7cfccdc5723ea680e636bfbe0b3d38265e5ef57774
2025-03-16 22:27:40 +08:00
Pol Espinasa
bf194c920c
wallet, rpc: deprecate settxfee and paytxfee 2025-03-16 11:12:03 +01:00
merge-script
ca05b28710
Merge bitcoin/bitcoin#31859: test: Rename send_message to send_without_ping
fa9cf38ab6 scripted-diff: test: Rename send_message to send_without_ping (MarcoFalke)
fa4356717d test: Prefer send_and_ping over send_message+sync_with_ping (MarcoFalke)

Pull request description:

  `send_message` is problematic, because it is easy to forget a `sync_with_ping` (or other `wait_until`), leading to intermittent test failures. (Example: https://github.com/bitcoin/bitcoin/pull/31837#discussion_r1950370246)

  There are more uses of `send_and_ping` in the codebase than `send_message`, so in most cases `send_and_ping` is needed anyway.

  For the remaining cases, clearly document that no sync happens by renaming `send_message` to `send_without_ping`.

ACKs for top commit:
  instagibbs:
    ACK fa9cf38ab6

Tree-SHA512: 31caa6568d292ae3d3dda931a94aaa30cc1205ec2ef537a484393eb55687f86c212f1e751ac4a7636610bdf591502a50995dc63bf02f97be9fdc482072160b07
2025-03-16 17:08:12 +08:00
merge-script
51a20e56c2
Merge bitcoin/bitcoin#31977: test: Use rpc_deprecated only for testing deprecation
2819c51482 test: Use rpc_deprecated only for testing deprecation (Fabian Jahr)

Pull request description:

  The comment in `functional/rpc_deprecated.py` says "This test should be used to verify correct behaviour of deprecated RPC methods with and without the -deprecatedrpc flags." I think we can get rid of the "with" part since we can assume that every deprecated RPC is already tested in at least one other functional test. (I didn't look but I could verify in our coverage if someone has doubts about that.) In order for this test to continue working, the flag will need to be used there. Otherwise this seems to prescribe copy+pasting a basic test from another file and I don't see a good reason for that.

ACKs for top commit:
  maflcko:
    lgtm ACK 2819c51482
  janb84:
    re ACK [2819c51](2819c51482)
  polespinasa:
    reACK 2819c51482

Tree-SHA512: 96edfd07be863ad19f99feb27afbc2c3ad53560c93c93eac8de8d766ad8c46e5aa02fd013fec99af794cbe9adca8e459d5b80b454caea7e67b2388003e010bb6
2025-03-16 16:59:39 +08:00
Sjors Provoost
20fe41e9e8
test: avoid disk space warning for non-regtest
feature_config_args.py incorrectly assumed that its testnet4 node
would not log a disk space warning.

0683b8ebf3 increased m_assumed_blockchain_size
on testnet4 from 1 to 11 GiB which triggers this bug on more
systems, e.g. a RAM disk.

Prevent the warning by setting -prune for these nodes.

Fix the same issue in feature_signet.py
2025-03-15 16:07:07 +01:00
Fabian Jahr
2819c51482
test: Use rpc_deprecated only for testing deprecation 2025-03-14 22:48:24 +01:00
furszy
36b0713edc
test: fix intermittent failure in wallet_reorgsrestore.py
Wait until the node's process has fully stopped before starting a new instance.

Since the same code is used in tool_wallet.py, this consolidates the behavior
into a 'kill_process()' function.
2025-03-14 11:06:44 -04:00
MarcoFalke
fa9cf38ab6
scripted-diff: test: Rename send_message to send_without_ping
send_message only drops the bytes in a buffer and a sync is needed to
avoid intermittent test issues. Change the name of the method to make
this more apparent during review.

-BEGIN VERIFY SCRIPT-
 sed -i 's/send_message(/send_without_ping(/g' $( git grep -l 'send_message(' )
-END VERIFY SCRIPT-
2025-03-14 12:45:20 +01:00
MarcoFalke
fa4356717d
test: Prefer send_and_ping over send_message+sync_with_ping
Also, add an explanation for the preference in the docs.
2025-03-14 12:44:34 +01:00
merge-script
698f86964c
Merge bitcoin/bitcoin#31961: Require sqlite when building the wallet
Some checks failed
CI / test each commit (push) Has been cancelled
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Has been cancelled
CI / macOS 14 native, arm64, fuzz (push) Has been cancelled
CI / Win64 native, VS 2022 (push) Has been cancelled
CI / Win64 native fuzz, VS 2022 (push) Has been cancelled
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Has been cancelled
36b6f36ac4 build: require sqlite when building the wallet (Sjors Provoost)

Pull request description:

  Require that sqlite is available in order to compile the wallet. Removes instances of `USE_SQLITE` since it is no longer possible to not have sqlite available.

  The `NO_SQLITE` option is dropped from depends.

  This is another step towards dropping the legacy wallet, extracted from #31250.

ACKs for top commit:
  m3dwards:
    ACK 36b6f36ac4
  davidgumberg:
    crACK 36b6f36ac4
  hebasto:
    re-ACK 36b6f36ac4.

Tree-SHA512: 870a0135671c80c4f28602119eb8637a1ed43b51b1673bfe88425782fb62ec6ef0f3d6baf0d5984d6a243779b0f63423fd4c4dc324ef87bffba13d63e05ad793
2025-03-14 11:23:35 +08:00
merge-script
1b251f6b67
Merge bitcoin/bitcoin#31649: consensus: Remove checkpoints (take 2)
3c5d1a4681 Remove checkpoints (marcofleon)
632ae47372 update comment on MinimumChainWork check (marcofleon)

Pull request description:

  The headers presync logic (only downloading headers that lead to a chain with sufficient work, implemented in https://github.com/bitcoin/bitcoin/pull/25717) should be enough to prevent memory DoS using low-work headers. Therefore, we no longer have any use for checkpoints.

  All checkpoints and checkpoint logic are removed in a single commit, to make it easy to revert if necessary.

  Some previous discussion can be found in https://github.com/bitcoin/bitcoin/pull/25725. The conclusion at the time was that more testing of the presync logic was needed. Now that we have [unit](https://github.com/bitcoin/bitcoin/blob/master/src/test/headers_sync_chainwork_tests.cpp), [functional](https://github.com/bitcoin/bitcoin/blob/master/test/functional/p2p_headers_sync_with_minchainwork.py), and [fuzz](https://github.com/bitcoin/bitcoin/blob/master/src/test/fuzz/p2p_headers_presync.cpp) tests for this logic, it seems safe to move forward with checkpoint removal.

ACKs for top commit:
  Sjors:
    Code review ACK 3c5d1a4681
  instagibbs:
    reACK 3c5d1a4681
  dergoegge:
    ACK 3c5d1a4681

Tree-SHA512: 051a6f9b82cd0262f4d3be4403906812fc6d1be022731fac16bb1c02bca471f31dfc7fc4b834ab2469e8f087265a6d99e84a1d665823cda1b112363a8e8f337d
2025-03-14 08:09:15 +08:00
Martin Zumsande
02942056fd test: fix intermittent failure in p2p_orphan_handling.py
If we bump the mocktime before the node has successfully disconnected
the peer, the requests for both parents could be spread over
two GETDATAS, which would make the test fail.
2025-03-13 17:59:02 -04:00
Ryan Ofsky
5d96c2eab9
Merge bitcoin/bitcoin#31907: qa: clarify and document one assumeutxo test case with malleated snapshot
e5ff4e416e qa: use a clearer and documented amount error in malleated snapshot (Antoine Poinsot)
b34fdb5ade test: introduce output amount (de)compression routines (Sebastian Falbesoner)
a7911ed101 test: introduce VARINT (de)serialization routines (Sebastian Falbesoner)

Pull request description:

  The `feature_assumeutxo.py` functional test checks various errors with malleated snapshots. Some of these cases are brittle or use confusing and undocumented values. Fix one of those by using a clear, documented and forward-compatible value.

  I ran across those when working on an unrelated changeset which affected the snapshot. It took me a while to understand where the seemingly magic byte string was coming from, so i figured it was worth proposing this patch on its own for the sake of making the test more maintainable.

  See commit messages for details.

ACKs for top commit:
  janb84:
    re ACK [e5ff4e4](e5ff4e416e)
  theStack:
    ACK e5ff4e416e
  fjahr:
    Code review ACK e5ff4e416e
  i-am-yuvi:
    tACK e5ff4e416e

Tree-SHA512: 60f022b7176836ce05e8f287b436329d7ca6460f3fcd95f78cd24e07a95a7d4d9cbbb68a117916a113fe451732b09a012d300fe860ff33d61823eca797ceddaf
2025-03-13 16:34:56 -04:00
Ryan Ofsky
57d611e53b
Merge bitcoin/bitcoin#31757: wallet: fix crash on double block disconnection
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
11f8ab140f test: wallet, coverage for crash on dup block disconnection during unclean shutdown (Martin Zumsande)
9ef429b6ae wallet: fix crash on double block disconnection (furszy)

Pull request description:

  The wallet crashes if it processes the same block disconnection event twice in a row due
  to an incompatible coinbase transaction state.
  This happens because `disconnectBlock` provides `TxStateInactive` without the "abandoned"
  flag for coinbase transactions to `SyncTransaction`, while `AddToWallet()` internally modifies
  it to retain the abandoned state.

  The crash flow is as follows:
  1) On the first disconnection, the transaction state transitions from "confirmed" to
  "inactive," bypassing the state equality check since the provided state differs. Then,
  `AddToWallet` internally updates the state to "inactive + abandoned"

  2) On the second disconnection, as we provide only the "inactive" state
  to `SyncTransaction()`, the state equality assertion fails and crashes the wallet.

  Reviewers Note:
  The crash can easily be replicated by cherry-picking the test commit in master.

ACKs for top commit:
  mzumsande:
    Code Review ACK 11f8ab140f
  rkrux:
    ACK 11f8ab140f
  pinheadmz:
    ACK 11f8ab140f

Tree-SHA512: 971069bca562f0afb06c34a2516842d01b5cbc2b18ed851392aa3caa3bb7488f4a84a5d017ea334e6361261d3c44aa597cc67a1d4fa16781f85e081f3d1f8771
2025-03-13 15:06:49 -04:00
marcofleon
3c5d1a4681 Remove checkpoints
The headers presync logic should be enough to prevent memory DoS using
low-work headers. Therefore, we no longer have any use for checkpoints.
2025-03-13 11:13:13 +00:00
Sjors Provoost
53ad845fb9
test: check fees and sigops in getblocktemplate 2025-03-13 11:16:57 +01:00
Sebastian Falbesoner
a82829f37e test: simplify (w)txid checks by avoiding .calc_sha256 calls
Calls on the tx.calc_sha256 method can be confusing, as they return
the result (either txid or wtxid, depending on the with_witness
boolean parameter) as integer rather than as actual (w)txid. Use
.rehash() and .getwtxid() instead to improve readability and in some
cases avoid a conversion from string-txid to an integer.
2025-03-13 01:42:47 +01:00
Sebastian Falbesoner
346a099fc1 test: avoid unneeded hash -> uint256 -> hash roundtrips
In the functional test framework, we often treat hashes
as uint256 integers, which seems to be confusing and for no
good reason, as hashes are just sequences of bytes. This commit
gets rid of obvious internal instances of that where individual
functional tests are not affected. In the long-term, it might make
sense to store other hashes (mostly txids) as actual bytes to
avoid annoying conversions and improve code readability.
2025-03-13 01:41:25 +01:00