Commit Graph

6204 Commits

Author SHA1 Message Date
merge-script
0de63b8b46
Merge bitcoin/bitcoin#29849: Fix typos in subprocess.hpp
13f5391bbb Fix typos in `subprocess.hpp` (Hennadii Stepanov)

Pull request description:

  Resolves one item in the https://github.com/bitcoin/bitcoin/pull/28981#pullrequestreview-1991272752:
  >    - Remove linter exclusions and fix all issues.

  Based on upstream https://github.com/arun11299/cpp-subprocess/pull/101.

ACKs for top commit:
  fanquake:
    ACK 13f5391bbb

Tree-SHA512: 2ee27a5b7d1ba6f47a5148add155c918eadaaffb94a4b5dd3edea00e63440b87291c559361bf25a8db1567debff78cf7e9466dc34f14331ca1d426994837df93
2024-04-11 16:18:39 +02:00
glozow
bdb33ec519
Merge bitcoin/bitcoin#29735: AcceptMultipleTransactions: Fix workspace not being set as client_maxfeerate failure
4ba1d0b553 fuzz: Add coverage for client_maxfeerate (Greg Sanders)
91d7d8f22a AcceptMultipleTransactions: Fix workspace client_maxfeerate (Greg Sanders)
f3aa5bd5eb fill_mempool: assertions and docsctring update (Greg Sanders)
a3da63e8fe Move fill_mempool to util function (Greg Sanders)
73b68bd8b4 fill_mempool: remove subtest-specific comment (Greg Sanders)

Pull request description:

  Bug causes an `Assume()` failure due to the expectation that the individual result should be invalid when done over `submitpackage` via rpc.

  Bug introduced by https://github.com/bitcoin/bitcoin/pull/28950 , and I discovered it rebasing https://github.com/bitcoin/bitcoin/pull/28984 since it's easier to hit in that test scenario.

  Tests in place were only checking `AcceptSingleTransaction`-level checks due to package evaluation only triggering when minfee is too high for the parent transaction.

  Added test along with fix, moving the fill_mempool utility into a common area for re-use.

ACKs for top commit:
  glozow:
    reACK 4ba1d0b553
  theStack:
    ACK 4ba1d0b553
  ismaelsadeeq:
    re-ACK 4ba1d0b553  via [diff](4fe7d150eb..4ba1d0b553)

Tree-SHA512: 3729bdf7f25d04e232f173ccee04ddbb2afdaafa3d04292a01cecf58fb11b3b2bc133e8490277f1a67622b62d17929c242dc980f9bb647896beea4332ee35306
2024-04-11 14:46:52 +02:00
Hennadii Stepanov
13f5391bbb
Fix typos in subprocess.hpp 2024-04-11 14:03:37 +02:00
merge-script
0a9cfd1752
Merge bitcoin/bitcoin#28981: Replace Boost.Process with cpp-subprocess
d5a715536e build: remove boost::process dependency for building external signer support (Sebastian Falbesoner)
70434b1c44 external_signer: replace boost::process with cpp-subprocess (Sebastian Falbesoner)
cc8b9875b1 Add `cpp-subprocess` header-only library (Hennadii Stepanov)

Pull request description:

  Closes https://github.com/bitcoin/bitcoin/issues/24907.

  This PR is based on **theStack**'s [work](https://github.com/bitcoin/bitcoin/issues/24907#issuecomment-1466087049).

  The `subprocess.hpp` header has been sourced from the [upstream repo](https://github.com/arun11299/cpp-subprocess) with the only modification being the removal of convenience functions, which are not utilized in our codebase.

  Windows-related changes will be addressed in subsequent follow-ups.

ACKs for top commit:
  achow101:
    reACK d5a715536e
  Sjors:
    re-tACK d5a715536e
  theStack:
    Light re-ACK d5a715536e
  fanquake:
    ACK d5a715536e - with the expectation that this code is going to be maintained as our own. Next PRs should:

Tree-SHA512: d7fb6fecc3f5792496204190afb7d85b3e207b858fb1a75efe483c05260843b81b27d14b299323bb667c990e87a07197059afea3796cf218ed8b614086bd3611
2024-04-10 12:03:06 +02:00
Greg Sanders
91d7d8f22a AcceptMultipleTransactions: Fix workspace client_maxfeerate
If we do not set the Failure for the workspace when
there is a client_maxfeerate related error, we hit
an Assume() to the contrary. Properly set it.
2024-04-09 14:53:34 +02:00
Greg Sanders
f3aa5bd5eb fill_mempool: assertions and docsctring update 2024-04-09 14:53:34 +02:00
Greg Sanders
a3da63e8fe Move fill_mempool to util function 2024-04-09 14:47:39 +02:00
fanquake
f348ec7c2a
Merge bitcoin/bitcoin#29821: fuzz: Some test/fuzz/test_runner.py improvements
47cedee776 fuzz: Introduce `BITCOINFUZZ` environment variable (Hennadii Stepanov)
1573e9a11e fuzz, refactor: Deduplicate fuzz binary path creation (Hennadii Stepanov)

Pull request description:

  These changes are split from https://github.com/bitcoin/bitcoin/pull/29774 and can be beneficial on their own.

  The new `BITCOINFUZZ` environment variable complements the already existing set of variables used by tests: b5d21182e5/test/functional/test_framework/test_framework.py (L238-L243)

ACKs for top commit:
  maflcko:
    lgtm ACK 47cedee776
  davidgumberg:
    utACK 47cedee776

Tree-SHA512: 45809cfd13dc4a45c44cc433184352e84726cb95bea80fd8f581c59a0b8b0a5495260ff66922f9c57c38adbdbdd102439238f370fd49d6ea27a241a5e6249895
2024-04-09 10:58:16 +02:00
fanquake
a160a6a081
Merge bitcoin/bitcoin#29498: test: Update --tmpdir doc string to say directory must not exist
d4e36ae80d test: Update --tmpdir doc string to say directory must not exist (kevkevin)

Pull request description:

  The error message given if passing an existing dir to --tmpdir is confusing so this makes it clear that the directory must not already exist

  This change is motivated by this comment https://github.com/bitcoin/bitcoin/pull/29335#issuecomment-1960913020

ACKs for top commit:
  maflcko:
    lgtm ACK d4e36ae80d
  davidgumberg:
    ACK d4e36ae80d

Tree-SHA512: fb31fd079767abbf94076615817943f35f5c9262fc97e65c631a18d33b3a343fe6a2d151613256e632d2b372ab2de0435f4712309b4a77ed3c663fd93a7dcdd1
2024-04-09 09:43:28 +02:00
Greg Sanders
73b68bd8b4 fill_mempool: remove subtest-specific comment 2024-04-08 15:05:07 +02:00
fanquake
f0794cbd40
Merge bitcoin/bitcoin#29822: test: remove immediate tx relay workaround in wallet_groups.py
93fae5ae7c test: remove immediate tx relay workaround in wallet_groups.py (Sebastian Falbesoner)

Pull request description:

  Reverts commit ab4efad51b (PR #26970). This workaround is not needed anymore, as since #27114 the test sets the noban permission for both in- and outbound connections via the `noban_tx_relay` setting, and we don't have to rely on this topology hack anymore. See commit c985eb854c (kudos to brunoerg!).

  Can be tested by executing `$ time ./test/functional/wallet_groups.py` both on master and PR and verifying that the execution time is roughly equal.

ACKs for top commit:
  maflcko:
    lgtm ACK 93fae5ae7c
  brunoerg:
    utACK 93fae5ae7c

Tree-SHA512: b949fd05b4308815ba02d0ee4d1318f642b930288dd03223f46db7db745177af1c070bc7058743ac27963c5ad90564089867cc12f31fee94812a16919c353bab
2024-04-07 10:50:17 +01:00
fanquake
03e94f8b90
Merge bitcoin/bitcoin#29791: test: Bump timeouts in feature_index_prune and wallet_importdescriptors
49c0b8b228 test: Bump timeouts in feature_index_prune and wallet_importdescriptors (Christopher Bergqvist)

Pull request description:

  Timeout issues where encountered when running functional tests with `--jobs=16 --extended`.

  Note that running `--extended` without `--jobs=16` does not trigger the issues.

  Tested under NixOS on a Xeon CPU with 16 logical cores.

  (A few tests are skipped locally as I haven't enabled BPF and a few other things).

  ## Measurements

  Line in `feature_index_prune.py` took 101.6s, 96.6s, 103.0s across 3 runs on my machine.
  Default limit is 60, suggested to increase limit to 150 seconds.

  Line in the `wallet_importdescriptors.py --descriptors` took 5.4s, 5.7s, 6.0s across 3 runs.
  Suggested to increase from 5 to 10 seconds.

  ## Logs

  Output slightly modified by separate change that lets code run past given timeouts and the provides more information - "Took 101.6 seconds to complete, 69.4% over the given limit.".

  <details>
  <summary>
  Click to expand.
  </summary>

  ### feature_index_prune.py
  ```
  52/305 - feature_index_prune.py failed, Duration: 250 s

  stdout:
  2024-04-01T22:25:24.010000Z TestFramework (INFO): PRNG seed is: 990421162716295219
  2024-04-01T22:25:24.014000Z TestFramework (INFO): Initializing test directory /mnt/tmp/test_runner_₿_🏃_20240402_002516/feature_index_prune_302
  2024-04-01T22:25:24.913000Z TestFramework (INFO): check if we can access blockfilters and coinstats when pruning is enabled but no blocks are actually pruned
  2024-04-01T22:26:48.417000Z TestFramework (INFO): prune some blocks
  2024-04-01T22:26:48.460000Z TestFramework (INFO): check if we can access the tips blockfilter and coinstats when we have pruned some blocks
  2024-04-01T22:26:48.483000Z TestFramework (INFO): check if we can access the blockfilter and coinstats of a pruned block
  2024-04-01T22:26:59.175000Z TestFramework (INFO): make sure trying to access the indices throws errors
  2024-04-01T22:27:50.422000Z TestFramework (INFO): prune exactly up to the indices best blocks while the indices are disabled
  2024-04-01T22:27:52.596000Z TestFramework (INFO): make sure that we can continue with the partially synced indices after having pruned up to the index height
  2024-04-01T22:29:34.242000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: '''
          self.wait_until(lambda: self.nodes[1].getindexinfo() == expected_stats)#, timeout=150)
  '''
  2024-04-01T22:29:34.244000Z TestFramework (ERROR): Assertion failed
  Traceback (most recent call last):
    File "/home/chris/Documents/Code/bitcoin-core/test/functional/test_framework/test_framework.py", line 132, in main
      self.run_test()
    File "/home/chris/Documents/Code/bitcoin-core/test/functional/feature_index_prune.py", line 117, in run_test
      self.sync_index(height=1500)
    File "/home/chris/Documents/Code/bitcoin-core/test/functional/feature_index_prune.py", line 34, in sync_index
      self.wait_until(lambda: self.nodes[1].getindexinfo() == expected_stats)#, timeout=150)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/chris/Documents/Code/bitcoin-core/test/functional/test_framework/test_framework.py", line 780, in wait_until
      return wait_until_helper_internal(test_function, timeout=timeout, timeout_factor=self.options.timeout_factor)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/chris/Documents/Code/bitcoin-core/test/functional/test_framework/util.py", line 305, in wait_until_helper_internal
      raise AssertionError(m)
  AssertionError: Predicate '''
          self.wait_until(lambda: self.nodes[1].getindexinfo() == expected_stats)#, timeout=150)
  ''' not true after 60 seconds. Took 101.6 seconds to complete, 69.4% over the given limit.
  2024-04-01T22:29:34.298000Z TestFramework (INFO): Stopping nodes
  2024-04-01T22:29:34.511000Z TestFramework (WARNING): Not cleaning up dir /mnt/tmp/test_runner_₿_🏃_20240402_002516/feature_index_prune_302
  2024-04-01T22:29:34.511000Z TestFramework (ERROR): Test failed. Test logging available at /mnt/tmp/test_runner_₿_🏃_20240402_002516/feature_index_prune_302/test_framework.log
  2024-04-01T22:29:34.511000Z TestFramework (ERROR):
  2024-04-01T22:29:34.512000Z TestFramework (ERROR): Hint: Call /home/chris/Documents/Code/bitcoin-core/test/functional/combine_logs.py '/mnt/tmp/test_runner_₿_🏃_20240402_002516/feature_index_prune_302' to consolidate all logs
  2024-04-01T22:29:34.512000Z TestFramework (ERROR):
  2024-04-01T22:29:34.512000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
  2024-04-01T22:29:34.512000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
  2024-04-01T22:29:34.512000Z TestFramework (ERROR):

  stderr:

  53/305 - p2p_blockfilters.py passed, Duration: 130 s
  ```

  ### wallet_importdescriptors.py --descriptors

  ```
  297/305 - wallet_importdescriptors.py --descriptors failed, Duration: 76 s

  stdout:
  2024-04-01T22:48:27.663000Z TestFramework (INFO): PRNG seed is: 8528678505617325332
  2024-04-01T22:48:27.664000Z TestFramework (INFO): Initializing test directory /mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98
  2024-04-01T22:48:28.021000Z TestFramework (INFO): Setting up wallets
  2024-04-01T22:48:28.100000Z TestFramework (INFO): Mining coins
  2024-04-01T22:48:29.714000Z TestFramework (INFO): Import should fail if a descriptor is not provided
  2024-04-01T22:48:29.725000Z TestFramework (INFO): Should import a p2pkh descriptor
  2024-04-01T22:48:29.740000Z TestFramework (INFO): Test can import same descriptor with public key twice
  2024-04-01T22:48:29.760000Z TestFramework (INFO): Test can update descriptor label
  2024-04-01T22:48:29.785000Z TestFramework (INFO): Internal addresses cannot have labels
  2024-04-01T22:48:29.788000Z TestFramework (INFO): Internal addresses should be detected as such
  2024-04-01T22:48:29.854000Z TestFramework (INFO): Should not import a p2sh-p2wpkh descriptor without checksum
  2024-04-01T22:48:29.855000Z TestFramework (INFO): Should not import a p2sh-p2wpkh descriptor that has range specified
  2024-04-01T22:48:29.858000Z TestFramework (INFO): Should not import a p2sh-p2wpkh descriptor and have it set to active
  2024-04-01T22:48:29.860000Z TestFramework (INFO): Should import a (non-active) p2sh-p2wpkh descriptor
  2024-04-01T22:48:29.984000Z TestFramework (INFO): Should import a 1-of-2 bare multisig from descriptor
  2024-04-01T22:48:30.002000Z TestFramework (INFO): Should not treat individual keys from the imported bare multisig as watchonly
  2024-04-01T22:48:30.005000Z TestFramework (INFO): Ranged descriptors cannot have labels
  2024-04-01T22:48:30.014000Z TestFramework (INFO): Private keys required for private keys enabled wallet
  2024-04-01T22:48:30.027000Z TestFramework (INFO): Ranged descriptor import should warn without a specified range
  2024-04-01T22:48:30.065000Z TestFramework (INFO): Should not import a ranged descriptor that includes xpriv into a watch-only wallet
  2024-04-01T22:48:30.070000Z TestFramework (INFO): Should not import a descriptor with hardened derivations when private keys are disabled
  2024-04-01T22:48:30.108000Z TestFramework (INFO): Verify we can only extend descriptor's range
  2024-04-01T22:48:30.364000Z TestFramework (INFO): Check we can change descriptor internal flag
  2024-04-01T22:48:30.536000Z TestFramework (INFO): Key ranges should be imported in order
  2024-04-01T22:48:30.708000Z TestFramework (INFO): Check we can change next_index
  2024-04-01T22:48:30.838000Z TestFramework (INFO): Check imported descriptors are not active by default
  2024-04-01T22:48:30.870000Z TestFramework (INFO): Check can activate inactive descriptor
  2024-04-01T22:48:30.903000Z TestFramework (INFO): Check can deactivate active descriptor
  2024-04-01T22:48:30.924000Z TestFramework (INFO): Verify activation state is persistent
  2024-04-01T22:48:30.973000Z TestFramework (INFO): Should import a descriptor with a WIF private key as spendable
  2024-04-01T22:48:30.987000Z TestFramework (INFO): Test can import same descriptor with private key twice
  2024-04-01T22:48:32.173000Z TestFramework (INFO): Test that multisigs can be imported, signed for, and getnewaddress'd
  2024-04-01T22:48:43.803000Z TestFramework (INFO): Multisig with distributed keys
  2024-04-01T22:48:48.895000Z TestFramework (INFO): We can create and use a huge multisig under P2WSH
  2024-04-01T22:49:05.628000Z TestFramework (INFO): Under P2SH, multisig are standard with up to 15 compressed keys
  2024-04-01T22:49:20.258000Z TestFramework (INFO): Amending multisig with new private keys
  2024-04-01T22:49:23.306000Z TestFramework (INFO): Combo descriptors cannot be active
  2024-04-01T22:49:23.313000Z TestFramework (INFO): Descriptors with no type cannot be active
  2024-04-01T22:49:23.348000Z TestFramework (INFO): Test importing a descriptor to an encrypted wallet
  2024-04-01T22:49:43.957000Z TestFramework (ERROR): Assertion failed
  Traceback (most recent call last):
    File "/home/chris/Documents/Code/bitcoin-core/test/functional/test_framework/test_framework.py", line 132, in main
      self.run_test()
    File "/home/chris/Documents/Code/bitcoin-core/test/functional/wallet_importdescriptors.py", line 691, in run_test
      with self.nodes[0].assert_debug_log(expected_msgs=["Rescan started from block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206... (slow variant inspecting all blocks)"], timeout=5):#10):
    File "/nix/store/rac8pxbi1vapwrlqzbrkycbyg521djzw-python3-3.11.6/lib/python3.11/contextlib.py", line 144, in __exit__
      next(self.gen)
    File "/home/chris/Documents/Code/bitcoin-core/test/functional/test_framework/test_node.py", line 493, in assert_debug_log
      self._raise_assertion_error(f'Expected messages "{expected_msgs}" found too late, took {now - start:.1f} seconds, {((now - start) / (time_end - start)) - 1:.1%} over the given limit. Log:\n\n{print_log}\n\n')
    File "/home/chris/Documents/Code/bitcoin-core/test/functional/test_framework/test_node.py", line 188, in _raise_assertion_error
      raise AssertionError(self._node_msg(msg))
  AssertionError: [node 0] Expected messages "['Rescan started from block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206... (slow variant inspecting all blocks)']" found too late, took 5.4 seconds, 8.9% over the given limit. Log:

   - 2024-04-01T22:49:33.066512Z [http] [httpserver.cpp:306] [http_request_cb] [http] Received a POST request for /wallet/encrypted_wallet from 127.0.0.1:47658
   - 2024-04-01T22:49:33.066668Z [httpworker.0] [rpc/request.cpp:187] [parse] [rpc] ThreadRPCServer method=importdescriptors user=__cookie__
   - 2024-04-01T22:49:33.070999Z [httpworker.0] [wallet/sqlite.cpp:57] [TraceSqlCallback] [/mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98/node0/regtest/wallets/encrypted_wallet/wallet.dat] SQLite Statement: INSERT INTO main VALUES(?, ?)
   - 2024-04-01T22:49:33.071061Z [httpworker.0] [wallet/sqlite.cpp:57] [TraceSqlCallback] [/mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98/node0/regtest/wallets/encrypted_wallet/wallet.dat] SQLite Statement: DELETE FROM main WHERE key = ?
   - 2024-04-01T22:49:33.071137Z [httpworker.0] [wallet/sqlite.cpp:57] [TraceSqlCallback] [/mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98/node0/regtest/wallets/encrypted_wallet/wallet.dat] SQLite Statement: BEGIN TRANSACTION
   - 2024-04-01T22:49:33.074190Z [httpworker.0] [wallet/sqlite.cpp:57] [TraceSqlCallback] [/mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98/node0/regtest/wallets/encrypted_wallet/wallet.dat] SQLite Statement: INSERT or REPLACE into main values(?, ?)
   - 2024-04-01T22:49:33.075564Z [httpworker.0] [wallet/sqlite.cpp:57] [TraceSqlCallback] [/mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98/node0/regtest/wallets/encrypted_wallet/wallet.dat] SQLite Statement: INSERT or REPLACE into main values(?, ?)
  ...<thousands of almost identical lines>...
   - 2024-04-01T22:49:38.416139Z [httpworker.0] [wallet/sqlite.cpp:57] [TraceSqlCallback] [/mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98/node0/regtest/wallets/encrypted_wallet/wallet.dat] SQLite Statement: INSERT or REPLACE into main values(?, ?)
   - 2024-04-01T22:49:38.416528Z [httpworker.0] [wallet/sqlite.cpp:57] [TraceSqlCallback] [/mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98/node0/regtest/wallets/encrypted_wallet/wallet.dat] SQLite Statement: INSERT or REPLACE into main values(?, ?)
   - 2024-04-01T22:49:38.427946Z [httpworker.0] [wallet/sqlite.cpp:57] [TraceSqlCallback] [/mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98/node0/regtest/wallets/encrypted_wallet/wallet.dat] SQLite Statement: COMMIT TRANSACTION
   - 2024-04-01T22:49:38.429778Z [httpworker.0] [wallet/sqlite.cpp:57] [TraceSqlCallback] [/mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98/node0/regtest/wallets/encrypted_wallet/wallet.dat] SQLite Statement: INSERT or REPLACE into main values(?, ?)
   - 2024-04-01T22:49:38.429916Z [httpworker.0] [wallet/sqlite.cpp:57] [TraceSqlCallback] [/mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98/node0/regtest/wallets/encrypted_wallet/wallet.dat] SQLite Statement: INSERT or REPLACE into main values(?, ?)
   - 2024-04-01T22:49:38.430001Z [httpworker.0] [wallet/wallet.h:933] [WalletLogPrintf] [encrypted_wallet] Setting spkMan to active: id = c6149b35399517457b0b1d8ccdd7efda25a2f20fc7f8167adda8e79b10e260b7, type = legacy, internal = false
   - 2024-04-01T22:49:38.430134Z [httpworker.0] [wallet/wallet.h:933] [WalletLogPrintf] [encrypted_wallet] RescanFromTime: Rescanning last 329 blocks
   - 2024-04-01T22:49:38.430170Z [httpworker.0] [wallet/wallet.h:933] [WalletLogPrintf] [encrypted_wallet] Rescan started from block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206... (slow variant inspecting all blocks)
   - 2024-04-01T22:49:38.441914Z [httpworker.0] [wallet/scriptpubkeyman.h:258] [WalletLogPrintf] [encrypted_wallet] MarkUnusedAddresses: Detected a used keypool item at index 4000, mark all keypool items up to this item as used

  2024-04-01T22:49:44.029000Z TestFramework (INFO): Stopping nodes
  2024-04-01T22:49:44.132000Z TestFramework (WARNING): Not cleaning up dir /mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98
  2024-04-01T22:49:44.132000Z TestFramework (ERROR): Test failed. Test logging available at /mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98/test_framework.log
  2024-04-01T22:49:44.132000Z TestFramework (ERROR):
  2024-04-01T22:49:44.133000Z TestFramework (ERROR): Hint: Call /home/chris/Documents/Code/bitcoin-core/test/functional/combine_logs.py '/mnt/tmp/test_runner_₿_🏃_20240402_004231/wallet_importdescriptors_98' to consolidate all logs
  2024-04-01T22:49:44.133000Z TestFramework (ERROR):
  2024-04-01T22:49:44.133000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
  2024-04-01T22:49:44.133000Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
  2024-04-01T22:49:44.133000Z TestFramework (ERROR):

  stderr:

  Remaining jobs: [feature_pruning.py, feature_dbcrash.py, feature_assumeutxo.py, rpc_scantxoutset.py, feature_coinstatsindex.py, p2p_node_network_limited.py --v1transport, p2p_node_network_limited.py --v2transport, feature_config_args.py]
  298/305 - p2p_node_network_limited.py --v1transport passed, Duration: 24 s
  ```

  </details>

  ## Related

  Almost identical timeout in `feature_index_prune.py` in #27091 on MacOS, and for `wallet_importdescriptors.py --descriptors` in #27282 on Alpine & CI.

ACKs for top commit:
  maflcko:
    lgtm ACK 49c0b8b228
  tdb3:
    ACK for 49c0b8b228
  itornaza:
    approach ACK 49c0b8b228
  BrandonOdiwuor:
    crACK 49c0b8b228

Tree-SHA512: f62ade74701588d76bfe838b7e7bbda1db38fd98688fd5d13c2c008064027add2ee9d053dee602d84919fab4c9bf53183c31819d94a6174066f237d0f6a62086
2024-04-07 10:38:59 +01:00
Sebastian Falbesoner
93fae5ae7c test: remove immediate tx relay workaround in wallet_groups.py
Reverts commit ab4efad51b (PR #26970).
This workaround is not needed anymore, as since #27114 the test sets
the noban permission for both in- and outbound connections via the
`noban_tx_relay` setting, and we don't have to rely on these topology
hacks anymore. See commit c985eb854c.
2024-04-06 18:30:09 +02:00
Hennadii Stepanov
47cedee776
fuzz: Introduce BITCOINFUZZ environment variable
The `BITCOINFUZZ` environment variable allows to override the default
path to the fuzz binary.

It complements the already existing set of variables used by tests:
 - BITCOIND
 - BITCOINCLI
 - BITCOINUTIL
 - BITCOINWALLET
2024-04-06 16:06:52 +01:00
Hennadii Stepanov
1573e9a11e
fuzz, refactor: Deduplicate fuzz binary path creation 2024-04-06 16:03:39 +01:00
Christopher Bergqvist
49c0b8b228
test: Bump timeouts in feature_index_prune and wallet_importdescriptors
Timeout issues where encountered when running functional tests with `--jobs=16 --extended`.

Line in `feature_index_prune.py` took 101.6s, 96.6s, 103.0s across 3 runs on my machine, default limit is 60.

Line in the `wallet_importdescriptors.py --descriptors` took 5.4s, 5.7s, 6.0s across 3 runs.
2024-04-02 17:49:48 +02:00
fanquake
1d8a5f0d9b
Merge bitcoin/bitcoin#29750: test: makes timeout a forced named argument in tests methods that use it
61560d5e93 test: makes timeout a forced named argument in tests methods that use it (Sergi Delgado Segura)

Pull request description:

  This makes calls to such methods more explicit and less error-prone.

  Motivated by https://github.com/bitcoin/bitcoin/pull/29736#discussion_r1540654057

ACKs for top commit:
  maflcko:
    lgtm ACK 61560d5e93
  brunoerg:
    ACK 61560d5e93
  BrandonOdiwuor:
    crACK 61560d5e93
  AngusP:
    ACK 61560d5e93
  stratospher:
    tested ACK 61560d5.

Tree-SHA512: 8d6ec3fe1076c868ddbd3050f3c242dbd83cc123f560db3d3b0ed74968e6050dc9ebf4e7c716af9cc1b290c97d736c2fc2ac936b0b69ebdbceed934dae7d55d9
2024-04-02 11:06:35 +01:00
fanquake
23ba39470c
Merge bitcoin/bitcoin#29753: test: fix StopIteration exception in p2p_node_network_limited.py
2eb5175de8 test: fix StopIteration exception in p2p_node_network_limited.py (furszy)

Pull request description:

  Fixes #29731

  The `next()` call throws an exception if the default parameter is omitted and the iterator is exhausted.
  Fix it by providing a default value.

  The failure can be tested by commenting out lines 90 and 91 in the test (the `self.connect_nodes(2, 0)`). Since there is no connection, the node in question retrieves a single element in the 'getchaintips()' call. This scenario without the fix, aborts the test right away, throwing an `StopIteration` exception, and with the fix, the test properly waits until the timeout (`wait_until()` call).

ACKs for top commit:
  maflcko:
    review ACK 2eb5175de8
  brunoerg:
    crACK 2eb5175de8
  BrandonOdiwuor:
    crACK 2eb5175de8
  tdb3:
    Tested ACK for 2eb5175de8.

Tree-SHA512: b0873eb4d3334146fd250cd2cd23add3e744877033c8bfa4eb8dff36633100604adf49dd7846856ddfa88c9768663f095db705c00eef3641618df8fc13f8c2c5
2024-04-01 18:59:42 +02:00
fanquake
8d19d688f4
Merge bitcoin/bitcoin#29738: doc: fix typos
601edd8ee8 ci: use codespell 2.2.6 (fanquake)
52fa0d285f doc: fix some typos (crazeteam)
b5ed13a240 doc: Fix typos (RoboSchmied)

Pull request description:

  Combines the recent PRs to fix typos so they can be merged.

ACKs for top commit:
  brunoerg:
    crACK 601edd8ee8
  tdb3:
    crACK 601edd8ee8
  kristapsk:
    cr utACK 601edd8ee8

Tree-SHA512: d054b1dad1336d6b9291cc5d5252d4debf6424a993d4edd6a97d7c15055a7fc48a333d30967f72e7dc9c6c1d9a9038ca8bb5e219c529f4c2365ea48404a508d0
2024-04-01 15:54:45 +02:00
Ryan Ofsky
4373414d26
Merge bitcoin/bitcoin#29130: wallet: Add createwalletdescriptor and gethdkeys RPCs for adding new automatically generated descriptors
746b6d8839 test: Add test for createwalletdescriptor (Ava Chow)
2402b63062 wallet: Test upgrade of pre-taproot wallet to have tr() descriptors (Ava Chow)
460ae1bf67 wallet, rpc: Add createwalletdescriptor RPC (Ava Chow)
8e1a475062 wallet: Be able to retrieve single key from descriptors (Ava Chow)
85b1fb19dd wallet: Add GetActiveHDPubKeys to retrieve xpubs from active descriptors (Ava Chow)
73926f2d31 wallet, descspkm: Refactor wallet descriptor generation to standalone func (Andrew Chow)
54e74f46ea wallet: Refactor function for single DescSPKM setup (Andrew Chow)
3b09d0eb7f tests: Test for gethdkeys (Ava Chow)
5febe28c9e wallet, rpc: Add gethdkeys RPC (Ava Chow)
66632e5c24 wallet: Add IsActiveScriptPubKeyMan (Ava Chow)
fa6a259985 desc spkm: Add functions to retrieve specific private keys (Ava Chow)
fe67841464 descriptor: Be able to get the pubkeys involved in a descriptor (Ava Chow)
ef6745879d key: Add constructor for CExtKey that takes CExtPubKey and CKey (Ava Chow)

Pull request description:

  This PR adds a `createwalletdescriptor` RPC which allows users to add new automatically generated descriptors to their wallet, e.g. to upgrade a 0.21.x wallet to contain a taproot descriptor. This RPC takes 3 arguments: the output type to create a descriptor for, whether the descriptor will be internal or external, and the HD key to use if the user wishes to use a specific key. The HD key is an optional parameter. If it is not specified, the wallet will use the key shared by the active descriptors, if they are all single key. For most users in the expected upgrade scenario, this should be sufficient. In more advanced cases, the user must specify the HD key to use.

  Currently, specified HD keys must already exist in the wallet. To make it easier for the user to know, `gethdkeys` is also added to list out the HD keys in use by all of the descriptors in the wallet. This will include all HD keys, whether we have the private key, for it, which descriptors use it and their activeness, and optionally the extended private key. In this way, users with more complex wallets will be still be able to get HD keys from their wallet for use in other scenarios, and if they want to use `createwalletdescriptor`, they can easily get the keys that they can specify to it.

  See also https://github.com/bitcoin/bitcoin/pull/26728#issuecomment-1866961865

ACKs for top commit:
  Sjors:
    re-utACK 746b6d8839
  furszy:
    ACK 746b6d8
  ryanofsky:
    Code review ACK 746b6d8839, and this looks ready to merge. There were various suggested changes since last review where main change seems to be switching `gethdkeys` output to use normalized descriptors (removing hardened path components).

Tree-SHA512: f2849101e6fbf1f59cb031eaaaee97af5b1ae92aaab54c5716940d210f08ab4fc952df2725b636596cd5747b8f5beb1a7a533425bc10d09da02659473516fbda
2024-03-29 06:39:57 -04:00
furszy
2eb5175de8
test: fix StopIteration exception in p2p_node_network_limited.py
The `next()` call throws an exception if the default parameter is omitted and the iterator is exhausted.
Fix it by providing a default value.

The failure can be tested by commenting out lines 90 and 91 in the test (the `self.connect_nodes(2, 0)``).
Since there is no connection, the node in question retrieves a single element in the 'getchaintips()' call.
This scenario without the fix, aborts the test right away, throwing an StopIteration exception, and with
the fix, the test properly waits until the timeout (wait_until() call).
2024-03-27 16:37:36 -03:00
Ryan Ofsky
c8e3978114
Merge bitcoin/bitcoin#27307: wallet: track mempool conflicts with wallet transactions
5952292133 wallet, rpc: show mempool conflicts in `gettransaction` result (ishaanam)
54e07ee22f wallet: track mempool conflicts (ishaanam)
d64922b590 wallet refactor: use CWalletTx member functions to determine tx state (ishaanam)
ffe5ff1fb6 scripted-diff: wallet: s/TxStateConflicted/TxStateBlockConflicted (ishaanam)
180973a941 test: Add tests for wallet mempool conflicts (ishaanam)

Pull request description:

  The `mempool_conflicts` variable is added to `CWalletTx`, it is a set of txids of txs in the mempool conflicting with the wallet tx or a wallet tx's parent. This PR only changes how mempool-conflicted txs are dealt with in memory.

  `IsSpent` now returns false for an output being spent by a mempool conflicted transaction where it previously returned true.

  A txid is added to `mempool_conflicts` during  `transactionAddedToMempool`. A txid is removed from `mempool_conflicts` during  `transactionRemovedFromMempool`.

  This PR also adds a `mempoolconflicts` field to the `gettransaction` wallet RPC result.

  Builds on #27145
  Second attempt at #18600

ACKs for top commit:
  achow101:
    ACK 5952292133
  ryanofsky:
    Code review ACK 5952292133. Just small suggested changes since last review
  furszy:
    ACK 59522921

Tree-SHA512: 615779606723dbb6c2e302681d8e58ae2052ffee52d721ee0389746ddbbcf4b4c4afacf01ddf42b6405bc6f883520524186a955bf6b628fe9b3ae54cffc56a29
2024-03-27 12:45:08 -04:00
Sergi Delgado Segura
61560d5e93 test: makes timeout a forced named argument in tests methods that use it
This makes calls to such methods more explicit and less error prone
2024-03-27 15:33:07 +01:00
Sebastian Falbesoner
70434b1c44
external_signer: replace boost::process with cpp-subprocess
This primarily affects the `RunCommandParseJSON` utility function.
2024-03-27 14:16:37 +00:00
Hennadii Stepanov
cc8b9875b1
Add cpp-subprocess header-only library
Upstream repo: https://github.com/arun11299/cpp-subprocess
Commit: 4025693decacaceb9420efedbf4967a04cb028e7

The "Convenience Functions" section is unused in our codebase, so it has
been removed.
2024-03-27 14:16:32 +00:00
fanquake
28f2ca675f
Merge bitcoin/bitcoin#29479: test: Refactor subtree exclusion in lint tests
80fa7da21c test: Refactor subtree exclusion in lint tests (Brandon Odiwuor)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/issues/17413

  Refactor subtree exclusion in lint tests to one place

  Second attempt after PR: https://github.com/bitcoin/bitcoin/pull/24435

ACKs for top commit:
  fjahr:
    re-ACK 80fa7da21c
  maflcko:
    lgtm ACK 80fa7da21c
  davidgumberg:
    ACK 80fa7da21c

Tree-SHA512: deff7457dd19ca5ea440d3d53feae047e8863b9ddeb6494a3c94605a5d16edc91db8f99a435b4fab2ef89aedee42439562be006da647fb85bbf3def903a3ce50
2024-03-27 11:40:18 +00:00
crazeteam
52fa0d285f
doc: fix some typos
Signed-off-by: crazeteam <lilujing@outlook.com>
2024-03-26 16:51:46 +00:00
Brandon Odiwuor
80fa7da21c test: Refactor subtree exclusion in lint tests 2024-03-26 13:49:47 +03:00
Ava Chow
b44f9e4645
Merge bitcoin/bitcoin#28928: test: add coverage for bech32m in wallet_keypool_topup
a8bfc3dea1 test: add coverage for bech32m in `wallet_keypool_topup` (brunoerg)

Pull request description:

  0dcac51049 added coverage for all keypool addresses types in `wallet_keypool_topup` (4y ago). Now we have bech23m, so this PR adds it.

ACKs for top commit:
  achow101:
    ACK a8bfc3dea1
  marcofleon:
    ACK a8bfc3dea1. Definitely a more straightfoward addition to the test. Reviewed the code, built the PR branch and ran all functional tests without issues.
  furszy:
    utACK a8bfc3dea

Tree-SHA512: aa830b723a7a54b23744f9fb3cf5214452c4ffc8e3bbe0e8bd980bdf902e61c3dd2fd57361b82c5c0c5224aa0774158daf34b6b2188edda0a971f82111976051
2024-03-25 17:49:02 -04:00
fanquake
2e1c84b333
Merge bitcoin/bitcoin#29660: lint: Fix COMMIT_RANGE issues
fa1146d01b lint: Fix COMMIT_RANGE issues (MarcoFalke)

Pull request description:

  `COMMIT_RANGE` has problems on forks or local branches:

  * When `LOCAL_BRANCH` is set, it assumes the presence of a `master` branch, and that the `master` branch is up-to-date. Both of which may be false. (See also discussion in https://github.com/bitcoin/bitcoin/pull/29274#discussion_r1504226422)
  * When `COMMIT_RANGE` isn't set in `lint-git-commit-check.py`, and `--prev-commits` isn't set either, it has the same (broken) assumptions.

  Fix all issues by simply assuming a merge commit exists. This allows to drop `LOCAL_BRANCH`. It also allows to drop `SKIP_EMPTY_NOT_A_PR`, because scripts will already skip an empty range. Finally, it allows to drop `--prev-commits n`, because one can simply say `COMMIT_RANGE='HEAD~n..HEAD'` to achieve the same.

ACKs for top commit:
  Sjors:
    tACK fa1146d01b

Tree-SHA512: f1477a38267fd4fdb8d396211a5d6bed5f418798c7edaba43487957aaf726cd45244ccf15187b3dd896d398fa1df3fe0a37323e49cf44d60a2018786ed41e5ba
2024-03-25 14:41:05 +00:00
0xb10c
89b84ea91a
test: check that addrman seeding is successful
The addpeeraddress calls can fail due to collisions. As we are using a
deteministic addrman, they won't fail with the current bucket/position
calculation. However, if the calculation is changed, they might collide
and fail silently causing tests using `seed_addrman()` to fail.

Assert that the addpeeraddress calls are successful.
2024-03-23 15:33:38 +01:00
Ava Chow
c1223188e0
Merge bitcoin/bitcoin#29672: validation: Make translations of fatal errors consistent
824f47294a node: Use log levels in noui_ThreadSafeMessageBox (TheCharlatan)
ddc7872c08 node: Make translations of fatal errors consistent (TheCharlatan)

Pull request description:

  The extra `bilingual_str` argument of the fatal error notifications and `node::AbortNode()` is often unused and when used usually contains the same string as the message argument. It also seems to be confusing, since it is not consistently used for errors requiring user action. For example some assumeutxo fatal errors require the user to do something, but are not translated.

  So simplify the fatal error and abort node interfaces by only passing a translated string. This slightly changes the fatal errors displayed to the user.

ACKs for top commit:
  stickies-v:
    re-ACK 824f47294a
  maflcko:
    ACK 824f47294a 🔎
  achow101:
    ACK 824f47294a
  hebasto:
    re-ACK 824f47294a.

Tree-SHA512: 2868ee7b045fe7f3ac582ce5039141b398480b7627734976201dafaaef7544b8461635a7292fee4a7f32ff1bfc26f9bd4d0c292dca424ba42fb7fc4483d7ce8d
2024-03-22 14:50:58 -04:00
Ava Chow
2795e89cc5
Merge bitcoin/bitcoin#28998: rpc: "addpeeraddress tried" return error on failure
99954f914f test: fix test to ensure hidden RPC is present in detailed help (stratospher)
0d01f6f0c6 test: remove unused mocktime in test_addpeeraddress (0xb10c)
6205466512 rpc: "addpeeraddress tried" return error on failure (0xb10c)

Pull request description:

  When trying to add an address to the IP address manager tried table, it's first added to the new table and then moved to the tried table. Previously, adding a conflicting address to the address manager's tried table with test-only `addpeeraddress tried=true` RPC would return `{ "success": true }`. However, the address would not be added to the tried table, but would remain in the new table. This caused, e.g., issue #28964.

  This is fixed by new returning `{ "success":  false, "error": "..." }` for failed tried table additions. Since the address remaining in the new table can't be removed (the address manager interface does not support removing addresses at the moment and adding this seems to be a bigger effort), an error message is returned. This indicates to a user why the RPC failed and allows accounting for the extra address in the new table. This is done in the functional test for the `getrawaddrman` RPC.

  Fixes #28964

ACKs for top commit:
  achow101:
    ACK 99954f914f
  stratospher:
    reACK 99954f9. 🚀
  brunoerg:
    utACK 99954f914f

Tree-SHA512: 2f1299410c0582ebc2071271ba789a8abed905f9a510821f77afbcf2a555ec31397578ea55cbcd162fb828be27afedd3246c7b13ad8883f2f745bb8e04364a76
2024-03-22 14:14:30 -04:00
stickies-v
032a597482
test: make p2p_handshake robust against timeoffset warnings
The test requires that limited nodes are not peered with  when
the node's system time exceeds ~ 24h of the node's chaintip
timestamp, as per PeerManagerImpl::GetDesirableServiceFlags.

By patching this test to modify the timestamp of the chaintip as
opposed to mocking the node's system time, we make it resilient
to future commits where the node raises a warning if it detects
its system time is too much out of sync with its outbound peers.

See https://github.com/bitcoin/bitcoin/pull/29623
2024-03-22 14:36:52 +00:00
MarcoFalke
fa1146d01b
lint: Fix COMMIT_RANGE issues 2024-03-21 20:15:08 +01:00
TheCharlatan
ddc7872c08
node: Make translations of fatal errors consistent
The extra `bilingual_str` argument of the fatal error notifications and
`node::AbortNode()` is often unused and when used usually contains the
same string as the message argument. It also seems to be confusing,
since it is not consistently used for errors requiring user action. For
example some assumeutxo fatal errors require the user to do something,
but are not translated.

So simplify the fatal error and abort node interfaces by only passing a
translated string. This slightly changes the fatal errors displayed to
the user.

Also de-duplicate the abort error log since it is repeated in noui.cpp.
2024-03-21 16:40:22 +01:00
Ava Chow
746b6d8839 test: Add test for createwalletdescriptor 2024-03-20 16:15:43 -04:00
Ava Chow
2402b63062 wallet: Test upgrade of pre-taproot wallet to have tr() descriptors 2024-03-20 16:15:43 -04:00
Ava Chow
3b09d0eb7f tests: Test for gethdkeys 2024-03-20 16:15:43 -04:00
ishaanam
5952292133 wallet, rpc: show mempool conflicts in gettransaction result 2024-03-20 15:05:37 -04:00
ishaanam
54e07ee22f wallet: track mempool conflicts
Behavior changes are:
- if a tx has a mempool conflict, the wallet will not attempt to
  rebroadcast it
- if a txo is spent by a mempool-conflicted tx, that txo is no
  longer considered spent
2024-03-20 15:05:34 -04:00
Ava Chow
b50554babd
Merge bitcoin/bitcoin#29370: assumeutxo: Get rid of faked nTx and nChainTx values
9d9a7458a2 assumeutxo: Remove BLOCK_ASSUMED_VALID flag (Ryan Ofsky)
ef174e9ed2 test: assumeutxo snapshot block CheckBlockIndex crash test (Ryan Ofsky)
0391458d76 test: assumeutxo stale block CheckBlockIndex crash test (Ryan Ofsky)
ef29c8b662 assumeutxo: Get rid of faked nTx and nChainTx values (Ryan Ofsky)
9b97d5bbf9 doc: Improve comments describing setBlockIndexCandidates checks (Ryan Ofsky)
0fd915ee6b validation: Check GuessVerificationProgress is not called with disconnected block (Ryan Ofsky)
63e8fc912c ci: add getchaintxstats ubsan suppressions (Ryan Ofsky)
f252e687ec assumeutxo test: Add RPC test for fake nTx and nChainTx values (Ryan Ofsky)

Pull request description:

  The `PopulateAndValidateSnapshot` function introduced in f6e2da5fb7 from #19806 has been setting fake `nTx` and `nChainTx` values that can show up in RPC results (https://github.com/bitcoin/bitcoin/issues/29328) and make `CBlockIndex` state hard to reason about, because it is difficult to know whether the values are real or fake.

  Revert to previous behavior of setting `nTx` and `nChainTx` to 0 when the values are unknown, instead of faking them. Also drop no-longer needed `BLOCK_ASSUMED_VALID` flag.

  Dropping the faked values also fixes assert failures in the `CheckBlockIndex` `(pindex->nChainTx == pindex->nTx + prev_chain_tx)` check that could happen previously if forked or out-of-order blocks before the snapshot got submitted while the snapshot was being validated. The PR includes two commits adding tests for these failures and describing them in detail.

  Compatibility note: This change could cause new `-checkblockindex` failures if a snapshot was loaded by a previous version of Bitcoin Core and not fully validated, because fake `nTx` values will have been saved to the block index. It would be pretty easy to avoid these failures by adding some compatibility code to `LoadBlockIndex` and changing `nTx` values from 1 to 0 when they are fake (when `(pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_TRANSACTIONS`), but a little simpler not to worry about being compatible in this case.

ACKs for top commit:
  Sjors:
    re-ACK 9d9a7458a2
  achow101:
    ACK 9d9a7458a2
  mzumsande:
    Tested ACK 9d9a7458a2
  maflcko:
    ACK 9d9a7458a2 🎯

Tree-SHA512: b1e1e2731ec36be30d5f5914042517219378fc31486674030c29d9c7488ed83fb60ba7095600f469dc32f0d8ba79c49ff7706303006507654e1762f26ee416e0
2024-03-20 12:56:49 -04:00
Ava Chow
69ddee6f39
Merge bitcoin/bitcoin#27039: blockstorage: do not flush block to disk if it is already there
dfcef536d0 blockstorage: do not flush block to disk if it is already there (Matthew Zipkin)

Pull request description:

  Closes https://github.com/bitcoin/bitcoin/issues/2039

  When reindexing from flat-file block storage there is no need to write anything back to disk, since the block data is already there. This PR skips flushing to disk those blocks that already have a known position in the datastore. Skipping this means that users can write-protect the `blk` files on disk which may be useful for security or even safely sharing that data between multiple bitcoind instances.

  `FindBlockPos()` may also flush the undo data file, but again this is skipped if the corresponding block position is known, like during the initial stage of a reindex when block data is being indexed. Once the block index is complete the validation mechanism will call `ConnectBlock()` which will save undo data at that time.

  The call stack looks like this:

  ```
  init()
  ThreadImport() <-- process fReindex flag
  LoadExternalBlockFile()
  AcceptBlock()
  SaveBlockToDisk()
  FindBlockPos()
  FlushBlockFile() <-- unnecessary if block is already on disk
  ```

  A larger refactor of this part of the code was started by mzumsande here:  https://github.com/mzumsande/bitcoin/tree/202207_refactor_findblockpos including this fix, reviewers can let me know if the changes should be combined.

ACKs for top commit:
  sipa:
    utACK dfcef536d0
  mzumsande:
    re-ACK dfcef536d0
  achow101:
    ACK dfcef536d0
  furszy:
    Rebase diff ACK dfcef53.

Tree-SHA512: 385c5ac1288b325135398d0ddd3ab788fa98cc0ca19bd2474c74039f2ce70d5088c1d1c9d4dd10aefcbd4c757767ec5805d07ba8cee9289a66f96e6f9eaa5279
2024-03-20 12:41:33 -04:00
brunoerg
a8bfc3dea1 test: add coverage for bech32m in wallet_keypool_topup 2024-03-20 11:09:36 -03:00
glozow
3d216baf91
Merge bitcoin/bitcoin#29279: test: p2p: check disconnect due to lack of desirable service flags
2f23987849 test: p2p: check limited peers desirability (depending on best block depth) (Sebastian Falbesoner)
c4a67d396d test: p2p: check disconnect due to lack of desirable service flags (Sebastian Falbesoner)
405ac819af test: p2p: support disconnect waiting for `add_outbound_p2p_connection` (Sebastian Falbesoner)

Pull request description:

  This PR adds missing test coverage for disconnecting peers which don't offer the desirable service flags in their VERSION message:
  5f3a0574c4/src/net_processing.cpp (L3384-L3389)
  This check is relevant for the connection types "outbound-full-relay", "block-relay-only" and "addr-fetch" (see `CNode::ExpectServicesFromConn(...)`). Feeler connections always disconnect, which is also tested here.

  In lack of finding a proper file where this test would fit in, I created a new one. Happy to take suggestions there.

ACKs for top commit:
  davidgumberg:
    reACK 2f23987849
  itornaza:
    tested ACK 2f23987849
  fjahr:
    re-utACK 2f23987849
  cbergqvist:
    re ACK 2f23987849
  stratospher:
    tested ACK 2f23987. 🚀

Tree-SHA512: cf75d9d4379d0f34fa1e13152e6a8d93cd51b9573466ab3a2fec32dc3e1ac49b174bd1063cae558bc736b111c8a6e7058b1b57a496df56255221bf367d29eb5d
2024-03-19 17:22:04 +00:00
stratospher
99954f914f test: fix test to ensure hidden RPC is present in detailed help
current check to make sure that detailed help for hidden RPC
is displayed won't work because the assertion isn't sufficient.
Even if unknown RPCs are passed, RPC names would still be present
in node.help().
2024-03-19 17:41:57 +01:00
0xb10c
0d01f6f0c6
test: remove unused mocktime in test_addpeeraddress
Drops the mocktime added in fa4c6836c9.
Setting the mocktime in test_addpeeraddress() isn't needed
anymore as it doesn't leak into test_getrawaddrman() anymore
(since 2cc8ca19f4).

test_getrawaddrman() clear's the addrman and sets it's own
mocktime.
2024-03-19 17:38:36 +01:00
0xb10c
6205466512
rpc: "addpeeraddress tried" return error on failure
When trying to add an address to the IP address manager tried table,
it's first added to the new table and then moved to the tried table.
Previously, adding a conflicting address to the address manager's
tried table with test-only `addpeeraddress tried=true` RPC would
return `{ "success": true }`. However, the address would not be added
to the tried table, but would remain in the new table. This caused,
e.g., issue 28964.

This is fixed by returning `{ "success": false, "error":
"failed-adding-to-tried" }` for failed tried table additions. Since
the address remaining in the new table can't be removed (the address
manager interface does not support removing addresses at the moment
and adding this seems to be a bigger effort), an error message is
returned. This indicates to a user why the RPC failed and allows
accounting for the extra address in the new table.

Also:
To check the number of addresses in each addrman table,
the addrman checks were re-run and the log output of this check
was asserted. Ideally, logs shouldn't be used as an interface
in automated tests. To avoid asserting the logs, use the getaddrmaninfo
and getrawaddrman RPCs (which weren't implemented when the test was added).
Removing the "getnodeaddress" calls would also remove the addrman checks
from the test, which could reduce the test coverage. To avoid this,
these are kept.
2024-03-19 17:38:33 +01:00
fanquake
9f2609de09
Merge bitcoin/bitcoin#29639: test: fix intermittent failures with test=addrman
432a542e27 test: fix intermittent failures with test=addrman (Martin Zumsande)

Pull request description:

  The `nKey` of the addrman is generated the first time the node is started with an empty `peers.dat`. Therefore, restarting a node or turning it off and on again won't make a previously non-deterministic addrman deterministic.
  This could lead to intermittent failures in `feature_asmap.py` and `rpc_net.py`

  Fixes #29634

ACKs for top commit:
  kevkevinpal:
    ACK [432a542](432a542e27)
  stratospher:
    Tested ACK 432a542e27.
  brunoerg:
    crACK 432a542e27
  0xB10C:
    ACK 432a542e27

Tree-SHA512: a8e284baeb0be2df7284b8a2792cb9edc9e2d5b877a3b29ab7277ffdb75b17efa58a4d42576441eb493cd518e7c5ffdb05597b27e42b5001cf1a80e78bb04c83
2024-03-19 14:09:02 +00:00
glozow
5d045c31a5
Merge bitcoin/bitcoin#28950: RPC: Add maxfeerate and maxburnamount args to submitpackage
38f70ba6ac RPC: Add maxfeerate and maxburnamount args to submitpackage (Greg Sanders)

Pull request description:

  Resolves https://github.com/bitcoin/bitcoin/issues/28949

  I couldn't manage to do it very cleanly outside of (sub)package evaluation itself, since it would change the current interface very heavily. Instead I threaded through the max fee argument and used that directly via ATMPArgs. From that perspective, this is somewhat a reversion from https://github.com/bitcoin/bitcoin/pull/19339. In a post-cluster mempool world, these checks could be consolidated to right after the given (ancestor) package is linearized/chunked, by just checking the feerate of the top chunk and rejecting the submission entirely if the top chunk is too high.

  The implication here is that subpackages can be submitted to the mempool prior to hitting this new fee-based error condition.

ACKs for top commit:
  ismaelsadeeq:
    Re-ACK 38f70ba6ac 👍🏾
  glozow:
    ACK 38f70ba6ac with some non-blocking nits
  murchandamus:
    LGTM, code review ACK 38f70ba6ac

Tree-SHA512: 38212aa9de25730944cee58b0806a3d37097e42719af8dd7de91ce86bb5d9770b6f7c37354bf418bd8ba571c52947da1dcdbb968bf429dd1dbdf8715315af18f
2024-03-18 18:24:06 +00:00