7046 Commits

Author SHA1 Message Date
glozow
9dd7efc8c3 [policy] lower default minrelaytxfee and incrementalrelayfee to 100sat/kvB
Let's say an attacker wants to use/exhaust the network's bandwidth, and
has the choice between renting resources from a commercial provider and
getting the network to "spam" itself it by sending unconfirmed
transactions. We'd like the latter to be more expensive than the former.

The bandwidth for relaying a transaction across the network is roughly
its serialized size (plus relay overhead) x number of nodes. A 1000vB
transaction is 1000-4000B serialized. With 100k nodes, that's 0.1-0.4GB
If the going rate for commercial services is 10c/GB, that's like 1-4c per kvB
of transaction data, so a 1000vB transaction should pay at least $0.04.

At a price of 120k USD/BTC, 100sat is about $0.12. This price allows us
to tolerate a large decrease in the conversion rate or increase in the
number of nodes.

Github-Pull: #33106
Rebased-From: 6da5de58ca
2025-08-20 10:19:23 -04:00
glozow
bbdab3ef7b [prep/test] make wallet_fundrawtransaction's minrelaytxfee assumption explicit
Github-Pull: #33106
Rebased-From: 2e515d2897
2025-08-20 10:19:23 -04:00
glozow
a0ae3fc8a7 [prep/test] replace magic number 1000 with respective feerate vars
Github-Pull: #33106
Rebased-From: 3eab8b7240
2025-08-20 10:19:23 -04:00
glozow
1c1970fb45 [miner] lower default -blockmintxfee to 1sat/kvB
Back when we implemented coin age priority as a miner policy, miners
mempools might admit transactions paying very low fees, but then want to
set a higher fee for block inclusion. However, since coin age priority
was removed in v0.15, the block assembly policy is solely based on fees,
so we do not need to apply minimum feerate rules in multiple places. In
fact, the block assembly policy ignoring transactions that are added to
the mempool is likely undesirable as we waste resources accepting and
storing this transaction.

Instead, rely on mempool policy to enforce a minimum entry feerate to
the mempool (minrelaytxfee). Set the minimum block feerate to the
minimum non-zero amount (1sat/kvB) so it collects everything it finds in
mempool into the block.

Github-Pull: #33106
Rebased-From:  5f2df0ef78
2025-08-20 10:19:23 -04:00
glozow
567c3ee3cb [test] explicitly check default -minrelaytxfee and -incrementalrelayfee
Github-Pull: #33106
Rebased-From:  1fbee5d7b6
2025-08-20 10:19:23 -04:00
glozow
6b5396c4b1 [test] RBF rule 4 for various incrementalrelayfee settings
Github-Pull: #33106
Rebased-From: 72dc18467d
2025-08-20 10:19:23 -04:00
glozow
03da7aff99 [test] check bypass of minrelay for various minrelaytxfee settings
Github-Pull: #33106
Rebased-From: 85f498893f
2025-08-20 10:19:23 -04:00
glozow
4e3cfa660d [test] check miner doesn't select 0fee transactions
Github-Pull: #33106
Rebased-From: e5f896bb1f
2025-08-20 10:19:15 -04:00
Eugene Siegel
206f5902db config: add DEBUG_ONLY -logratelimit
Use -nologratelimit by default in functional tests if the bitcoind
version supports it.

Co-Authored-By: stickies-v <stickies-v@protonmail.com>

Github-Pull: #33011
Rebased-From: 5c74a0b397
2025-08-20 12:01:35 +01:00
Eugene Siegel
a0992a842e log: use std::source_location in place of __func__, __FILE__, __LINE__
The std::source_location conveniently stores the file name, line number,
and function name of a source code location. We switch to using it instead
of the __func__ identifier and the __FILE__ and __LINE__ macros.

BufferedLog is changed to have a std::source_location member, replacing the
source_file, source_line, and logging_function members. As a result,
MemUsage no longer explicitly counts source_file or logging_function as the
std::source_location memory usage is included in the MallocUsage call.

This also changes the behavior of -logsourcelocations as std::source_location
includes the entire function signature. Because of this, the functional test
feature_config_args.py must be changed to no longer include the function
signature as the function signature can differ across platforms.

Co-Authored-By: Niklas Gogge <n.goeggi@gmail.com>
Co-Authored-By: stickies-v <stickies-v@protonmail.com>

Github-Pull: #32604
Rebased-From: a6a35cc0c2
2025-08-20 11:42:01 +01:00
Chris Stewart
2b9738a083 test: Fix 'getdescriptoractivity' RPCHelpMan, add test to verify 'spend_vin' is the correct field
Github-Pull: #33119
Rebased-From: 3543bfdfec
2025-08-06 11:17:38 +01:00
merge-script
4bf77955ed Merge bitcoin/bitcoin#33013: [29.x] Backport #32521
f25dc84b28 doc: update release notes for 29.x (Antoine Poinsot)
313023369b qa: functional test a transaction running into the legacy sigop limit (Antoine Poinsot)
0a4671d5eb qa: unit test standardness of inputs packed with legacy sigops (Antoine Poinsot)
204b965915 policy: make pathological transactions packed with legacy sigops non-standard. (Antoine Poinsot)

Pull request description:

  This backports PR #32521 to make the change available to miners who can't (or don't want to) upgrade past version 29.

ACKs for top commit:
  marcofleon:
    reACK f25dc84b28
  glozow:
    ACK f25dc84b28

Tree-SHA512: d5e06618720ed1a96d8a5fccdd8d1dbcbb5748505aa0df69198326828fe13f220e55bbce813f6f2daae82d23348e1f83a3a20a28639ec3fc2455c5b6e79a56e6
2025-07-24 12:32:38 -04:00
furszy
380b5aded2 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.

Github-Pull: bitcoin/bitcoin#32069
Rebased-From: 36b0713edc
2025-07-24 09:29:11 -04:00
MarcoFalke
5e327e6703 test: Log KeyboardInterrupt as exception
log.exception is more verbose and useful to debug timeouts.

Also, log stderr for CalledProcessError to make debugging easier.

Github-Pull: #33001
Rebased-From: faa3e68411
2025-07-23 16:47:12 +01:00
MarcoFalke
79e1a3c9c6 test: Do not pass tests on unhandled exceptions
This adds a missing catch for BaseException (e.g. SystemExit), which
would otherwise be silently ignored.

Also, remove the redundant other catches, which are just calling
log.exception with a redundant log message.

Github-Pull: #33001
Rebased-From: fa30b34026
2025-07-23 16:46:48 +01:00
Antoine Poinsot
313023369b qa: functional test a transaction running into the legacy sigop limit
It's useful to have an end-to-end test in addition to the unit test to sanity check the RPC error as
well as making sure the transaction is otherwise fully standard.

Github-Pull: bitcoin/bitcoin#32521
Rebased-From: 96da68a38f
2025-07-18 16:51:54 -04:00
ismaelsadeeq
f85d41c224 test: retain the intended behavior of feature_fee_estimation.py nodes
- Increase block weight by 4000 for all nodes with custom -blockmaxweight.
  Prior to this commit, we generated blocks with 4000 weight units less worth of transactions.
  See https://github.com/bitcoin/bitcoin/issues/32461#issuecomment-2925282272 for details.
  This commit fixes it by increasing the block weight by 4000.

Github-Pull: #32463
Rebased-From: 9b75cfda4d
2025-07-04 09:34:31 +01:00
ismaelsadeeq
84c0c0e64b test: fix incorrect subtest in feature_fee_estimation.py
- Update `check_smart_estimates` to calculate the fee rate ceiling
   by taking the maximum of fees seen, minrelaytxfee, and mempoolminfee.
- Improve the subtest name and comments.

Github-Pull: #32463
Rebased-From: 5c1236f04a
2025-07-04 09:34:28 +01:00
Greg Sanders
59a83fb8d1 functional test: correctly detect nonstd TRUC tx vsize in feature_taproot
Github-Pull: #32859
Rebased-From: f0524cda39
2025-07-03 12:03:30 +01:00
Greg Sanders
9f3690b978 feature_taproot: sample tx version border values more
Currently if the version 3 is selected for an otherwise
standard spender, the test will fail. It's unlikely but
possible, so change the test to update expectations and
sample more aggressively on border values to instigate
failures much quicker in the future if another version is
made standard.

Github-Pull: #32841
Rebased-From: 4be81e9746
2025-07-03 12:03:06 +01:00
pablomartin4btc
3a57bfaaf9 test: Use rehash() in outbound eviction block-relay
Ensure that tip_header.rehash() is used instead of tip_header.hash, which is None when the header is deserialized from hex.

This avoids depending on wait_for_getheaders() falling back to any received message, making the test more explicit and robust.

Github-Pull: #32823
Rebased-From: ec004cdb86
2025-07-03 11:58:03 +01:00
pablomartin4btc
f82015ccfc test: Clarify roles in outbound eviction comments
Some ambiguous uses of "we" referring to either the node or the peer are replaced with clearer phrasing.

Also rephrase some comments for consistency and readability.

Applies to all relevant outbound eviction tests in p2p_eviction_logic.py.

Github-Pull: #32823
Rebased-From: 26598ed21e
2025-07-03 11:58:03 +01:00
dergoegge
4b656e2023 test: Add msgtype to msg_generic slots
Github-Pull: #32833
Rebased-From: 7dc43ea503
2025-06-30 13:28:55 +01:00
Sebastian Falbesoner
5987c1b6ab test: fix catchup loop in outbound eviction functional test
The catchup loop in the outbound eviction functional test currently has
a small flaw, as the contained waiting for a `getheaders` message just
waits for any such message instead of one with the intended block hash.
The reason is that the `prev_prev_hash` variable is set incorrectly,
since the `tip_header` instance is not updated and its field `.hash` is
None. Fix that by updating `tip_header` and use the correct field -- we
want the tip header's previous hash (`.hashPrevBlock`).

Github-Pull: #32742
Rebased-From: dd8447f70f
2025-06-26 11:24:02 +01:00
zaidmstrr
4c7ed36c96 test: Fix list index out of range error in feature_bip68_sequence.py
Github-Pull: #32765
Rebased-From: e285e691b7
2025-06-19 15:06:14 +01:00
Martin Zumsande
8246c6a65f test: wallet, coverage for crash on dup block disconnection during unclean shutdown
Co-authored-by: furszy <matiasfurszyfer@protonmail.com>

Github-Pull: #31757
Rebased-From: 11f8ab140f
2025-06-19 10:39:27 +01:00
Martin Zumsande
646fa1d028 test: fix sync function in rpc_psbt.py
It currently only syncs between the first two nodes,
which may do nothing when the block is created on the
third node.

Github-Pull: #32630
Rebased-From: 4df4df45d7
2025-05-29 12:31:10 +01:00
Ava Chow
6c0f26d3bd test: check that creating a wallet does not log version info
Github-Pull: #32553
Rebased-From: 4b2cd0b41f
2025-05-20 12:29:25 +01:00
Ava Chow
e685b4eca2 test: Check that the correct versions are logged on wallet load
Github-Pull: #32553
Rebased-From: 39a483c8e9
2025-05-20 12:29:21 +01:00
Martin Zumsande
cf034172bf test: fix another intermittent failure in wallet_basic.py
During init, the test framework will start using rpc after the
mempool was loaded. It will not wait for postInitProcess or
outstanding transactionAddedToMempool notifications, leading to
a possible race, in which listunspent is being called while the
tx is still in Inactive status. Prevent this by processing
outstanding notifications.

Github-Pull: #32483
Rebased-From: e7ad86e1ca
2025-05-14 13:26:53 +01:00
Martin Zumsande
c966158426 test: Fix intermittent failure in wallet_basic.py
There could be a race with outstanding TxAddedToMempool notifications
being applied to the soon-to-be created wallet.

Fixes an intermittent timeout reproducable by adding a sleep to
AddToWallet.

Github-Pull: #32483
Rebased-From: 07350e204d
2025-05-14 13:26:48 +01:00
enoch
6c4e3de2ac test: Use uninvolved pruned node in feature_pruning undo test
After fixing the nTime variable name, the test_pruneheight_undo_presence
test began failing because node 2, which is involved in reorg testing,
could be on a different chain than other nodes. This caused failures
when trying to fetch blocks from other nodes that didn't recognize
node 2's chain.

Switch to using node 5 instead, which is also a pruned node but isn't
involved in reorg testing, ensuring it stays on the same chain as the
other nodes. This allows the block fetching to work as intended in the
test.

Github-Pull: #32312
Rebased-From: 2aa63d511a
2025-05-14 10:01:32 +01:00
enoch
edd4073d70 test: Fix nTimes typo in feature_pruning test
Fix incorrect variable name in comment (nTimes -> nTime) in
feature_pruning.py. This typo caused the test to always reset
mine_large_blocks.nTime to 0, rather than only on the first run
as intended.

Github-Pull: #32312
Rebased-From: 772ba7f9ce
2025-05-14 10:01:26 +01:00
MarcoFalke
3665310808 scripted-diff: Use bpf_cflags
-BEGIN VERIFY SCRIPT-

 ren() { sed --regexp-extended -i "s/$1/$2/g" $( git grep --extended-regexp -l "$1" ) ; }

 ren 'cflags=\["-Wno-error=implicit-function-declaration"\]' 'cflags=bpf_cflags()'

-END VERIFY SCRIPT-

Github-Pull: #32336
Rebased-From: facb9b327b
2025-05-06 18:04:28 +01:00
MarcoFalke
4ed5c34abb test: Add imports for util bpf_cflags
This is required for the next commit.

Github-Pull: #32336
Rebased-From: fa0c1baaf8
2025-05-06 18:04:27 +01:00
Brandon Odiwuor
85f3e1de68 test: Handle empty string returned by CLI as None in RPC tests
Github-Pull: #32286
Rebased-From: a4041c77f0
2025-05-06 18:04:27 +01:00
Sjors Provoost
a3060483fa 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

Github-Pull: #32057
Rebased-From: 20fe41e9e8
2025-03-25 10:31:08 -04:00
Martin Zumsande
5ebcb59fdb 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.

Github-Pull: #32063
Rebased-From: 02942056fd
2025-03-16 22:07:20 -04:00
merge-script
8cb6ab0b97 Merge bitcoin/bitcoin#32025: validation, fix: Use wtxid instead of txid in CheckEphemeralSpends
e637dc2c01 refactor: Replace uint256 type with Wtxid in PackageMempoolAcceptResult struct (marcofleon)
a3baead7cb validation: use wtxid instead of txid in CheckEphemeralSpends (marcofleon)

Pull request description:

  This PR addresses a small bug in [`AcceptMultipleTransactions`](45719390a1/src/validation.cpp (L1598)) where a txid was being inserted into a map that should only hold wtxids.  `CheckEphemeralSpends` has an out parameter on failure that records that the child transaction did not spend the parent's dust. Instead of using the txid of this child, use its wtxid.

  The second commit in this PR is a refactor of the `PackageMempoolAcceptResult` struct to use the `Wtxid` type instead of `uint256`. This helps to prevent errors like this in the future.

ACKs for top commit:
  instagibbs:
    ACK e637dc2c01
  glozow:
    ACK e637dc2c01, hooray for type safety
  dergoegge:
    Code review ACK e637dc2c01

Tree-SHA512: 17039efbb241b7741e2610be5a6d6f88f4c1cbe22d476931ec99e43f993d259a1a5e9334e1042651aff49edbdf7b9e1c1cd070a28dcba5724be6db842e4ad1e0
2025-03-12 19:57:58 +08:00
Hennadii Stepanov
7bb4c82d8b Merge bitcoin/bitcoin#32021: qa: Enable feature_init.py on Windows
59c4930394 qa: Enable feature_init.py on Windows (Hodlinator)

Pull request description:

  Windows has been skipped since feature_init.py was added in #23289. Possibly due to poorer support on older Python versions, or attempts to use `CTRL_C_EVENT` (which didn't work in my testing either) instead of `CTRL_BREAK_EVENT`.

ACKs for top commit:
  maflcko:
    lgtm ACK 59c4930394
  BrandonOdiwuor:
    Code Review ACK 59c4930394
  hebasto:
    ACK 59c4930394, I have reviewed the code and it looks OK.

Tree-SHA512: 4f3649b41bcba2e8d03b8dcb1a7a6882edafb2c456db4b0768fc86018e9e9ed7171cb3d3c99e74b4ef38a3fcf3ab5d2f1865bbd49d791f1ce0a246806634e1a7
2025-03-12 11:26:58 +00:00
merge-script
502d47203e Merge bitcoin/bitcoin#31161: cmake: Set top-level target output locations
568fcdddae scripted-diff: Adjust documentation per top-level target output location (Hennadii Stepanov)
026bb226e9 cmake: Set top-level target output locations (Hennadii Stepanov)

Pull request description:

  This PR sets the target output locations to the `bin` and `lib` subdirectories within the build tree, creating a directory structure that mirrors that of the installed targets.

  This approach is widely adopted by the large projects, such as [LLVM](e146c1867e/lldb/cmake/modules/LLDBStandalone.cmake (L128-L130)):
  ```cmake
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
  ```

  The `libsecp256k1` project has also recently [adopted](https://github.com/bitcoin-core/secp256k1/pull/1553) this approach.

  With this PR, all binaries are conveniently located. For example, run:
  ```
  $ ./build/bin/fuzz
  ```
  instead of:
  ```
  $ ./build/src/test/fuzz/fuzz
  ```

  On Windows, all required DLLs are now located in the same directory as the executables, allowing to run `bitcoin-chainstate.exe` (which loads `bitcoinkernel.dll`) without the need to copy DLLs or modify the `PATH` variable.

  The idea was briefly discussed among the build team during the recent CoreDev meeting.

  ---

  **Warning**: This PR changes build locations of newly built executables like `bitcoind` and `test_bitcoin` from `src/` to `bin/` without deleting previously built executables. A clean build is recommended to avoid accidentally running old binaries.

ACKs for top commit:
  theStack:
    Light re-ACK 568fcdddae
  ryanofsky:
    Code review ACK 568fcdddae. Only change since last review was rebasing. I'm ok with this PR in its current form if other developers are happy with it. I just personally think it is inappropriate to \*silently\* break an everyday developer workflow like `git pull; make bitcoind`. I wouldn't have a problem with this PR if it triggered an explicit error, or if the problem was limited to less common workflows like changing cmake options in an existing build.
  TheCharlatan:
    Re-ACK 568fcdddae
  theuni:
    ACK 568fcdddae

Tree-SHA512: 1aa5ecd3cd49bd82f1dcc96c8e171d2d19c58aec8dade4bc329df89311f9e50cbf6cf021d004c58a0e1016c375b0fa348ccd52761bcdd179c2d1e61c105e3b9f
2025-03-12 11:19:00 +08:00
merge-script
e38f09b776 Merge bitcoin/bitcoin#31955: test: Fix authproxy named args debug logging
fac1dd9dff test: Fix authproxy named args debug logging (MarcoFalke)

Pull request description:

  In Python the meaning of `args or argsn` is that `argsn` is fully ignored when `args` is a list with at least one element. However, the RPC server accepts mixed positional and named args in the same RPC.

  Fix the debug log by always printing both. Also, add a new `_json_dumps` helper to avoid bloated code.

  Can be tested via `--tracerpc` on a call that uses named args mixed with positional args.

ACKs for top commit:
  i-am-yuvi:
    Tested ACK fac1dd9dff
  rkrux:
    tACK fac1dd9dff
  musaHaruna:
    Tested ACK [fac1dd9](fac1dd9dff)
  ryanofsky:
    Code review ACK fac1dd9dff. Thanks for logging fix. This change should have been included in #19762

Tree-SHA512: ff63fbc2564b2c7589e9294baacf4c7a79f10d593776813392510702ca726e3893a29db3ba261f3aee1789a59bb215d7cb10fc85ca1a02632631d3722ddcdfc5
2025-03-12 09:43:36 +08:00
marcofleon
a3baead7cb validation: use wtxid instead of txid in CheckEphemeralSpends 2025-03-11 16:00:46 +00:00
wgyt
5601bab4f8 Docs: fix typos in documentation files 2025-03-08 09:26:18 +08:00
Hodlinator
59c4930394 qa: Enable feature_init.py on Windows 2025-03-07 22:33:49 +01:00
glozow
0391d7e4c2 Merge bitcoin/bitcoin#31848: test, tracing: don't use problematic bpf_usdt_readarg_p()
a0b66b4bff Revert "test: Disable known broken USDT test for now" (0xb10c)
ec47ba349d contrib: don't use bpf_usdt_readarg_p (0xb10c)
35ae6ff60f test: don't use bpf_usdt_readarg_p (0xb10c)

Pull request description:

  Instead of using the undocumented bcc helper `bpf_usdt_readarg_p()`, use [`bpf_usdt_readarg()`][1] and [`bpf_probe_read_user()`][2]/[`bpf_probe_read_user_str()`][3] as documented in the [bcc USDT reference guide][1].

  Note that the `bpf_probe_read_user()` documentation says the following:
  > For safety, all user address space memory reads must pass through bpf_probe_read_user().

  It's [assumed](https://github.com/bitcoin/bitcoin/issues/27380#issuecomment-2286505348) that using `bpf_usdt_readarg_p()` caused a lifetime issue. With `bpf_usdt_readarg()` and `bpf_probe_read_user()`, this doesn't [seem](https://github.com/bitcoin/bitcoin/issues/27380#issuecomment-2528671656) to be a problem anymore.

  This allows to revert faed533743 and closes #27380.

    [1]: https://github.com/iovisor/bcc/blob/master/docs/reference_guide.md#6-usdt-probes
    [2]: https://github.com/iovisor/bcc/blob/master/docs/reference_guide.md#10-bpf_probe_read_user
    [3]: https://github.com/iovisor/bcc/blob/master/docs/reference_guide.md#11-bpf_probe_read_user_str

ACKs for top commit:
  i-am-yuvi:
    Tested ACK a0b66b4bff
  willcl-ark:
    tACK a0b66b4bff

Tree-SHA512: 002a692ad81ef284d4a610bbc6da477d623bf4dae5134c3692431c56b71692fa597e280fddd411eadd08eae77f01f47e2dcd0f37c0081326abe11a75bb10d6a6
2025-03-05 10:21:10 -05:00
fanquake
972b604dc4 doc: update location of minisketch repository 2025-03-05 14:13:53 +00:00
merge-script
6876e5076e Merge bitcoin/bitcoin#31943: test: add coverage for abandoning unconfirmed transaction
073a017016 test: add coverage for abandoning unconfirmed transaction (rkrux)

Pull request description:

  Previous discussion: https://github.com/bitcoin/bitcoin/pull/31794#pullrequestreview-2605174936
  Current Coverage: https://maflcko.github.io/b-c-cov/total.coverage/src/wallet/wallet.cpp.gcov.html#L1326

ACKs for top commit:
  Eunovo:
    Tested ACK 073a017016
  janb84:
    Tested ACK [073a017](073a017016)
  maflcko:
    lgtm ACK 073a017016
  Prabhat1308:
    Concept ACK [`073a017`](073a017016)
  brunoerg:
    utACK 073a017016

Tree-SHA512: be9b3d2e1cf65b20369be44d333aa2244b3af588f4a90374ad9562c3ea336669ba8f98a5fb88d616ba1f1f1b7dc0ad9bb47e7167aa03a52f2e0601525e156345
2025-02-26 09:36:34 -05:00
MarcoFalke
fac1dd9dff test: Fix authproxy named args debug logging 2025-02-25 22:41:17 +01:00
costcould
d9ba427f9d chore: remove redundant word
Signed-off-by: costcould <fliter@myyahoo.com>
2025-02-25 23:39:23 +08:00