Commit Graph

5123 Commits

Author SHA1 Message Date
w0xlt
f77f522f25 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-03-10 19:06:23 +00:00
Luke Dashjr
b83763a4d9 QA: Allow test_runner to pass without full RPC coverage 2024-03-10 18:59:23 +00:00
UdjinM6
40c56a4d13 test: make sure keypool sizes do not change on getrawchangeaddress/getnewaddress failures
Github-Pull: #29510
Rebased-From: e073f1dfda
2024-03-05 10:50:03 +00:00
Greg Sanders
b5419ce6b6 p2p: Don't consider blocks mutated if they don't connect to known prev block
Github-Pull: #29524
Rebased-From: a1fbde0ef7
2024-03-05 10:47:50 +00:00
dergoegge
0c5c5962cb [test] Add regression test for #27608
Github-Pull: #29412
Rebased-From: 5bf4f5ba32
2024-03-05 10:24:27 +00:00
Luke Dashjr
5efeaaa5ca Merge remote-tracking branch 'furszy/2023_rpc_getblockfileinfo' into rpc_getblockfileinfo-26+knots 2024-03-04 17:50:04 +00:00
Andrew Poelstra
8721d6f228 codex32: add functional test for seed import
Github-Pull: #27351
Rebased-From: 91771366a3df22b9e8b4b7152d368d739bfeda94
2024-03-04 17:48:21 +00:00
Luke Dashjr
023807a8cc Diff-minimise 2024-03-04 17:45:54 +00:00
Luke Dashjr
5c487b614e Merge remote-tracking branch 'furszy/2022_rpc_importaddress_descriptors_compatible' into rpc_importaddr_for_descwallet-26+k 2024-03-04 17:45:49 +00:00
Luke Dashjr
d29d7580b1 QA: wallet_reindex: Use importdescriptors directly rather than abusing test_framework's importaddress wrapper
`importdescriptors` is expected to initialise wallet birth time to "now", but `importaddress` initialises it to 1 instead.
2024-03-04 17:45:43 +00:00
Lawrence Nahum
1f433a86b7 add support to save fee estimates without shutting down the node 2024-03-04 17:39:26 +00:00
Roman Zeyde
2ee1991c7d 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).
2024-03-04 17:39:06 +00:00
Luke Dashjr
003720ebd5 Allow acceptstalefeeestimates on all networks 2024-03-04 17:26:48 +00:00
Martin Zumsande
255004a460 test: enable v2 transport for p2p_timeouts.py
by skipping the part where we send a non-version message
before the version - this message would be interpreted as
part of the v2 handshake.

Github-Pull: #28805
Rebased-From: 35fb9930ad
2024-03-04 17:20:58 +00:00
Sebastian Falbesoner
5f0f3f942c test: enable v2 transport for rpc_net.py
- "transport_protocol_type" of inbound peer before version handshake
  is "detecting" on p2p v2 nodes (as opposed to "v1" for p2p v1)
- size of a ping/pong message is 29 bytes (as opposed to 32 for p2p v1)
- for the sendmsgtopeer RPC sub-test, enforce p2p v1 connection to
  have a peer id of zero

Github-Pull: #28805
Rebased-From: 2c1669c37a
2024-03-04 17:20:58 +00:00
Luke Dashjr
1dc0afea1b test: enable v2 transport for p2p_node_network_limited.py
Github-Pull: #28805
Rebased-From: cc961c2695
2024-03-04 17:20:58 +00:00
Martin Zumsande
9d6c08ec30 test: enable --v2transport in combination with --usecli
By renaming the "command" send_cli arg. The old name was unsuitable
because the "addnode" RPC has its own "command" arg, leading to
ambiguity when included in kwargs.
Can be tested with
"python3 wallet_multiwallet.py --usecli --v2transport"
which fails on master because of this (python throws a TypeError).

Github-Pull: #28805
Rebased-From: 3598a1b5c9
2024-03-04 17:20:58 +00:00
Luke Dashjr
1d0a7a8198 test: persist -v2transport over restarts and respect -v2transport=0
Before, a global -v2transport provided to the test would be dropped
when restarting the node within a test and specifying any extra_args.

Fix this by adding "v2transport=1" to args (not extra_args) based
on the global parameter, and deciding for each (re)start of the node
based on this default and test-specific extra_args
(which take precedence over args) whether v2 should be used.

Github-Pull: #28805
Rebased-From: 68a9001751
2024-03-04 17:20:58 +00:00
Luke Dashjr
08647db809 Skip changing permissions entirely if -rpccookieperms=0 specified 2024-02-29 01:31:30 +00:00
Luke Dashjr
24ea5d9724 rpccookieperms: Allow setting setxid/sticky bits
Simply for backward compatibility
2024-02-29 01:31:30 +00:00
willcl-ark
c3bf4ef27d test: add rpccookieperms test
Tests various perms on non-Windows OSes

Github-Pull: #28167
Rebased-From: ce9df2aba3e98ba7f2a576d587ba8e59bf341083
2024-02-29 01:31:30 +00:00
Luke Dashjr
546e462f0a Merge branch 'rpcauthfile-26+knots' into rpccookieperms-26+knots 2024-02-29 01:31:16 +00:00
willcl-ark
cc3dd62493 init: don't delete PID file if it was not generated
Previously, starting a second bitcoind using the same datadir would
correctly fail to init and shutdown. However during shutdown the PID
file belonging to the first instance would be erroneously removed by
the second process shutting down.

Fix this to only delete the PID file if we created it.

Github-Pull: #28946
Rebased-From: 8f6ab31863
2024-02-29 01:10:10 +00:00
Luke Dashjr
44256fc2e9 net: Remove forcedinbound limit antifeature 2024-02-28 17:47:30 +00:00
Matthew Zipkin
9349155145 net: add forced_inbound to getpeerinfo
Github-Pull: #27600
Rebased-From: 8c2026848da910fdebff0a9f73e29f1f6ae81e43
2024-02-28 17:47:30 +00:00
Matthew Zipkin
07b24236a8 net: only allow 8 simultaneous forced inbound connections
Github-Pull: #27600
Rebased-From: 75868022a904c1f77871abf962bf9b88a9c5faf6
2024-02-28 17:47:30 +00:00
Matthew Zipkin
cee2e8c415 test: cover ForceInbound permission success even when connections are full
Github-Pull: #27600
Rebased-From: 6b6bcaf0b9ae0a7adaf96bf791aaafc6b5e9f000
2024-02-28 17:47:30 +00:00
brunoerg
f33cd8869d QA: p2p_invalid_messages: Check misbehaving with noban,out whitelisting
Github-Pull: #27114
Rebased-From: 1bae3b2ee6cb96c12fd7810c9362cfb7bdc165ad (partial)
2024-02-28 17:41:11 +00:00
brunoerg
8d290f4c57 test: add coverage for whitelisting manual connections
Github-Pull: #27114
Rebased-From: e6b8f19de9
2024-02-28 17:40:00 +00:00
Roman Zeyde
1e956439eb
rpc: keep .cookie if it was not generated
Otherwise, starting bitcoind twice may cause the `.cookie`
file generated by the first instance to be deleted by the
second instance shutdown (after failing to obtain a lock).

Github-Pull: bitcoin/bitcoin#28784
Rebased-From: 7cb9367157
2024-02-28 11:19:27 +01:00
Luke Dashjr
06aafaaa85 RPC/Wallet: Add "use_txids" to output of getaddressinfo
Github-Pull: #22693
Rebased-From: a00bc6f395
2024-02-21 15:58:47 +00:00
MarcoFalke
2d35cc3995 rpc: Fixed signed integer overflow for large feerates
Github-Pull: #29434
Rebased-From: fa2a4fdef7
2024-02-21 03:51:14 +00:00
Ava Chow
66d1d242a1 tests: Test that descriptors flag is set for migrated blank wallets
Github-Pull: #29367
Rebased-From: 3904123da9
2024-02-21 00:49:06 +00:00
Andrew Chow
c0560fccf3 tests: Test migration of blank wallets
Github-Pull: #28976
Rebased-From: c11c404281
2024-02-21 00:47:29 +00:00
Pieter Wuille
7caf2a8895 Make v2transport default for addnode RPC when enabled
Github-Pull: #29239
Rebased-From: 3ba815b42d
2024-01-27 16:05:56 +00:00
Torkel Rogstad
cfd1c957a5 rpc: validate conf_target is set alongside estimate_mode
Github-Pull: #29175
Rebased-From: be8ae64b82
2024-01-26 16:10:45 +00:00
Torkel Rogstad
b8e4d0a26a rpc: validate fee estimation mode case insensitive
Github-Pull: #29175
Rebased-From: 8d40addbd2
2024-01-26 16:10:44 +00:00
MarcoFalke
0aa26d600e test: Use blocks_path where possible
Github-Pull: #29262
Rebased-From: 5555d8db33
2024-01-24 03:44:58 +00:00
glozow
ac1b9a51db
[test] import descriptor wallet with reorged parent + IsFromMe child in mempool
Test that wallet rescans process transactions topologically, even if a
parent's entry into the mempool is later than that of its child.
This behavior is important because IsFromMe requires the ability to look
up a transaction's inputs.

Co-authored-by: furszy <matiasfurszyfer@protonmail.com>

Github-Pull: #29179
Rebased-From: df30247705
2024-01-19 16:13:22 +00:00
Gloria Zhao
ecb8ebc660
[test] rescan legacy wallet with reorged parent + IsFromMe child in mempool
Test that wallet rescans process transactions topologically, even if a
parent's entry into the mempool is later than that of its child.
This behavior is important because IsFromMe requires the ability to look
up a transaction's inputs.

Github-Pull: #29179
Rebased-From: c3d02be536
2024-01-19 16:13:14 +00:00
Luke Dashjr
026b25f99a Bugfix: QA/wallet_fundrawtransaction: Ensure segwit_inputs_only gets tested correctly
Co-authored-by: Aurèle Oulès <aurele@oules.com>
2024-01-04 22:25:57 +00:00
Aurèle Oulès
788a57d808 Witness-only option for fundrawtransaction
Github-Pull: #25183
Rebased-From: 1c5cfd84b3dc14ab886acd47c7891c11eb2457ec
2024-01-04 22:25:57 +00:00
furszy
b06b14e68d
rpc: getwalletinfo, return wallet 'birthtime'
And add coverage for it

Github-Pull: #28920
Rebased-From: 1ce45baed7
2024-01-04 16:21:37 +00:00
furszy
12834012c2
test: coverage for wallet birth time interaction with -reindex
Verifying the wallet updates the birth time accordingly when it
detects a transaction with a time older than the oldest descriptor
timestamp.
This could happen when the user blindly imports a descriptor with
'timestamp=now'.

Github-Pull: #28920
Rebased-From: 83c66444d0
2024-01-04 16:21:37 +00:00
Martin Zumsande
b15e2e2cec
test: add regression test for the getrawtransaction segfault
This fails on master without the previous commit.

Github-Pull: #29003
Rebased-From: 9075a44646
2024-01-04 16:21:36 +00:00
Luke Dashjr
f746c3a4b8 RPC/Wallet: Convert descriptorprocesspsbt to use options parameter 2023-12-30 22:05:18 +00:00
Andrew Chow
e5160731d2 RPC/Wallet: Convert walletprocesspsbt to use options parameter
Github-Pull: #24963
Rebased-From: f43f992b7318086859f710b920b4427e6c657fe8
2023-12-30 22:03:40 +00:00
Kashif Smith
f618887c1b test: fix node index bug when comparing peerinfo
Github-Pull: #28849
Rebased-From: 22e38080ea
2023-12-27 23:10:33 +00:00
Dan Benjamin
ea5e929be5 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
2023-12-27 03:45:52 +00:00
Luke Dashjr
64dbce8455 QA: wallet_basic: Split wtx expected_fields over multiple lines to minimise merge conflicts 2023-12-27 03:45:09 +00:00
Luke Dashjr
a5d6b7c948 Ignore -rpcauthfile params if -norpcauth is used 2023-12-26 22:36:25 +00:00
Luke Dashjr
c092aa83d8 QA: rpc_users: Add tests for rpcauthfile 2023-12-26 22:10:28 +00:00
Luke Dashjr
acd7eeefea Merge branch 'fix_rpcauth_blank' into rpcauthfile-26+knots 2023-12-26 22:10:20 +00:00
Luke Dashjr
6b79de4f9a QA: rpc_users: Test behaviour of -norpcauth 2023-12-26 21:55:08 +00:00
Luke Dashjr
415734ebaf QA: rpc_users: Test blank rpcauth in combination with non-blank 2023-12-23 18:48:02 +00:00
Luke Dashjr
f956108274 Bugfix: QA: When testing setfeerate, check approximate fee range with a span able to tolerate normal signature length variation 2023-12-23 17:25:29 +00:00
Jon Atack
309b6be8a1 test: add more functional tests for setfeerate
Was: test: update functional tests from settxfee to setfeerate

Github-Pull: #20391
Rebased-From: d87f0f3a923dca2ce8d99aa700b0beda8e42d3ec (partial)
2023-12-23 17:25:29 +00:00
Jon Atack
5030cae7c9 test: add setfeerate functional coverage in wallet_bumpfee.py
Github-Pull: #20391
Rebased-From: c907f158a6bf3cad782d4441e02abcbda210265b
2023-12-23 17:25:28 +00:00
Jon Atack
b8b150a865 test: add setfeerate functional coverage in wallet_create_tx.py
Github-Pull: #20391
Rebased-From: 529bfc16ffb35c5356e27f61d59395fae6707bcd
2023-12-23 17:25:28 +00:00
Luke Dashjr
31874a0aee Bugfix: RPC: blockchain: Actually include "temporary" flag in listprunelocks result 2023-12-21 21:49:47 +00:00
Luke Dashjr
ecbbb74626 QA: Test prune locks via RPC 2023-12-19 23:35:25 +00:00
Luke Dashjr
11f3bca5f0 Move prune lock checking into BlockManager 2023-12-19 23:35:24 +00:00
Luke Dashjr
ff459b5b55 Refactor to avoid conflicts in new p2p permissions 2023-11-25 00:06:56 +00:00
Luke Dashjr
fdcfa5ac36 Include "blockfilters" in NetPermissions::ToStrings as appropriate 2023-11-25 00:06:55 +00:00
Luke Dashjr
966644d79b QA: interface_rest: Check /mempool/info/with_fee_histogram matches RPC 2023-11-24 23:35:00 +00:00
Luke Dashjr
0bfca0cf32 Bugfix: RPC/blockchain: Actually round feerates down for getmempoolinfo fee histograms 2023-11-24 23:35:00 +00:00
Luke Dashjr
d53d29ce1b 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.
2023-11-24 23:35:00 +00:00
Luke Dashjr
5a10b9ec5e RPC/blockchain: getmempoolinfo: Return fee_histogram in older format (only) 2023-11-24 23:35:00 +00:00
Kiminuo
9caa0f7595 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
2023-11-24 23:35:00 +00:00
Luke Dashjr
e114acf9ef RPC/blockchain: getmempoolinfo: Enable specifying with_fee_histogram as a boolean to use a sensible default set of fee rate levels 2023-11-24 23:35:00 +00:00
Luke Dashjr
094e71f576 Bugfix: QA: Ensure mempool_fee_histogram can adapt to feerate rounding correctly
Caution: This implementation is for a post-#22949 codebase
2023-11-24 23:35:00 +00:00
Jonas Schnelli
6b1ec599d7 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>
2023-11-24 23:35:00 +00:00
Luke Dashjr
2def7cdf11 Merge remote-tracking branch 'origin-pull/21422/head' into fee_histogram+pr15836_api 2023-11-24 23:34:12 +00:00
Andrew Toth
74568a6d89 test: check for zmq block announcements with reorgs
Github-Pull: #26375
Rebased-From: 7b631dc9b1979afc99d9d1a3996492dcb415d3a3
2023-11-24 20:19:43 +00:00
Luke Dashjr
4d59d8bf48 RPC/Wallet: Hacky fix for getbalance bugs 2023-11-24 18:37:29 +00:00
Wladimir J. van der Laan
e2ac01c9ed http: Fail initialization when any bind fails
Currently the HTTP server initialization (`HTTPBindAddresses`) fails
only when *all* bindings fail. So if multiple binds are specified
(`127.0.0.1` and `::1` by defeault) and one succeeds and the other
fails, the latter is essentially ignored.

This commit changes the error behavior to fail *if not all* binds could
be performed, which I think is more in line with how software normally
handles this and what users expect.
2023-11-24 03:54:52 +00:00
pablomartin4btc
17415da9db gui: add validation to cli-side commmands
Add a validation for cli-side commands for the follwing cases:

* duplication of cli-command (and options: at the moment a user
  can specify -rpcwallet many times, only the last one will be
  taken into account,

* only 1 cli-command can run at a time (eg can't run -generate and
  -getinfo at the same time),

* no params starting with slash "-" will be accepted after a cli-command
  (this is the case for bitcoin-cli -generate 3 -rpcwallet=xyz).

Github-Pull: #26990
Rebased-From: 755320f75f2141909e84b62f420462c1c5b193e6
2023-11-09 23:01:58 +00:00
pablomartin4btc
efd7ea0f2e 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: bf48c40c0ee62eb6343f8aff06a88322a33f2dd6
2023-11-09 23:01:57 +00:00
pablomartin4btc
fe57abd7e9
test: add coverage for snapshot chainstate not matching AssumeUTXO parameters
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>

Github-Pull: #28698
Reabsed-From: 811067ca1c
2023-10-31 17:07:52 +00:00
fanquake
ab61087a7e
Merge bitcoin/bitcoin#28660: test: enable reindex readonly test on *BSD
5a0688a20d test: enable reindex readonly test on *BSD and macOS as root (Matthew Zipkin)

Pull request description:

  see https://github.com/bitcoin/bitcoin/pull/27850#discussion_r1349505585

  OpenBSD and FreeBSD don't have `chattr` but they do have `chflags`, use that method to make the block file immutable for the reindex_readonly test.

  Written and tested on a VPS running FreeBSD:
  ```
  FreeBSD freebsd-13-1 13.2-RELEASE-p4 FreeBSD 13.2-RELEASE-p4 GENERIC amd64
  ```

ACKs for top commit:
  maflcko:
    re-cr-lgtm-ACK 5a0688a20d
  jonatack:
    ACK 5a0688a20d tested on macOS only
  theStack:
    ACK 5a0688a20d

Tree-SHA512: 8c88d282d09c00355d22c4c504b779f60e420327a5e07bcf80fa77b97fefcb04952af9ceaf439d9033a0a2448cb26a02663fe6bddcd4a74792857cfbaf1c5162
2023-10-24 10:32:48 +01:00
Ryan Ofsky
d724bb5291
Merge bitcoin/bitcoin#28609: wallet: Reload watchonly and solvables wallets after migration
4814e4063e test: Check tx metadata is migrated to watchonly (Andrew Chow)
d616d30ea5 wallet: Reload watchonly and solvables wallets after migration (Andrew Chow)
118f2d7d70 wallet: Copy all tx metadata to watchonly wallet (Andrew Chow)
9af87cf348 test: Check that a failed wallet migration is cleaned up (Andrew Chow)

Pull request description:

  Some incomplete/incorrect state as a result of migration can be mitigated/cleaned up by simply restarting the migrated wallets. We already do this for a wallet when it is migrated, but we do not for the new watchonly and solvables wallets that may be created. This PR introduces this behavior, in addition to creating those wallets initially without an attached chain.

  While implementing this, I noticed that not all `CWalletTx` metadata was being copied over to the watchonly wallet and so some data, such as time received, was being lost. This PR fixes this as a side effect of not having a chain attached to the watchonly wallet. A test has also been added.

ACKs for top commit:
  ishaanam:
    light code review ACK 4814e4063e
  ryanofsky:
    Code review ACK 4814e4063e. Just implemented the suggested orderpos, copyfrom, and path set comments since last review
  furszy:
    ACK 4814e406

Tree-SHA512: 0b992430df9f452cb252c2212df8e876613f43564fcd1dc00c6c31fa497adb84dfff6b5ef597590f9b288c5f64cb455f108fcc9b6c9d1fe9eb2c39e7f2c12a89
2023-10-23 17:35:36 -04:00
Matthew Zipkin
5a0688a20d
test: enable reindex readonly test on *BSD and macOS as root 2023-10-23 10:58:54 -04:00
Fabian Jahr
cb0336817e
scripted-diff: Rename hash_serialized_2 to hash_serialized_3
-BEGIN VERIFY SCRIPT-
sed -i 's/hash_serialized_2/hash_serialized_3/g' $( git grep -l 'hash_serialized_2' ./src ./contrib ./test )
-END VERIFY SCRIPT-
2023-10-20 22:53:06 +02:00
Fabian Jahr
351370a1d2
coinstats: Fix hash_serialized2 calculation
The legacy serialization was vulnerable to maleation and is fixed by
adopting the same serialization procedure as was already in use for
MuHash.

This also includes necessary test fixes where the hash_serialized2 was
hardcoded as well as correction of the regtest chainparams.

Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
2023-10-20 22:53:05 +02:00
Fabian Jahr
d3223685b1
test: De-dublicate/optimize assumeutxo test for further extensions 2023-10-20 14:39:23 +02:00
Fabian Jahr
0a576d62fe
test: check au file with changed outpoint index 2023-10-20 14:39:21 +02:00
Andrew Chow
4814e4063e test: Check tx metadata is migrated to watchonly 2023-10-19 18:06:44 -04:00
Andrew Chow
d616d30ea5 wallet: Reload watchonly and solvables wallets after migration
When migrating, create the watchonly and solvables wallets without a
context. Then unload and reload them after migration completes, as we do
for the actual wallet.

There is also additional handling for a failed reload.
2023-10-19 18:06:43 -04:00
fanquake
091d29c495
Merge bitcoin/bitcoin#28617: test: Add Wallet Unlock Context Manager
004903ebad test: Add Wallet Unlock Context Manager (Brandon Odiwuor)

Pull request description:

  Fixes #28601, see https://github.com/bitcoin/bitcoin/pull/28403#discussion_r1325426430

  Add Context Manager to manage the locking and unlocking of locked wallets with a passphrase during testing.

ACKs for top commit:
  kevkevinpal:
    lgtm ACK [004903e](004903ebad)
  maflcko:
    lgtm ACK 004903ebad

Tree-SHA512: ab234c167e71531df0d974ff9a31d444f7ce2a1d05aba5ea868cc9452f139845eeb24ca058d88f058bc02482b762adf2d99e63a6640b872cc71a57a0068abfe8
2023-10-19 10:23:44 +01:00
fanquake
f4049eaf08
Merge bitcoin/bitcoin#28671: test: Fix failing time check in rpc_net.py
fa4c6836c9 test: Fix failing time check in rpc_net.py (MarcoFalke)

Pull request description:

  This check fails on slow runners, such as s390x qemu.

  Fix it by using mocktime.

  See https://github.com/bitcoin/bitcoin/pull/28523#discussion_r1357980527

ACKs for top commit:
  0xB10C:
    ACK fa4c6836c9
  pinheadmz:
    ACK fa4c6836c9
  brunoerg:
    crACK fa4c6836c9

Tree-SHA512: 83fb534682e11e97537dc89de8c16f206f38af1a892a2d5970c02684c05eaea8fc9adba3159f16b2440ca0b3871d513a0562a6f3a38f19a5574a47be0919e42f
2023-10-19 09:46:28 +01:00
furszy
5090771f32
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).
2023-10-18 11:12:15 -03:00
Ryan Ofsky
655dc716aa
Merge bitcoin/bitcoin#28666: test: assumeutxo file with unknown block hash
621db2f004 test: assumeutxo file with unknown block hash (Fabian Jahr)

Pull request description:

  Takes care of one of the open Todos in the assumeutxo functional test. Since an unknown block could be any hash, I simply chose one placeholder, it could also be a random string though.

ACKs for top commit:
  maflcko:
    lgtm ACK 621db2f004
  pablomartin4btc:
    cr ACK 621db2f004
  theStack:
    ACK 621db2f004
  ryanofsky:
    Code review ACK 621db2f004

Tree-SHA512: ee0438ce619f7348c6f88e39b0ea7ddddb8832956d9034ecc795c6033d5d905c09d11b7d0d5afc38231b2fd091ea7c1bd0a0be99d9c32c4e6357a25d76294142
2023-10-18 08:18:48 -04:00
MarcoFalke
fa4c6836c9
test: Fix failing time check in rpc_net.py 2023-10-18 10:35:08 +02:00
Andrew Chow
9af87cf348 test: Check that a failed wallet migration is cleaned up 2023-10-17 14:57:04 -04:00
Fabian Jahr
621db2f004
test: assumeutxo file with unknown block hash 2023-10-17 17:12:29 +02:00
MarcoFalke
fa68571566
test: Add assumeutxo test for wrong hash 2023-10-17 13:24:07 +02:00
fanquake
738ef44abb
Merge bitcoin/bitcoin#28652: assumeutxo: fail early if snapshot block hash doesn't match AssumeUTXO parameters
9620cb4493 assumeutxo: fail early if snapshot block hash doesn't match AssumeUTXO parameters (Sebastian Falbesoner)

Pull request description:

  Right now the `loadtxoutset` RPC call treats literally all files with a minimum size of 40 bytes (=size of metadata) as potential valid snapshot candidates and the waiting loop for seeing the metadata block hash in the headers chain is always entered, e.g.:
  ```
  $ ./src/bitcoin-cli loadtxoutset ~/.vimrc
  <wait>

  bitcoind log:
  ...
  2023-10-15T14:55:45Z [snapshot] waiting to see blockheader 626174207465730a7265626d756e207465730a656c62616e65207861746e7973 in headers chain before snapshot activation
  ...
  ```
  There is no point in doing any further action though if we already know from the start that the UTXO snapshot loading won't be successful. This PR adds an assumeutxo parameter check immediately after the metadata is read in, so we can fail immediately on a mismatch:
  ```
  $ ./src/bitcoin-cli loadtxoutset ~/.vimrc
  error code: -32603
  error message:
  Unable to load UTXO snapshot, assumeutxo block hash in snapshot metadata not recognized (626174207465730a7265626d756e207465730a656c62616e
  65207861746e7973)
  ```
  This way, users who mistakenly try to load files that are not snapshots don't have to wait 10 minutes (=the block header waiting timeout) anymore to get a negative response. If a file is loaded which is a valid snapshot (referencing to an existing block hash), but one which doesn't match the parameters, the feedback is also faster, as we don't have to wait anymore to see the hash in the headers chain before getting an error.

  This is also partially fixes #28621.

ACKs for top commit:
  maflcko:
    lgtm ACK 9620cb4493
  ryanofsky:
    Code review ACK 9620cb4493. This should fix an annoyance and bad UX.
  pablomartin4btc:
    tACK 9620cb4493

Tree-SHA512: f88b865e9d46254858e57c024463f389cd9d8760a7cb30c190aa1723a931e159987dfc2263a733825d700fa612e7416691e4d8aab64058f1aeb0a7fa9233ac9c
2023-10-17 10:20:08 +01:00
Luke Dashjr
cf1bda10ff Diff-minimise 2023-10-17 03:06:58 +00:00
Jameson Lopp
319e6c2bed Throw error if invalid parameters passed to getnetworkhashps RPC endpoint
Github-Pull: #28554
Rebased-From: 435ff29c5be0bd2ad2e89d9a37ecdb5da7c5d063
2023-10-17 03:06:52 +00:00
Sebastian Falbesoner
9620cb4493 assumeutxo: fail early if snapshot block hash doesn't match AssumeUTXO parameters 2023-10-16 17:20:59 +02:00