Commit Graph

6912 Commits

Author SHA1 Message Date
Luke Dashjr
f06d7bc13d Merge branch 'sendraw_force-28+knots' into rbf_opts-28+knots 2025-02-21 23:43:27 +00:00
Luke Dashjr
e13f3fd693 QA: mining_coin_age_priority: Test both GBT and RPC in one pass 2025-02-21 23:41:44 +00:00
Luke Dashjr
069415f466 Test: Add test for coin-age priority mining 2025-02-21 23:41:44 +00:00
Luke Dashjr
1dddd69610 Tests: Update for coin-age priority 2025-02-21 23:41:44 +00:00
Luke Dashjr
7a0133b3f6 RPC/Mining: Include priority delta in getprioritisedtransactions result 2025-02-21 23:41:44 +00:00
Luke Dashjr
415a41f2d3 Merge branch 'restore_blockmaxsize' into mining_priority 2025-02-21 23:41:34 +00:00
Luke Dashjr
1af6e0e2ac Merge branch 'uaappend' into mining_priority 2025-02-21 23:41:31 +00:00
Luke Dashjr
098d51bc5e Merge branch 'fee_histogram+pr15836_api' into mining_priority 2025-02-21 23:41:27 +00:00
Luke Dashjr
14b872b852 Bugfix: QA: mempool_fee_histogram: Compare to actual vsize/fee rather than hard-coding a particular constant 2025-02-21 23:31:39 +00:00
Luke Dashjr
0aa11b9842 QA: interface_rest: Check /mempool/info/with_fee_histogram matches RPC 2025-02-21 23:31:39 +00:00
Luke Dashjr
9ebe86025c Bugfix: RPC/blockchain: Actually round feerates down for getmempoolinfo fee histograms 2025-02-21 23:31:39 +00:00
Luke Dashjr
d10e35ab13 Bugfix: QA: Ensure mempool_fee_histogram expected feerates rounded down
As of #22949, fees are rounded up based on feerate, but going the opposite direction from fee to feerate still must round down.
2025-02-21 23:31:39 +00:00
Luke Dashjr
68f7f13ad0 RPC/blockchain: getmempoolinfo: Return fee_histogram in older format (only) 2025-02-21 23:31:39 +00:00
Kiminuo
521f921d83 RPC/mempool: Add "to" (end of range) field to fee histogram
Co-authored-by: Jonas Schnelli <dev@jonasschnelli.ch>
Co-authored-by: Jon Atack <jon@atack.com>

Github-Pull: #21422
Rebased-From: 0b87ba9bc3a2ada2839af0e1af868fcd5ddb9155
2025-02-21 23:31:39 +00:00
Luke Dashjr
b9b320c02a RPC/blockchain: getmempoolinfo: Enable specifying with_fee_histogram as a boolean to use a sensible default set of fee rate levels 2025-02-21 23:31:39 +00:00
Luke Dashjr
eb93c8bf4b Bugfix: QA: Ensure mempool_fee_histogram can adapt to feerate rounding correctly
Caution: This implementation is for a post-#22949 codebase
2025-02-21 23:31:39 +00:00
Jonas Schnelli
ecd567ae63 RPC/blockchain: Consider ancestor, descendant, and combined fee rates for histogram in getmempoolinfo
Test changes from: 0b6ba66238

Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
Co-authored-by: Jon Atack <jon@atack.com>
2025-02-21 23:31:39 +00:00
Kiminuo
1d566c067c test: Add mempool fee histogram test coverage
Original commit: 0b6ba66238

Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
Co-authored-by: Jon Atack <jon@atack.com>

Github-Pull: #21422
Rebased-From: c5e53d0d21
2025-02-21 23:31:39 +00:00
Luke Dashjr
e57bd40ca9 RPC: Delete cookie file before replacing it
Unclear if this is the best thing to do, but due to v26.1.knots20240325 creating it read-only, it is somewhat necessary for now
2025-02-21 17:31:36 +00:00
Luke Dashjr
783fbafb67 Bugfix: RPC: Attempt to delete cookie tmp before creating it
May be needed if we ended up with a read-only tmp file
2025-02-21 17:31:36 +00:00
Luke Dashjr
051c276b67 Skip changing permissions entirely if -rpccookieperms=0 specified 2025-02-21 17:31:36 +00:00
Luke Dashjr
d307da8781 rpccookieperms: Allow setting setxid/sticky bits
Simply for backward compatibility
2025-02-21 17:31:36 +00:00
Luke Dashjr
0a4e77a361 QA: rpc_users: Extend rpccookieperms test to octal values 2025-02-21 17:31:36 +00:00
Luke Dashjr
ba86144e77 Merge branch 'sendraw_force-28+knots' into mining_priority 2025-02-21 17:13:06 +00:00
Luke Dashjr
a1df69392d Label and allow overriding bad-witness-anchor-not-empty rejections 2025-02-21 16:41:12 +00:00
Luke Dashjr
f7c3f43689 QA: rpc_getrpcwhitelist: Use requires_wallet rather than manual creation of unnamed wallet 2025-02-21 16:34:56 +00:00
Luke Dashjr
4eeaca5f03 RPC: getrpcwhitelist: Return a list of wallets as a JSON Object 2025-02-21 16:34:56 +00:00
Luke Dashjr
d03bbe2220 Merge branch 'multiwallet_rpc-28+knots' into getrpcwhitelist_wallets-28+knots 2025-02-21 16:34:48 +00:00
Luke Dashjr
763ca710d2 Merge branch 'rpc_getrpcwhitelist' into getrpcwhitelist_wallets-28+knots 2025-02-21 16:34:37 +00:00
Luke Dashjr
4432c6b5b7 RPC: getrpcwhitelist: Return all methods (or none) if no explicit whitelist defined 2025-02-21 16:34:12 +00:00
Luke Dashjr
42d2ea53e8 RPC: getrpcwhitelist: Return methods as a JSON Object for future expansion to sub-call permissions 2025-02-21 16:34:12 +00:00
Harris
2c172d3a0d RPC: Add getrpcwhitelist method 2025-02-21 16:34:12 +00:00
Luke Dashjr
550f67c5d1 Bugfix: QA: rpc_getgeneralinfo: Adapt test for startuptime ignoring mocktime 2025-02-21 16:33:26 +00:00
Luke Dashjr
47e4c8fbc6 QA: Actually check getgeneralinfo results are correct 2025-02-21 16:33:26 +00:00
Luke Dashjr
12c22b8235 rpc: implement getgeneralinfo 2025-02-21 16:33:26 +00:00
Andrew Toth
bbcec3aed7 test: add test for SyncCoinsTipAfterChainSync
Github-Pull: #15218
Rebased-From: 8887d28a014420668801d7e4c5d1bf45c5e93684
2025-02-21 16:31:20 +00:00
Luke Dashjr
eaaa8e1d51 QA: rpc_users: Test rpcauth wallet restrictions 2025-02-21 16:30:03 +00:00
Luke Dashjr
38698fecf6 Merge branch 'improve_args_pr31212-28' into multiwallet_rpc-28+knots 2025-02-21 16:29:54 +00:00
Luke Dashjr
2399363262 Merge branch 'rpc_dumptxoutset_hr' into multiwallet_rpc-28+knots 2025-02-21 16:29:52 +00:00
Luke Dashjr
05c676d090 QA: Functional test for sweepprivkeys 2025-02-21 16:29:15 +00:00
Luke Dashjr
867a41e4ba Merge branch 'AutoFile_error_check-28' into sweepprivkeys 2025-02-21 16:28:33 +00:00
Luke Dashjr
9a8e02f531 Merge branch 'rpc_getblocklocations' into sweepprivkeys 2025-02-21 16:28:29 +00:00
Luke Dashjr
30d940a219 RPC: createmultisig/addmultisigaddress: Support named args for options 2025-02-21 16:26:25 +00:00
Luke Dashjr
ecd45f5e6c QA: rpc_sort_multisig: Rename variables to avoid keyword conflict with sorted 2025-02-21 16:26:25 +00:00
Thomas Kerin
949e953d93 Add more tests to sort_multisig.py / wallet_labels.py
sort_multisig test: check uncompressed keys are disallowed
sort_multisig: add test demonstrating sorting
wallet_labels: test addmultisigaddress fails if sort=true and (wallet) address is uncompressed
2025-02-21 16:26:25 +00:00
Luke Dashjr
88e4bd655a RPC: Use options object rather than adding a "sort" boolean for multisig methods 2025-02-21 16:26:25 +00:00
Thomas Kerin
c22a69eed1 RPC: addmultisigaddress / createmultisig: parameterize _createmultisig_redeemScript to allow sorting of public keys (BIP67) 2025-02-21 16:26:25 +00:00
Luke Dashjr
af6f73734e QA: tool_cli_bash_completion: Whitespace linter fix 2025-02-21 16:24:27 +00:00
furszy
b5764509d0 test: rpc_getblockfrompeer.py, remove magic numbers usage
Instead of hardcoding the `pruneblockchain(<height>)` heights,
use 'getblockfileinfo' to obtain the highest block number of
each of the block files.

Making the test more robust and readable by stating which file
is being pruned at every point of time (the goal is to mimic
how the automatic pruning process work).

Github-Pull: #27770
Rebased-From: 5090771f32
2025-02-21 16:20:53 +00:00
Luke Dashjr
764c660ed4 Merge branch 'rpc_getblocklocations' into rpc_getblockfileinfo-28+knots 2025-02-21 16:17:45 +00:00
Lawrence Nahum
df969b672f add support to save fee estimates without shutting down the node 2025-02-21 16:15:34 +00:00
Luke Dashjr
099f47c89f QA: rpc_getblocklocations: Support for testing with blocksxor enabled 2025-02-21 16:15:05 +00:00
Roman Zeyde
620e79b72f RPC: Add getblocklocations call
This RPC allows the client to retrieve the file system locations
of the confirmed blocks and their undo data, to allow building
efficient indexes outside of Bitcoin Core.

An example usage is described here:
https://github.com/romanz/electrs/issues/308

By using the new RPC, it is possible to build an address-based
index taking ~24GB and a txindex taking ~6GB (as of Dec. 2020).
2025-02-21 16:15:05 +00:00
Luke Dashjr
248c26411d lint: exception for fix_leveldb_ptrarith_pr31671 2025-02-21 16:00:05 +00:00
Vasil Dimov
c2ef3896f8 test: avoid generating non-loopback traffic from p2p_dns_seeds.py
`p2p_dns_seeds.py` would try to connect to the DNS server configured on
the machine and resolve `dummySeed.invalid`.

To block that configure an unavailable proxy which will be used also to
connect to the name server. The test needs 2 successful connections to
other peers (two Python `P2PInterface`s) and they work in spite of the
unavailable proxy because they are on `127.0.0.1` (`NET_UNROUTABLE`) and
the proxy is not used for that.

Github-Pull: #31646
Rebased-From: 2ed161c5ce
2025-02-21 15:38:43 +00:00
Vasil Dimov
a015a39bc5 test: avoid generating non-loopback traffic from feature_config_args.py
`feature_config_args.py` uses a proxy address of `1.2.3.4`. This results
in actually trying to open TCP connections over the internet to
`1.2.3.4:9050`.

The test does not need those to succeed so use `127.0.0.1:1` instead.

Also avoid `-noconnect=0` because that is interpreted as `-connect=1`
which is interpreted as `-connect=0.0.0.1` and a connection to
`0.0.0.1:18444` is attempted.

Github-Pull: #31646
Rebased-From: a5746dc559
2025-02-21 15:38:43 +00:00
Vasil Dimov
95f8bfd162 QA/test_framework: Add UNREACHABLE_PROXY_ARG
Github-Pull: #31646
Rebased-From: 6b3f6eae70 (partial)
2025-02-21 15:38:43 +00:00
Hodlinator
c58ca376e2 chore: Typo Overriden -> Overridden
Github-Pull: #31433
Rebased-From: 41d934c72d
2025-02-21 15:32:09 +00:00
Luke Dashjr
529fea94db lint/python-dead-code: Just warn, but allow 2025-02-21 15:27:23 +00:00
Luke Dashjr
f1c9717c7e lint/circular-dependencies: Only check for real circular dependencies 2025-02-21 15:27:23 +00:00
Luke Dashjr
3248ebd754 lint/includes: Ignore duplicate includes in .cpp files 2025-02-21 15:27:23 +00:00
Karl-Johan Alm
6fc46bfe11 test: add test to segwit tests for fee rate when signing raw tx 2025-02-14 21:09:22 +00:00
Luke Dashjr
0db147c92f QA: Adapt feature_includeconf test for complex UAs 2025-02-07 18:20:49 +00:00
Luke Dashjr
6924713ae1 QA: Adapt feature_uacomment test for complex UAs 2025-02-07 18:20:49 +00:00
Luke Dashjr
b109fe6fe8 Expire bitcoind & bitcoin-qt 1-2 years after its last change
COPYRIGHT_YEAR + 2 years is used as the basis for expiration, to achieve a constantly-moving-forward expiration date.

The expiration can be disabled or extended with a debug-visibility "softwareexpiry" configuration option.
2025-02-03 18:30:59 +00:00
Luke Dashjr
0fcc5ed47d QA: Functional test for checkpoint enforcement
Prior to receiving the correct chain's headers, an alternate chain should be stopped prior to the first checkpoint-violating block.
2025-02-02 01:14:26 +00:00
Luke Dashjr
9a79815097 net_permissions: Include "addr" permission on implicit whitelist entries 2025-02-02 00:58:20 +00:00
Luke Dashjr
ce3641a0e5 QA: rpc_getblockfrompeer: Test that fetch-without-header actually works 2025-01-29 02:33:45 +00:00
Luke Dashjr
6c78d40b89 RPC/blockchain: Allow using getblockfrompeer without already having the block header
Github-Pull: #20295
Rebased-From: d0b537458d90b92f2632f8578cfdaadc9a8f4ed0
2025-01-29 02:33:45 +00:00
Luke Dashjr
7e70c926e3 Merge branch 'rpc_getblockfrompeer_future' into rpc_getblockfrompeer_wo_header 2025-01-29 02:33:42 +00:00
Luke Dashjr
8fa6f07273 QA: wallet_implicitsegwit: Add tests for -walletimplicitsegwit=0 2025-01-28 14:46:43 +00:00
Luke Dashjr
9828136fb4 Wallet: Support disabling implicit Segwit operation 2025-01-28 14:46:43 +00:00
stratospher
dcb5daf5cf test: Check that v1 connections to clearnet peers don't work
when `-v2onlyclearnet` is turned on:
- v1 connections to clearnet peers don't work
- v2 connections to clearnet peers work
- v1 conneections to tor/i2p/cjdns peer works

a proxy is used because otherwise NET_UNROUTABLE is the default
network in the tests.

Github-Pull: #30951
Rebased-From: 5e3fa6758ba940384747575df14a75be15bfa629
2025-01-28 00:28:48 +00:00
Luke Dashjr
ca56c7c9c4 Diff-minimise 2025-01-25 16:04:47 +00:00
Cory Fields
145dd295d9 tests: add a test for the new blocksdir lock
Github-Pull: #31674
Rebased-From: 2656a5658c
2025-01-25 16:04:47 +00:00
Cory Fields
68e55e2818 refactor: introduce a more general LockDirectories for init
No functional change. This is in preparation for adding additional directory
locks on startup.

Github-Pull: #31674
Rebased-From: cabb2e5c24
2025-01-25 16:04:47 +00:00
Luke Dashjr
cf65351293 Give separate reject reasons to each TRUC check 2025-01-23 03:01:51 +00:00
Luke Dashjr
b812959b51 QA: rpc_rawtransaction: Test ignore_rejects 2025-01-23 03:01:51 +00:00
Luke Dashjr
9a7339f672 Make bad-witness-nonstandard rejection more specific, and support overriding some 2025-01-23 03:01:51 +00:00
Luke Dashjr
b115c10755 AreInputsStandard: Return specific reject reasons 2025-01-23 03:01:50 +00:00
Luke Dashjr
ac87dbe333 Restore blockmaxsize option, allowing to limit mined blocks by byte size 2025-01-17 01:51:06 +00:00
Ash Manning
4313bb78d8 rpc: add signet_challenge field to getblockchaininfo and getmininginfo
Github-Pull: #31531
Rebased-From: ecaa786cc1
2025-01-15 15:21:04 +00:00
MarcoFalke
d834bfda34 Remove wallet::ParseISO8601DateTime, use ParseISO8601DateTime instead
Github-Pull: #31391
Rebased-From: faf70cc994
2025-01-09 04:11:43 +00:00
MarcoFalke
88c7842f35 test: Add missing node.setmocktime(self.mocktime) to p2p_ibd_stalling.py
This was forgotten by myself in commit fa5b58ea01

Github-Pull: #31383
Rebased-From: faa16ed4b9
2025-01-08 23:01:15 +00:00
Sebastian Falbesoner
16d60e56de test: avoid internet traffic in rpc_net.py
Can be tested by running

```
$ sudo tcpdump -i eth0 host 11.22.33.44
```

and verifying that no packets appear in the tcpdump output.

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>

Github-Pull: #31343
Rebased-From: 988721d37a
2025-01-08 20:13:57 +00:00
Hodlinator
e1b776466d test: Add tests for directories in place of config files
Github-Pull: #31212
Rebased-From: 95a0104f2e
2025-01-08 18:48:13 +00:00
Hodlinator
6b837312c6 test: Add tests for -noconf
Github-Pull: #31212
Rebased-From: e4b6b1822c
2025-01-08 18:48:13 +00:00
Hodlinator
41970350d4 test refactor: feature_config_args.py - Stop nodes at the end of tests, not at the beginning
This ensures we don't needlessly start the node, and reduces implicit dependencies between test functions.

test_seed_peers() - Move assert calling RPC to verify correct chain after our own function actually started the node.

Github-Pull: #31212
Rebased-From: 312ec64cc0
2025-01-08 18:48:13 +00:00
Hodlinator
56c374dfad test: -norpccookiefile
Both bitcoind and bitcoin-cli.

Github-Pull: #31212
Rebased-From: 7402658bc2
2025-01-08 18:48:13 +00:00
Hodlinator
9b90eea2a1 test: Harden testing of cookie file existence
Github-Pull: #31212
Rebased-From: 6e28c76907
2025-01-08 18:48:13 +00:00
Hodlinator
a613155808 test: combine_logs.py - Output debug.log paths on error
Github-Pull: #31212
Rebased-From: 75bacabb55
2025-01-08 18:48:13 +00:00
MarcoFalke
81b6de569e test: Avoid logging error when logging error
Github-Pull: #31408
Rebased-From: cccca8a77f (minimised)
2025-01-08 14:19:17 +00:00
MarcoFalke
05cd448e33 test: generateblocks called by multiple threads
Co-Authored-By: David Gumberg <davidzgumberg@gmail.com>

Github-Pull: 31563
Rebased-From: fa63b8232f
2025-01-02 14:17:02 +01:00
Martin Zumsande
a0585b6087
test: add functional test for -port behavior
Github-Pull: bitcoin/bitcoin#31223
Rebased-From: 997757dd2b
2024-12-13 21:15:26 -05:00
Martin Zumsande
bbde830b97
net, init: derive default onion port if a user specified a -port
After port collisions are no longer tolerated but lead to
a startup failure in v28.0, local setups of multiple nodes,
each with a different -port value would not be possible anymore
due to collision of the onion default port - even if the nodes
were using tor or not interested in receiving onion inbound connections.

Fix this by deriving the onion listening port to be -port + 1.
(idea by vasild / laanwj)

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>

Github-Pull: bitcoin/bitcoin#31223
Rebased-From: 0e2b12b92a
2024-12-13 21:15:23 -05:00
0xb10c
227642d5af
test: fix MIN macro-redefinition
Renames the `MIN` macro to `_TRACEPOINT_TEST_MIN`.

From #31418:

```
stderr:
/virtual/main.c:70:9: warning: 'MIN' macro redefined [-Wmacro-redefined]
   70 | #define MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
      |         ^
include/linux/minmax.h:329:9: note: previous definition is here
  329 | #define MIN(a,b) __cmp(min,a,b)
      |         ^
1 warning generated.
```

fixes: https://github.com/bitcoin/bitcoin/issues/31418

Github-Pull: bitcoin/bitcoin#31419
Rebased-From: 00c1dbd26d
2024-12-11 11:41:49 -05:00
Jon Atack
167c073d4b test: add coverage for -getinfo total_balance
Github-Pull: #19092
Rebased-From: 414804e877f630a630c3d6226cb6714c0a6320e8
2024-12-06 01:25:56 +00:00
Jon Atack
d7ab3e4984 test: add coverage for scale in -getinfo amount values 2024-12-06 00:58:03 +00:00
Jon Atack
84eda4ec67 test: add assert_scale assertion to test framework 2024-12-06 00:58:03 +00:00
Jon Atack
1ccce06ee4 test: add -getinfo command parsing regression tests
These tests fail without the changes in the first commit of this PR.
2024-12-06 00:58:03 +00:00
Jon Atack
0dadb96d07 test: add assertion, rm unneeded call in interface_bitcoin_cli.py 2024-12-06 00:58:03 +00:00
Luke Dashjr
24462fde47 Warn in the debug log (only) for blocks where the block version is being abused 2024-12-05 19:51:43 +00:00
Luke Dashjr
a2405f7347 fixup! Restore warning for individual unknown version bits, as well as unknown version schemas 2024-12-05 19:51:43 +00:00
Luke Dashjr
2556d909f8 Restore warning for individual unknown version bits, as well as unknown version schemas
This commit squashes:
9b32a6f5d5 Restore warning for individual unknown version bits, as well as unknown version schemas
4f5f6c755a Bugfix: Include unknown-signal warnings in debug log
50944ca9a7 Refactor block warning messages to display multiple
105c907fa4 Bugfix: Only warn about an unknown versionbit signal if it's positive
aa6e5154db In unexpected version signalling warnings, list the specific bits involved
ff929ecfec Docfix: QA: feature_versionbits_warning: Warnings are not errors
c32468f51d Defer N/100 blocks signalling warning to 76/100 for BIP320 bits
ce89dc9566 Once an unexpected-signal warning is triggered, persist it until node restart
0da086b42b Refactor N/100 blocks signalling warning to detect edge case
2024-12-05 19:51:43 +00:00
Luke Dashjr
8e46b4a040 QA: Add forbid_msgs param to TestNode.wait_for_debug_log 2024-12-04 22:39:08 +00:00
James O'Beirne
fc43ba2fbe test: rpc: add no address case for getdescriptoractivity
Co-authored-by: Greg Sanders <gsanders87@gmail.com>

Github-Pull: #30708
Rebased-From: ee3ce6a4f4
2024-11-27 20:36:08 +00:00
James O'Beirne
5343de23c4 rpc: add getdescriptoractivity
Github-Pull: #30708
Rebased-From: 811f76f3a5
2024-11-27 20:36:06 +00:00
Luke Dashjr
78b7447ab0 QA: p2p_unrequested_blocks: Use node-to-test / outgoing connection to check invalid header disconnection 2024-11-26 22:21:40 +00:00
Luke Dashjr
a5d3d92add QA/Mininode: Support node-to-test connections 2024-11-25 01:02:24 +00:00
Luke Dashjr
abb97b7960 Bugfix: QA: interface_zmq: Compare txid correctly when it is a Segwit tx 2024-11-24 23:50:26 +00:00
Doron Somech
7b41419e8d ZMQ: add publishers of wallet tx
Topic will indicate if transaction came from mempool or block so developers can handle the transaction accordingly without a RPC round trip to bitcoind.

(includes ZMQ: Making CWallet::TransactionAddedToWallet static)
2024-11-24 23:44:39 +00:00
Luke Dashjr
10f2255b2b Merge branch 'wallet_warn_reuse_gui' into zmq_wtx-28+knots 2024-11-24 23:43:42 +00:00
Jonas Schnelli
d5e72162ca [RPC] Add interface to access mempool stats 2024-11-21 21:37:13 +00:00
Greg Sanders
bdb4ca4195 rpc: Add support to populate PSBT input utxos via rpc
This feature is useful when construction a series of
presigned transactions that can not be entered into the
mempool or UTXO set before signing everything.

Github-Pull: #30886
Rebased-From: 87ceb610a72fda00e02f98426c6ee66b34fd6f54
2024-11-18 20:06:08 +00:00
Luke Dashjr
8ed92bf6c7 Bugfix: QA: tool_cli_bash_completion: Typo in self.options 2024-11-15 15:45:17 +00:00
Brandon Odiwuor
7dd6f5b7fc test: keeps bitcoin-cli autocomplete in sync
Adds a functional test which parses available RPC commands, generates
the associated bitcoin-cli autcomplete file and checks that the current
autocomplete matches the file
An outdated autcomplete file can be updated using the --overwrite parameter

Co-authored-by: pierrenn <git@pnn.sh>

Github-Pull: #30860
Rebased-From: 7c8b021fee3b528ff28b85ec2e8933ebc5b2b488
2024-11-15 15:40:11 +00:00
tdb3
ba9560b59a test: explicitly check boolean verbosity is disallowed
Github-Pull: #31043
Rebased-From: 0ea84bc362
2024-11-15 05:18:58 +00:00
tdb3
6703ee8599 test: add entry and expiration time checks
Github-Pull: #31043
Rebased-From: 63f5e6ec79
2024-11-15 05:18:58 +00:00
tdb3
700c917c6d refactor: rename rpc_getorphantxs to rpc_orphans
Generalizes the test to accommodate additional
orphan-related RPCs

Github-Pull: #31043
Rebased-From: 56bf302714
2024-11-15 05:18:58 +00:00
tdb3
4c770de7dc test: check that getorphantxs is hidden
Github-Pull: #31043
Rebased-From: 7824f6b077
2024-11-15 05:18:58 +00:00
tdb3
b590f2bc88 rpc: disallow undefined verbosity in getorphantxs
Github-Pull: #31043
Rebased-From: ac68fcca70
2024-11-15 05:18:58 +00:00
kevkevinpal
c74b525c8a test: Assert that when we add the max orphan amount that we cannot add anymore and that a random orphan gets dropped
Github-Pull: #31040
Rebased-From: 5c299ecafe
2024-11-15 05:18:58 +00:00
tdb3
4e9d1d5b8e test: add getorphantxs tests
Adds functional tests for getorphantxs

Github-Pull: #30793
Rebased-From: 98c1536852
2024-11-15 05:18:58 +00:00
tdb3
28f583d795 test: add tx_in_orphanage()
Allows tests to check if a transaction
is contained within the orphanage

Github-Pull: #30793
Rebased-From: 93f48fceb7
2024-11-15 05:18:58 +00:00
Luke Dashjr
9996a1e898 rpc/net: Adds misbehaving_score to getpeerinfo
Github-Pull: #29530
Rebased-From: 976d61c974ed045c2e2497dcebc4d1fcc4d60a29
2024-11-14 20:09:02 +00:00
Matthew Zipkin
3db935abd1 test: cover ForceInbound permission success even when connections are full
Github-Pull: #27600
Rebased-From: 6b6bcaf0b9ae0a7adaf96bf791aaafc6b5e9f000
2024-11-14 18:46:30 +00:00
Luke Dashjr
d09a74c7e4 RPC/Wallet: Hacky fix for getbalance bugs 2024-11-14 18:30:13 +00:00
Andrew Poelstra
de53d61a18 codex32: add functional test for seed import
Github-Pull: #27351
Rebased-From: 91771366a3df22b9e8b4b7152d368d739bfeda94
2024-11-13 20:51:48 +00:00
Luke Dashjr
e21f3deac6 Merge branch 'rpc_importaddr_for_descwallet-27+k' into codex32-28+knots 2024-11-13 20:51:11 +00:00
Matthew Zipkin
67e6fd03de test: cover "ismine" and "isactive" field in rpc getaddressinfo
Github-Pull: #27216
Rebased-From: 67650211e36003ca3adddef34118ea45023c283f
2024-11-13 17:25:29 +00:00
Luke Dashjr
4bb5473334 JSON-RPC: Tolerate non-standard "jsonrpc" versions (treat as 1.1) 2024-11-11 17:19:39 +00:00
pablomartin4btc
299d6b1296 rpc, cli: improve error message on multiwallet mode
The primary objective is to provide users with clearer
and more informative error messages when encountering
the RPC_WALLET_NOT_SPECIFIED error, which occurs when
multiple wallets are loadad.

This commit also rectifies the error message consistency
by bringing the error message in line with the definition
established in protocol.h ("error when there are multiple
wallets loaded").

Github-Pull: #26990
Rebased-From: 54227e681a
2024-11-11 15:46:06 +00:00
Antoine Poinsot
6c24ce7025 [test] A non-standard transaction which is also consensus-invalid should return the consensus error
Github-Pull: #31097
Rebased-From: 86e2a6b749
2024-11-10 17:58:12 +00:00
Martin Zumsande
b917334208
test: add missing sync to feature_fee_estimation.py
Fixes a race between node 1 catching up with the chain and mining a
new block in the sanity_check_rbf_estimates subtest.

Github-Pull: #31016
Rebased-From: a1576edab3
2024-10-22 16:04:14 +01:00
Fabian Jahr
d39262e5d4
test: Wait for local services to update in feature_assumeutxo
Github-Pull: bitcoin/bitcoin#30880
Rebased-From: 19f4a7c95a
2024-09-12 15:02:05 -04:00
furszy
b329ed739b
test: add coverage for assumeUTXO honest peers disconnection
Exercising and verifying the following points:

1. An IBD node can sync headers from an AssumeUTXO node at
   any time.

2. IBD nodes do not request historical blocks from AssumeUTXO
   nodes while they are syncing the background-chain.

3. The assumeUTXO node dynamically adjusts the network services
   it offers according to its state.

4. IBD nodes can fully sync from AssumeUTXO nodes after they
   finish the background-chain sync.

Github-Pull: bitcoin/bitcoin#30807
Rebased-From: 992f83bb6f
2024-09-11 13:42:54 -04:00
furszy
c6b5db1d59
assumeUTXO: fix peers disconnection during sync
Because AssumeUTXO nodes prioritize tip synchronization, they relay their local
address through the network before completing the background chain sync.
This, combined with the advertising of full-node service (NODE_NETWORK), can
result in an honest peer in IBD connecting to the AssumeUTXO node (while syncing)
and requesting an historical block the node does not have. This behavior leads to
an abrupt disconnection due to perceived unresponsiveness (lack of response)
from the AssumeUTXO node.

This lack of response occurs because nodes ignore getdata requests when they do
not have the block data available (further discussion can be found in PR 30385).

Fix this by refraining from signaling full-node service support while the
background chain is being synced. During this period, the node will only
signal 'NODE_NETWORK_LIMITED' support. Then, full-node ('NODE_NETWORK')
support will be re-enabled once the background chain sync is completed.

Github-Pull: bitcoin/bitcoin#30807
Rebased-From: 6d5812e5c8
2024-09-11 13:42:51 -04:00
brunoerg
dbbb11e560 QA: p2p_invalid_messages: Check misbehaving with noban,out whitelisting
Github-Pull: #27114
Rebased-From: 1bae3b2ee6cb96c12fd7810c9362cfb7bdc165ad (partial)
2024-09-06 20:27:54 +00:00
Luke Dashjr
4130132013 Bugfix: QA/wallet_fundrawtransaction: Ensure segwit_inputs_only gets tested correctly
Co-authored-by: Aurèle Oulès <aurele@oules.com>
2024-09-05 00:35:01 +00:00
Aurèle Oulès
f7473e4b22 Witness-only option for fundrawtransaction
Github-Pull: #25183
Rebased-From: 1c5cfd84b3dc14ab886acd47c7891c11eb2457ec
2024-09-05 00:35:00 +00:00
Luke Dashjr
a22be508da RPC/Wallet: Convert descriptorprocesspsbt to use options parameter 2024-09-04 02:42:01 +00:00
Dan Benjamin
ac4327cbff Added a field to the output of gettransaction/listtransactions to indicate whether the given transaction is in the mempool.
Github-Pull: #21260
Rebased-From: 46bf0b7b5d8c44bd7032c473f9878cfb59018161
2024-09-03 15:22:17 +00:00
Luke Dashjr
c979004062 QA: wallet_basic: Split wtx expected_fields over multiple lines to minimise merge conflicts 2024-09-03 15:22:03 +00:00
Luke Dashjr
06a4368d84 Ignore -rpcauthfile params if -norpcauth is used 2024-09-03 14:18:15 +00:00
Luke Dashjr
6e104095c2 QA: rpc_users: Add tests for rpcauthfile 2024-09-03 14:17:57 +00:00
Luke Dashjr
6bb3773aa6 Merge branch 'fix_rpcauth_blank' into rpcauthfile-28+knots 2024-09-03 13:53:22 +00:00
MarcoFalke
342baabaff
test: Avoid intermittent timeout in p2p_headers_sync_with_minchainwork.py
Github-Pull: #30761
Rebased-From: fa247e6e8c
2024-09-03 10:01:56 +01:00
Luke Dashjr
11e1e09759 Bugfix: RPC: blockchain: Actually include "temporary" flag in listprunelocks result 2024-09-03 04:37:32 +00:00
Luke Dashjr
aeb14e6f8e QA: Test prune locks via RPC 2024-09-03 04:32:06 +00:00
Luke Dashjr
64de1480d3 Move prune lock checking into BlockManager 2024-09-03 01:31:45 +00:00
Luke Dashjr
2f8aa8e5c0 QA: Test -uaappend 2024-09-03 01:24:37 +00:00
w0xlt
a42303b506 test: add test for dump human-readable dumptxoutset
Co-authored-by: Luke Dashjr <luke-jr+git@utopios.org>
Co-authored-by: brunoerg <brunoely.gc@gmail.com>
2024-09-03 01:14:37 +00:00
Luke Dashjr
a0d0807abc Refactor to avoid conflicts in new p2p permissions 2024-09-03 00:02:10 +00:00
Luke Dashjr
aa2885797e Include "blockfilters" in NetPermissions::ToStrings as appropriate 2024-09-03 00:02:10 +00:00
Luke Dashjr
a303cde2fd Allow acceptstalefeeestimates on all networks 2024-08-30 17:28:45 +00:00
Sebastian Falbesoner
5577d5a3c0
test: fix TestShell initialization (late follow-up for #30463)
Github-Pull: #30714
Rebased-From: bd7ce05f9d
2024-08-30 11:07:00 +01:00
merge-script
e53b1c1a4b
Merge bitcoin/bitcoin#30705: test: Avoid intermittent block download timeout in p2p_ibd_stalling
fa5b58ea01 test: Avoid intermittent block download timeout in p2p_ibd_stalling (MarcoFalke)

Pull request description:

  Fixes #30704

  The goal of the test is to check the stalling timeout, not the block download timeout.

  On extremely slow hardware (for example qemu virtual hardware), downloading the 1023 blocks may take longer than the block download timeout.

  Fix it by pinning the time using mocktime, and only advance it when testing the stalling timeout.

ACKs for top commit:
  tdb3:
    CR ACK fa5b58ea01
  brunoerg:
    utACK fa5b58ea01

Tree-SHA512: 9a9221f264bea52be5e9fe81fd319f5a6970cd315cc5e9f5e2e049c5d84619b19b9f6f075cda8d34565c2d6c17a88fb57e195c66c271e40f73119a77caecb6d7
2024-08-27 11:20:42 +01:00
Ava Chow
5116dd4b83
Merge bitcoin/bitcoin#30698: test: Add time-timewarp-attack boundary cases
31378d44f4 test: Add time-timewarp-attack boundary cases (Greg Sanders)

Pull request description:

  Basic addition to test case added in https://github.com/bitcoin/bitcoin/pull/30681

ACKs for top commit:
  fjahr:
    Code review ACK 31378d44f4
  achow101:
    ACK 31378d44f4
  tdb3:
    ACK 31378d44f4

Tree-SHA512: 7d18af9e7fac0ecb0fb5e4c009d6ce3f9af849b4abc54ae8cf681dc8b882aaa9b4cffd7f798b7193c76d89f96ec2cb6dbd13e341882d59b0580d3573ec675ffd
2024-08-26 14:44:33 -04:00
Ava Chow
d50f0ce248
Merge bitcoin/bitcoin#30669: test: XORed blocks test follow up
e1d5dd732d test: check xor.dat recreated when missing (tdb3)
d1610962bf test: add null block xor key (tdb3)
1ad999b9da refactor: lift NUM_XOR_BYTES (tdb3)
d8399584dd refactor: move read_xor_key() to TestNode (tdb3)
d43948c3ef refactor: use unlink rather than os.remove (tdb3)
c8176f758b test: add blocks_key_path (tdb3)

Pull request description:

  Builds on PR #30657.

  Refactors `read_xor_key()` from `util.py` to `test_node.py` (comment https://github.com/bitcoin/bitcoin/pull/30657#discussion_r1723358327)

  Adds a check that `xor.dat` is created when missing (comment https://github.com/bitcoin/bitcoin/pull/30657#discussion_r1717724161)

  Help states:
  ```
  -blocksxor
         Whether an XOR-key applies to blocksdir *.dat files. The created XOR-key
         will be zeros for an existing blocksdir or when `-blocksxor=0` is
         set, and random for a freshly initialized blocksdir. (default: 1)
  ```

ACKs for top commit:
  maflcko:
    ACK e1d5dd732d
  achow101:
    ACK e1d5dd732d
  theStack:
    re-ACK e1d5dd732d
  brunoerg:
    reACK e1d5dd732d

Tree-SHA512: 325912ef646ec88e0a58e1ece263a2b04cbc06497e8fe5fcd603e509e80c6bcf84b09dd52dfac60e23013f07fc2b2f6db851ed0598649c3593f452c4a1424bd9
2024-08-26 14:30:07 -04:00
tdb3
e1d5dd732d
test: check xor.dat recreated when missing 2024-08-25 08:43:45 -04:00
tdb3
d1610962bf
test: add null block xor key 2024-08-25 08:43:37 -04:00
tdb3
1ad999b9da
refactor: lift NUM_XOR_BYTES 2024-08-25 08:43:33 -04:00
tdb3
d8399584dd
refactor: move read_xor_key() to TestNode 2024-08-25 08:42:38 -04:00
tdb3
d43948c3ef
refactor: use unlink rather than os.remove 2024-08-25 08:41:21 -04:00
merge-script
d54fbc85c4
Merge bitcoin/bitcoin#30703: test: Avoid duplicate curl call in get_previous_releases.py
fa5aeab3cb test: Avoid duplicate curl call in get_previous_releases.py (MarcoFalke)

Pull request description:

  Seems odd having to translate `404` to "Binary tag was not found". Also, it seems odd to write a for-loop over a list with one item.

  Fix both issues by just using a single call to `curl --fail ...`.

  Can be tested with: `test/get_previous_releases.py -b v99.99.99`

  Before:

  ```
  Releases directory: releases
  Fetching: https://bitcoincore.org/bin/bitcoin-core-99.99.99/bitcoin-99.99.99-x86_64-linux-gnu.tar.gz
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
    0  286k    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
  Binary tag was not found
  ```

  After:

  ```
  Releases directory: releases
  Fetching: https://bitcoincore.org/bin/bitcoin-core-99.99.99/bitcoin-99.99.99-x86_64-linux-gnu.tar.gz
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
    0  286k    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
  curl: (22) The requested URL returned error: 404

ACKs for top commit:
  fanquake:
    ACK fa5aeab3cb
  brunoerg:
    utACK fa5aeab3cb
  tdb3:
    tested ACK fa5aeab3cb

Tree-SHA512: d5d31e0bccdd9de9b4a8ecf2e69348f4e8cee773050c8259b61db1ce5de73f6fbfffbe8c4d2571f7bef2de29cb42fd244573deebfbec614e487e76ef41681b9c
2024-08-24 16:24:23 +01:00
tdb3
c8176f758b
test: add blocks_key_path
Adds a convenience function to TestNode
to provide the path to the blocks xor key.
Updates util and feature_blocksxor to use it.
2024-08-23 12:49:56 -04:00
MarcoFalke
fa5b58ea01
test: Avoid intermittent block download timeout in p2p_ibd_stalling 2024-08-23 17:49:13 +02:00
merge-script
c81c6bf65b
Merge bitcoin/bitcoin#30665: test: Enable detect_leaks=1 in ASAN_OPTIONS explicitly
cccc5bfd35 test: Enable detect_leaks=1 in ASAN_OPTIONS explicitly (MarcoFalke)

Pull request description:

  It should be enabled by default, but being explicit can't hurt.

ACKs for top commit:
  fanquake:
    ACK cccc5bfd35

Tree-SHA512: ed284abd05c7a99c30b509844aa75785a5ccb506d8296a71347b4c328750a6a4ed1f87e7a3ec36ab17f27b467c033cc8ca5eb5e2b951f2ae7473327c5eb1ddae
2024-08-23 13:12:53 +01:00
MarcoFalke
fa5aeab3cb
test: Avoid duplicate curl call in get_previous_releases.py 2024-08-23 14:07:31 +02:00
Greg Sanders
31378d44f4 test: Add time-timewarp-attack boundary cases 2024-08-22 12:43:13 -04:00
Ava Chow
338b9d82dc
Merge bitcoin/bitcoin#30681: Have miner account for timewarp mitigation, activate on regtest, lower nPowTargetTimespan to 144 and add test
59ff17e5af miner: adjust clock to timewarp rule (Sjors Provoost)
e929054e12 Add timewarp attack mitigation test (Sjors Provoost)
e85f386c4b consensus: enable BIP94 on regtest (Sjors Provoost)
dd154b0568 consensus: lower regtest nPowTargetTimespan to 144 (Sjors Provoost)

Pull request description:

  Because #30647 reduced the timewarp attack threshold from 7200s to 600s, our miner code will fail to propose a block template (on testnet4) if the last block of the previous period has a timestamp two hours in the future. This PR fixes that and also adds a test.

  The non-test changes in the last commit should be in v28, otherwise miners have to patch it themselves. If necessary I can split that out into a separate PR, but I prefer to get the tests in as well.

  In order to add the test, we activate BIP94 on regtest.

  In order for the test to run faster, we reduce its difficulty retarget period to 144, the same number that's already used for softfork activation logic. Regtest does not actually adjust its difficulty, so this change has no effect (except for `getnetworkhashps`, see commit).

  An alternative approach would be to run this test on testnet4, by hardcoding its first 2015 in the test suite. But since the timewarp mitigation is a serious candidate for a future mainnet softfork, it seems better to just deploy it on regtest.

  The next commits add a test and fix the miner code.

  The `MAX_TIMEWARP` constant is moved to `consensus.h` so both validation and miner code have access to it.

ACKs for top commit:
  achow101:
    ACK 59ff17e5af
  fjahr:
    ACK 59ff17e5af
  glozow:
    ACK 59ff17e5af

Tree-SHA512: 50af9fdcba9b0d5c57e1efd5feffd870bd11b5318f1f8b0aabf684657f2d33ab108d5f00b1475fe0d38e8e0badc97249ef8dda20c7f47fcc1698bc1008798830
2024-08-22 12:15:19 -04:00
Ava Chow
bc87ad9854
Merge bitcoin/bitcoin#30636: test: assumeutxo: check that UTXO-querying RPCs operate on snapshot chainstate
917e70a620 test: assumeutxo: check that UTXO-querying RPCs operate on snapshot chainstate (Sebastian Falbesoner)

Pull request description:

  Inspired by some manual testing I did for #28553, this PR checks that RPCs which explicitly query the UTXO set database (i.e. `gettxoutsetinfo`, `scantxoutset` and `gettxout`) operate on the snapshot chainstate as expected.

ACKs for top commit:
  fjahr:
    utACK 917e70a620
  achow101:
    ACK 917e70a620
  tdb3:
    ACK 917e70a620

Tree-SHA512: 40ecd1c5dd879234df1667fa5444a1fbbee9b7c456f597dc982d1a2bce46fe9107711b005ab829e570ef919a4914792f72f342d71d92bad2ae9434b5e68d5bd3
2024-08-21 13:30:00 -04:00
Sjors Provoost
59ff17e5af
miner: adjust clock to timewarp rule 2024-08-20 18:51:37 +02:00
Sjors Provoost
e929054e12
Add timewarp attack mitigation test 2024-08-20 18:49:59 +02:00
Sebastian Falbesoner
917e70a620 test: assumeutxo: check that UTXO-querying RPCs operate on snapshot chainstate 2024-08-20 12:43:58 +02:00
Sjors Provoost
dd154b0568
consensus: lower regtest nPowTargetTimespan to 144
This currently has no effect due to fPowNoRetargeting,
except for the getnetworkhashps when called with -1.

It will when the next commit enforces the timewarp attack mitigation on regtest.
2024-08-20 10:07:30 +02:00
MarcoFalke
cccc5bfd35
test: Enable detect_leaks=1 in ASAN_OPTIONS explicitly 2024-08-16 15:31:54 +02:00
Sebastian Falbesoner
faa1b9b0e6 test: add functional test for XORed block/undo files (-blocksxor) 2024-08-14 17:38:28 +02:00
Sebastian Falbesoner
6b3676be3e test: refactor: move read_xor_key/util_xor helpers to util module 2024-08-14 16:43:46 +02:00
Ava Chow
ba5fdd1a68
Merge bitcoin/bitcoin#30607: contrib: support reading XORed blocks in linearize-data.py script
77ff0ec1f1 contrib: support reading XORed blocks in linearize-data.py script (Sebastian Falbesoner)

Pull request description:

  This PR is a small follow-up for #28052, adding support for the block linearization script to handle XORed blocksdir *.dat files. Note that if no xor.dat file exists, the XOR pattern is set to all-zeros, in order to still support blockdirs that have been created with versions earlier than 28.x.

  Partly fixes issue #30599.

ACKs for top commit:
  achow101:
    ACK 77ff0ec1f1
  tdb3:
    ACK 77ff0ec1f1
  hodlinator:
    ACK 77ff0ec1f1

Tree-SHA512: 011eb02e2411de373cbbf4b26db4640fc693a20be8c2430529fba6e36a3a3abfdfdc3b005d330f9ec2846bfad9bfbf34231c574ba99289ef37dd51a68e6e7f3d
2024-08-12 15:03:35 -04:00
glozow
b21ba081be
Merge bitcoin/bitcoin#30265: wallet: Fix listwalletdir listing of migrated default wallets and generated backup files
6b2dcba076 wallet: List sqlite wallets with empty string name (Ava Chow)
3ddbdd1815 wallet: Ignore .bak files when listing wallet files (Ava Chow)

Pull request description:

  When the default wallet is migrated, we do not rename the wallet so we end up having a descriptor wallet with the empty string as its name and the wallet.dat file in the root of the walletdir. This is supposed to be an unsupported configuration and there is no other way to achieve this (other than file copying), but the wallet loading code does not disallow loading such wallets. However `listwalletdir` does not currently list the default wallet if it is sqlite. This is confusing to users, so change `listwalletdir` to include these wallets.

  Additionally, the migration of the default wallet, and of any plain wallet files in the walletdir, produces a backup file in the walletdir itself. Since these backups are a BDB file, `listwalletdir` will detect them as being another wallet that we could open, but this is erroneous and could lead to confusion and potentially funds loss if both the backup and the migrated wallet are in use simultaneously. To reduce the likelihood of this issue, don't list these wallets in `listwalletdir`.

  ***

  Possibly we could have more stringent checks on loading to resolve these issues, but I'm concerned that that will just confuse users and gratuitously break things that already worked.

  Since the original intent was to disallow default wallets for sqlite/descriptors, a possible alternative would be to prevent people from loading such wallets and change migration to rename those wallets. However, given that this behavior with migrating default wallets has existed since default wallet migration was fixed, I think that making such a change would be confusing and break things for no good reason. Although perhaps we should still do the renaming.

  For the backups, we could also change loading to refuse to load any wallet named with `.bak` (or `.legacy.bak`) as such wallets can still be loaded by giving the path to them directly, which some users may do to "restore" the backup. However restricting what can be loaded based on filename seems a little heavyhanded. It wouldn't be funds loss though since the correct way to restore the backup is with `restorewallet`.

ACKs for top commit:
  fjahr:
    Code review ACK 6b2dcba076
  furszy:
    Code ACK  6b2dcba076
  glozow:
    ACK 6b2dcba076

Tree-SHA512: 0b033f6ed55830f8a054afea3fb2cf1fa82a94040053ebfaf123bda36c99f45d3f01a2aec4ed02fed9c61bb3d320b047ed892d7f6644b5a356a7bc5974b10cff
2024-08-12 15:58:07 +01:00
merge-script
37a6d7643c
Merge bitcoin/bitcoin#30553: lint: Find function calls in default arguments
fac7b7ff7f lint: Find function calls in default arguments (MarcoFalke)

Pull request description:

  This type of bug in the test code keeps biting back regularly, is hard to debug, and wastes review cycles: https://github.com/bitcoin/bitcoin/issues/30543#issuecomment-2259260024 .

  Fix all issues by catching it with a linter that checks for rule B008: https://docs.astral.sh/ruff/rules/function-call-in-default-argument/

  This also allows to drop the hand-written linter that checks for rule B006: https://docs.astral.sh/ruff/rules/mutable-argument-default/

ACKs for top commit:
  davidgumberg:
    reACK fac7b7ff7f

Tree-SHA512: a47a28a35ec9c81947cb8c3e625f1eb8c0d7e780a4d768491ef94b2beed43b9710bf6c1044da18c7fd677ea5576fb9077c7f77b4465033fedfdca9920c185bf7
2024-08-12 11:24:37 +01:00
MarcoFalke
fa04511e44
doc: Remove outdated nTx faking comment
This was fixed in commit b50554babd.

Also, address the typo nits from:

* https://github.com/bitcoin/bitcoin/pull/29370#discussion_r1531789314
* https://github.com/bitcoin/bitcoin/pull/30598#discussion_r1711982543
2024-08-10 17:04:54 +02:00
Ava Chow
9a696397e7
Merge bitcoin/bitcoin#30598: assumeutxo: Drop block height from metadata
00618e8745 assumeutxo: Drop block height from metadata (Fabian Jahr)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/30514 which has more context and shows how the issue can be reproduced. Since the value in question is removed, there is no test to add to reproduce anything.

  This is an alternative approach to #30516 with much of the [code being suggested there](https://github.com/bitcoin/bitcoin/pull/30516#discussion_r1689146902).

ACKs for top commit:
  maflcko:
    re-ACK 00618e8745 🎌
  achow101:
    ACK 00618e8745
  theStack:
    Code-review ACK 00618e8745
  ismaelsadeeq:
    Re-ACK 00618e8745
  mzumsande:
    ACK 00618e8745

Tree-SHA512: db9575247bae838ad7742a27a216faaf55bb11e022f9afdd05752bb09bbf9614717d0ad64304ff5722a16bf41d8dea888af544e4ae26dcaa528c1add0269a4a8
2024-08-09 16:20:00 -04:00
Ava Chow
6b2dcba076 wallet: List sqlite wallets with empty string name
Although it is not explicitly possible to create a default wallet with
descriptors, it is possible to migrate a default wallet and have it end
up being a default wallet with descriptors. These wallets should be
listed by ListDatabases so that it appears in wallet directory listings
to avoid user confusion.
2024-08-09 15:55:07 -04:00
Ava Chow
3ddbdd1815 wallet: Ignore .bak files when listing wallet files
Migration creates backup files in the wallet directory with .bak as the
extension. This pollutes the output of listwalletdir with backup files
that most users should not need to care about.
2024-08-09 15:55:07 -04:00
MarcoFalke
fac7b7ff7f
lint: Find function calls in default arguments 2024-08-09 08:11:16 +02:00
Fabian Jahr
00618e8745
assumeutxo: Drop block height from metadata
The Snapshot format version is updated to 2 to indicate this change.

Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2024-08-08 23:55:06 +02:00
Sebastian Falbesoner
77ff0ec1f1 contrib: support reading XORed blocks in linearize-data.py script
Partly fixes issue #30599.
2024-08-07 23:53:39 +02:00
Ava Chow
da083d4bbd
Merge bitcoin/bitcoin#29775: Testnet4 including PoW difficulty adjustment fix
6bfa26048d testnet: Add timewarp attack prevention for Testnet4 (Fabian Jahr)
0100907ca1 testnet: Add Testnet4 difficulty adjustment rules fix (Fabian Jahr)
74a04f9e7a testnet: Introduce Testnet4 (Fabian Jahr)

Pull request description:

  To supplement the [ongoing conceptual discussion about a testnet reset](https://groups.google.com/g/bitcoindev/c/9bL00vRj7OU/m/9yCPo3uUBwAJ) I have drafted a move to v4 including a fix to the difficulty adjustment mechanism, which was part of the motivation that started the discussion.

  Conceptual considerations:
  - The conceptual discussion about doing a testnet4 or softforking the fix into testnet3 is outside of the scope of this PR and I would ask reviewers to contribute their opinions on this on the ML instead. However, I am happy to adapt this PR to a softfork change on testnet3 if there is consensus for that instead.
  - The difficulty adjustment fix suggested here touches the `CalculateNextWorkRequired` function and uses the same logic used in `GetNextWorkRequired` to find the last previous block that was not mined with difficulty 1 under the exceptionf. An alternative fix briefly mentioned on the mailing list by Jameson Lopp would be to "restrict the special testnet minimum difficulty rule so that it can't be triggered on the block right before a difficulty retarget". That would also fix the issue but I find my suggestion here a bit more elegant.

ACKs for top commit:
  jsarenik:
    tACK 6bfa26048d
  achow101:
    ACK 6bfa26048d
  murchandamus:
    tACK 6bfa26048d

Tree-SHA512: 0b8b69a621406a944da5be551b863d065358ba94d85dd3b80d83c412660e230ee93b27316081fbee9b4851cc4ff8585db64c7dfa26cb5148ac835663f2712c3d
2024-08-07 13:05:04 -04:00
Ryan Ofsky
870447fd58
Merge bitcoin/bitcoin#30212: rename TransactionError:ALREADY_IN_CHAIN
e9de0a76b9 doc: release note for 30212 (willcl-ark)
87b1880525 rpc: clarify ALREADY_IN_CHAIN rpc errors (willcl-ark)

Pull request description:

  Closes: #19363

  Renaming this error improves clarity around the returned error both internally and externally when a transactions' outputs are already found in the utxo set (`TransactionError::ALREADY_IN_CHAIN -> TransactionError::ALREADY_IN_UTXO_SET`)

ACKs for top commit:
  tdb3:
    ACK e9de0a76b9
  ismaelsadeeq:
    ACK e9de0a76b9
  ryanofsky:
    Code review ACK e9de0a76b9.

Tree-SHA512: 7d2617200909790340951fe56a241448f9ce511900777cb2a712e8b9c0778a27d1f912b460f82335844224f1abb4322bc898ca076440959edade55c082a09237
2024-08-06 11:31:03 -04:00
Fabian Jahr
74a04f9e7a
testnet: Introduce Testnet4 2024-08-06 01:38:10 +02:00
Ava Chow
949b673472
Merge bitcoin/bitcoin#28052: blockstorage: XOR blocksdir *.dat files
fa895c7283 mingw: Document mode wbx workaround (MarcoFalke)
fa359255fe Add -blocksxor boolean option (MarcoFalke)
fa7f7ac040 Return XOR AutoFile from BlockManager::Open*File() (MarcoFalke)

Pull request description:

  Currently the *.dat files in the blocksdir store the data received from remote peers as-is. This may be problematic when a program other than Bitcoin Core tries to interpret them by accident. For example, an anti-virus program or other program may scan them and move them into quarantine, or delete them, or corrupt them. This may cause Bitcoin Core to fail a reorg, or fail to reply to block requests (via P2P, RPC, REST, ...).

  Fix this, similar to https://github.com/bitcoin/bitcoin/pull/6650, by rolling a random XOR pattern over the dat files when writing or reading them.

  Obviously this can only protect against programs that accidentally and unintentionally are trying to mess with the dat files. Any program that intentionally wants to mess with the dat files can still trivially do so.

  The XOR pattern is only applied when the blocksdir is freshly created, and there is an option to disable it (on creation), so that people can disable it, if needed.

ACKs for top commit:
  achow101:
    ACK fa895c7283
  TheCharlatan:
    Re-ACK fa895c7283
  hodlinator:
    ACK fa895c7283

Tree-SHA512: c92a6a717da83bc33a9b8671a779eeefde2c63b192362ba1d71e6535ee31d08e2802b74acc908345197de9daac6930e4771595ee25b09acd5a67f7ea34854720
2024-08-05 17:52:42 -04:00
Ava Chow
902dd14382
Merge bitcoin/bitcoin#30493: policy: enable full-rbf by default
590456e3f1 policy: enable full-rbf by default (Peter Todd)
195e98ea8e doc: add release notes for full-rbf (Peter Todd)

Pull request description:

  This pull request enables full rbf (mempool policy) by default. #28132 was closed recently with this [comment](https://github.com/bitcoin/bitcoin/pull/28132#issuecomment-2225369634).

  ---

  Rationale:

  - Full RBF config option was added in July 2022: https://github.com/bitcoin/bitcoin/pull/25353

  - It is used regularly: https://mempool.space/rbf#fullrbf

  - Most mining pools are using it: https://github.com/bitcoin/bitcoin/pull/28132#issuecomment-2059120917

ACKs for top commit:
  petertodd:
    ACK 590456e3f1
  instagibbs:
    reACK 590456e3f1
  glozow:
    reACK 590456e3f1
  achow101:
    ACK 590456e3f1
  ariard:
    tested ACK 590456e3
  murchandamus:
    reACK 590456e3f1

Tree-SHA512: 83fceef9961021687e6ff979041f89be0c616f7a49cc28a5d7edf7d8ad064fcb9c0e2af0c31f4f89867a9f6dff4e40ef8ad4dbd624e7d6a4e00ac1f1c1f66c7a
2024-08-05 16:10:46 -04:00
Ryan Ofsky
69df012e74
Merge bitcoin/bitcoin#30497: rpc: Return errors in loadtxoutset that currently go to logs
fa530ec543 rpc: Return precise loadtxoutset error messages (MarcoFalke)
faa5c86dbf refactor: Use untranslated error message in ActivateSnapshot (MarcoFalke)

Pull request description:

  The error messages should never happen in normal operation. However, if
  they do, they are helpful to return to the user to debug the issue. For
  example, to notice a truncated file.

  This fixes https://github.com/bitcoin/bitcoin/issues/28621

  Also includes a minor refactor commit.

ACKs for top commit:
  fjahr:
    Code review ACK fa530ec543
  ryanofsky:
    Code review ACK fa530ec543, just adjusting error messages a little since last review. (Thanks!)

Tree-SHA512: 224968c9b13d082ca2ed1f6a8fcc5f51ff16d6c96bd38c3679699505b54337b99cccaf7a8474391f6b11f9ccb101977b4e626898c1217eae95802e290cf105f1
2024-08-05 13:20:21 -04:00
willcl-ark
87b1880525
rpc: clarify ALREADY_IN_CHAIN rpc errors
When using `sendrawtransaction` the ALREADY_IN_CHAIN error help string
may be confusing.

Rename TransactionError::ALREADY_IN_CHAIN to
TransactionError::ALREADY_IN_UTXO_SET and update the rpc help string.

Remove backwards compatibility alias as no longer required.
2024-08-05 15:45:58 +01:00
merge-script
42326b0fa4
Merge bitcoin/bitcoin#30512: net: Log accepted connection after m_nodes.push_back; Fix intermittent test issue
fa3ea3b83c test: Fix intermittent issue in p2p_v2_misbehaving.py (MarcoFalke)
55555574d1 net: Log accepted connection after m_nodes.push_back (MarcoFalke)

Pull request description:

  Fix the two issues reported in https://github.com/bitcoin/bitcoin/pull/30468/files#r1688444784:

  * Delay a debug log line for consistency.
  * Fix an intermittent test issue.

  They are completely separate fixes, but both `net` related.

ACKs for top commit:
  0xB10C:
    Code Review ACK fa3ea3b83c
  stratospher:
    tested ACK fa3ea3b.

Tree-SHA512: cd6b6e164b317058a305a5c3e38c56c9a814a7469039e1143f1d7addfbc91b0a28506873356b373d97448b46cb6fbe94a1309df82e34c855540b241a09489e8b
2024-08-05 14:51:39 +01:00
merge-script
1afa3c84fc
Merge bitcoin/bitcoin#30562: PayToAnchor(P2A) followups
2a3a24296e test: check that P2A with witness data is still consensus-legal (Greg Sanders)
68bd86cd7c test: P2A is a destination type with an address (Greg Sanders)

Pull request description:

  Followups for https://github.com/bitcoin/bitcoin/pull/30352

  Suggestions taken:
  https://github.com/bitcoin/bitcoin/pull/30352#discussion_r1698542647
  https://github.com/bitcoin/bitcoin/pull/30352#discussion_r1698563426

ACKs for top commit:
  tdb3:
    ACK 2a3a24296e
  glozow:
    ACK 2a3a24296e
  theStack:
    ACK 2a3a24296e

Tree-SHA512: 5de865b2c300fa504dbdbd5879649a6fc328da052ad8bf9479e3fea0c49c516d824908a87523ec1fb30cc536bffe2e116dd523a9b66a07f81f93429e42879f14
2024-08-05 13:27:36 +01:00
Peter Todd
590456e3f1 policy: enable full-rbf by default
Enable full rbf (mempool policy) by default and update tests accordingly.
2024-08-02 20:22:20 +00:00
Sebastian Falbesoner
5e87f30f7c test: check that keyless P2A 'signing' via signrawtransactionwithkey succeeds 2024-08-02 20:13:07 +02:00