Commit graph

6697 commits

Author SHA1 Message Date
MarcoFalke
faf17df7fb
lint: Document missing py_lint dependency
Also, change the linter name, needed for the next commit.
2024-08-29 07:03:09 +02:00
MarcoFalke
faebeb828f
lint: Remove python whitespace and shadowing lint rules
The rules have many issues:

* Most are redundant, because Python already has a built-in
  IndentationError, a subclass of SyntaxError, to enforce whitespace.
* They are not enforced consistently anyway, see for examples [1][2]
  below.
* They are stylistic rules where the author intentionally formatted the
  code to be easier to read. Starting to enforce them now would make the
  code harder to read and create frustration in the future.

Fix all issues by removing them.

[1]:
test/functional/feature_cltv.py:63:35: E272 [*] Multiple spaces before keyword
   |
61 |         # | Script to prepend to scriptSig                  | nSequence  | nLockTime    |
62 |         # +-------------------------------------------------+------------+--------------+
63 |         [[OP_CHECKLOCKTIMEVERIFY],                            None,       None],
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E272

[2]:
contrib/asmap/asmap.py:395:13: E306 [*] Expected 1 blank line before a nested definition, found 0
    |
393 |             prefix.pop()
394 |             hole = not fill and (lhole or rhole)
395 |             def candidate(ctx: Optional[int], res0: Optional[list[ASNEntry]],
    |             ^^^ E306
2024-08-29 07:02:03 +02:00
MarcoFalke
7777047835
lint: Remove python lint rules that are SyntaxError
Any kind of syntax error is already reported, so there is no need to
enumerate all possible types of syntax errors of ancient versions of
Python 2 or 3.
2024-08-29 07:01:55 +02:00
MarcoFalke
faaf3e53f0
test: [refactor] Fix F841 flake8 2024-08-29 07:01:54 +02:00
MarcoFalke
444421db69
test: [refactor] Fix E714 pycodestyle 2024-08-29 07:00:27 +02:00
Lőrinc
837fbca036 Update spelling.ignore-words
Removed ba, inflight, keypair and warmup.
Added incomin found in optionsdialog.ui:345 and re-use found in utxo_snapshot.cpp
2024-08-28 18:42:19 +02:00
glozow
f93d5553d1
Merge bitcoin/bitcoin#22838: descriptors: Be able to specify change and receiving in a single descriptor string
a0abcbd382 doc: Mention multipath specifier (Ava Chow)
0019f61fc5 tests: Test importing of multipath descriptors (Ava Chow)
f97d5c137d wallet, rpc: Allow importdescriptors to import multipath descriptors (Ava Chow)
32dcbca3fb rpc: Allow importmulti to import multipath descriptors correctly (Ava Chow)
64dfe3ce4b wallet: Move internal to be per key when importing (Ava Chow)
1692245525 tests: Multipath descriptors for scantxoutset and deriveaddresses (Ava Chow)
cddc0ba9a9 rpc: Have deriveaddresses derive receiving and change (Ava Chow)
360456cd22 tests: Multipath descriptors for getdescriptorinfo (Ava Chow)
a90eee444c tests: Add unit tests for multipath descriptors (Ava Chow)
1bbf46e2da descriptors: Change Parse to return vector of descriptors (Ava Chow)
0d640c6f02 descriptors: Have ParseKeypath handle multipath specifiers (Ava Chow)
a5f39b1034 descriptors: Change ParseScript to return vector of descriptors (Ava Chow)
0d55deae15 descriptors: Add DescriptorImpl::Clone (Ava Chow)
7e86541f72 descriptors: Add PubkeyProvider::Clone (Ava Chow)

Pull request description:

  It is convenient to have a descriptor which specifies both receiving and change addresses in a single string. However, as discussed in https://github.com/bitcoin/bitcoin/issues/17190#issuecomment-895515768, it is not feasible to use a generic multipath specification like BIP 88 due to combinatorial blow up and that it would result in unexpected descriptors.

  To resolve that problem, this PR proposes a targeted solution which allows only a single pair of 2 derivation indexes to be inserted in the place of a single derivation index. So instead of two descriptor `wpkh(xpub.../0/0/*)` and `wpkh(xpub.../0/1/*)` to represent receive and change addresses, this could be written as `wpkh(xpub.../0/<0;1>/*)`. The multipath specifier is of the form `<NUM;NUM>`. Each `NUM` can have its own hardened specifier, e.g. `<0;1h>` is valid. The multipath specifier can also only appear in one path index in the derivation path.

  This results in the parser returning two descriptors. The first descriptor uses the first `NUM` in all pairs present, and the second uses the second `NUM`. In our implementation, if a multipath descriptor is not provided, a pair is still returned, but the second element is just `nullptr`.

  The wallet will not output the multipath descriptors (yet). Furthermore, when a multipath descriptor is imported, it is expanded to the two descriptors and each imported on its own, with the second descriptor being implicitly for internal (change) addresses. There is no change to how the wallet stores or outputs descriptors (yet).

  Note that the path specifier is different from what was proposed. It uses angle brackets and the semicolon because these are unused characters available in the character set and I wanted to avoid conflicts with characters already in use in descriptors.

  Closes #17190

ACKs for top commit:
  darosior:
    re-ACK a0abcbd382
  mjdietzx:
    reACK a0abcbd382
  pythcoiner:
    reACK a0abcbd
  furszy:
    Code review ACK a0abcbd
  glozow:
    light code review ACK a0abcbd382

Tree-SHA512: 84ea40b3fd1b762194acd021cae018c2f09b98e595f5e87de5c832c265cfe8a6d0bc4dae25785392fa90db0f6301ddf9aea787980a29c74f81d04b711ac446c2
2024-08-28 15:56:15 +01:00
merge-script
338bc2cd26
Merge bitcoin/bitcoin#30454: build: Introduce CMake-based build system
41051290ab cmake: Ignore build subdirectories within source directory (Hennadii Stepanov)
6ce50fd9d0 doc: Update for CMake-based build system (Hennadii Stepanov)
9730288a0c ci: Migrate CI scripts to CMake (Hennadii Stepanov)
c360837ca5 cmake, lint: Adjust `lint_includes_build_config` (Hennadii Stepanov)
3885441ee0 cmake: Add presets for native Windows builds (Hennadii Stepanov)
7681746b20 cmake: Add vcpkg manifest file (Hennadii Stepanov)
8b6f1c4353 cmake: Add `Coverage` and `CoverageFuzz` scripts (Hennadii Stepanov)
65bdbc1ff2 cmake: Add `docs` build target (Hennadii Stepanov)
fb75ebbc33 cmake: Add compiler diagnostic flags (Hennadii Stepanov)
e821f0a37a cmake: Migrate Guix build scripts to CMake (Hennadii Stepanov)
747adb6ffe cmake: Add `Maintenance` module (Hennadii Stepanov)
1f60b30df0 cmake: Add `APPEND_{CPP,C,CXX,LD}FLAGS` cache variables (Hennadii Stepanov)
2b43c45b13 cmake: Add `AddWindowsResources` module (Hennadii Stepanov)
973a3b0c5d cmake: Implement `install` build target (Hennadii Stepanov)
84ac35cfd4 cmake: Add cross-compiling support (Hennadii Stepanov)
0d01c228a7 build: Generate `toolchain.cmake` in depends (Hennadii Stepanov)
91a799247d depends: Add host-specific `cmake_system_version` variables (Hennadii Stepanov)
9b31209b4c depends: Rename `cmake_system` -> `cmake_system_name` (Hennadii Stepanov)
4a5208a81d Revert "build, qt: Do not install *.prl files" (Hennadii Stepanov)
6522af62af depends: Amend handling flags environment variables (Hennadii Stepanov)
90cec4d251 cmake: Add `MULTIPROCESS` option (Hennadii Stepanov)
bb1a450dcb cmake: Build `bitcoin-chainstate` executable (Hennadii Stepanov)
aed38ea58c cmake: Build `bitcoinkernel` library (Hennadii Stepanov)
975d67369b cmake: Build `test_bitcoin-qt` executable (Hennadii Stepanov)
10fcc668a3 cmake: Add `WITH_DBUS` option (Hennadii Stepanov)
5bb5a4bc75 cmake: Add `libqrencode` optional package support (Hennadii Stepanov)
57a6e2ef4a cmake: Build `bitcoin-qt` executable (Hennadii Stepanov)
30f642952c cmake: Add `WERROR` option (Hennadii Stepanov)
c98d4a4c34 cmake: Add `REDUCE_EXPORTS` option (Hennadii Stepanov)
a01cb6e63f cmake: Add `HARDENING` option (Hennadii Stepanov)
a8a2e364ac cmake: Add Python-based tests (Hennadii Stepanov)
3d85379570 cmake: Add fuzzing options (Hennadii Stepanov)
908530e312 cmake: Add `SANITIZERS` option (Hennadii Stepanov)
8bb0e85631 cmake: Build `bench_bitcoin` executable (Hennadii Stepanov)
801735163a cmake: Add external signer support (Hennadii Stepanov)
353e0c9e96 cmake: Add `systemtap-sdt` optional package support (Hennadii Stepanov)
d2fda82b49 cmake: Add `libzmq` optional package support (Hennadii Stepanov)
ae7b39a0e1 cmake: Add `libminiupnpc` optional package support (Hennadii Stepanov)
6480e1dcdb cmake: Add `libnatpmp` optional package support (Hennadii Stepanov)
e73e9304a1 cmake: Build `bitcoin-util` executable (Hennadii Stepanov)
027c6d7caa cmake: Build `bitcoin-tx` executable (Hennadii Stepanov)
d10c5c34c3 cmake: Add wallet functionality (Hennadii Stepanov)
ab2e99b0d9 cmake: Create test suite for `ctest` (Hennadii Stepanov)
959370bd76 cmake: Build `test_bitcoin` executable (Hennadii Stepanov)
b27bf9700d cmake: Build `bitcoin-cli` executable (Hennadii Stepanov)
a9813df826 cmake: Build `bitcoind` executable (Hennadii Stepanov)
97829ce2d5 cmake: Add `FindLibevent` module (Hennadii Stepanov)
3118e40c61 cmake: Build `bitcoin_consensus` library (Hennadii Stepanov)
809a2f1929 cmake: Build `bitcoin_util` static library (Hennadii Stepanov)
0a9a521a70 cmake: Build `bitcoin_crypto` library (Hennadii Stepanov)
958971f476 cmake: Build `univalue` static library (Hennadii Stepanov)
752747fda8 cmake: Generate `obj/build.h` header (Hennadii Stepanov)
1f0a78edf3 cmake: Build `minisketch` static library (Hennadii Stepanov)
12bfbc8154 cmake: Build `leveldb` static library (Hennadii Stepanov)
51985c5304 cmake: Build `crc32c` static library (Hennadii Stepanov)
db7a198f29 cmake: Build `secp256k1` subtree (Hennadii Stepanov)
dbb7ed14e8 cmake: Add `ccache` support (Hennadii Stepanov)
cedfdf6c72 cmake: Redefine/adjust per-configuration flags (Hennadii Stepanov)
b6b5e732c8 cmake: Add global compiler and linker flags (Hennadii Stepanov)
f98327931b cmake: Add `TryAppendLinkerFlag` module (Hennadii Stepanov)
4a0af29697 cmake: Add `TryAppendCXXFlags` module (Hennadii Stepanov)
35cffc497d cmake: Add POSIX threads support (Hennadii Stepanov)
fd72d00ffe cmake: Add position independent code support (Hennadii Stepanov)
07069e2bb0 cmake: Add introspection module (Hennadii Stepanov)
27d687fc1f cmake: Add `config/bitcoin-config.h` support (Hennadii Stepanov)
fe5cdace5f cmake: Print compiler and linker flags in summary (Hennadii Stepanov)
70683884c5 cmake: Introduce interface libraries to encapsulate common flags (Hennadii Stepanov)
a2317e27b7 cmake: Add root `CMakeLists.txt` file (Hennadii Stepanov)

Pull request description:

  This PR introduces a new CMake-based build system, which is a drop-in replacement for the current Autotools-based build system.

  ML announcement: https://groups.google.com/g/bitcoindev/c/hgKkfQWzrTo

  As discussed during the recent CoreDev meetup in April, the switch from Autotools to CMake is intended to happen as soon as possible after branching 28.x off, which means that 29.0 will be built using CMake.

  This PR branch is essentially the [staging branch](https://github.com/hebasto/bitcoin/tree/cmake-staging), with every change reviewed and tested by a group of contributors, including (in alphabetical order):
  - [**achow101**](https://github.com/achow101)
  - [**fanquake**](https://github.com/fanquake)
  - [**maflcko**](https://github.com/maflcko)
  - [**m3dwards**](https://github.com/m3dwards)
  - [**pablomartin4btc**](https://github.com/pablomartin4btc)
  - [**real-or-random**](https://github.com/real-or-random)
  - [**ryanofsky**](https://github.com/ryanofsky)
  - [**sipsorcery**](https://github.com/sipsorcery)
  - [**TheCharlatan**](https://github.com/TheCharlatan)
  - [**theStack**](https://github.com/theStack)
  - [**theuni**](https://github.com/theuni)
  - [**vasild**](https://github.com/vasild)

  Reviewing in a separate staging repo was suggested in https://github.com/bitcoin/bitcoin/pull/27060#issuecomment-1431798320.

  The accompanying changes to the OSS-Fuzz project are available in https://github.com/hebasto/oss-fuzz/pull/8.

  Please refer to the [build options parity table](https://gist.github.com/hebasto/2ef97d3a726bfce08ded9df07f7dab5e). The "auto" value is no longer available; non-default values must be specified explicitly. Additionally, the new default values have been chosen to suit the everyday build experience for the majority of developers.

  System requirements for using the CMake-based build system:
  - CMake >= 3.22 (if not available in your system's repository, it can be downloaded from https://cmake.org/download/)
  - a build tool of your choice:
  - any Make (GNU Make is no longer a requirement); GNU Make is still required to build depends
  - Ninja (https://ninja-build.org/)
  - MSBuild
  - Xcode

  A note for Windows users: The default installation of the latest version of MSVC 17.10.4 includes both CMake 3.28.3 and the vcpkg package manager).

  ---

  We, the build system developers, kindly ask reviewers to refrain from making suggestions that are not directly related to the migration process or can be implemented separately. Bugs in the scripts and errors in the updated documentation should be the focus of this PR. Please be advised that comments not aligned with this PR's goal may be ignored.

  Thank you all for your understanding.

ACKs for top commit:
  maflcko:
    review ACK 41051290ab 🐥
  sipsorcery:
    ACK 41051290ab.
  vasild:
    ACK 41051290ab
  TheCharlatan:
    ACK 41051290ab
  pablomartin4btc:
    tACK 41051290ab
  i-am-yuvi:
    tACK [`4105129`](41051290ab)
  theuni:
    ACK 41051290ab.
  fanquake:
    ACK 41051290ab

Tree-SHA512: 6c1445054436c6c00ad63bfa0f19d64091a2b25c9bd694f85bf2218ac358ffb774d6c000685b3ca1e9b50401babed989fa2a0694b774c211d226bfd1944c9b39
2024-08-28 10:51:24 +01:00
Martin Saposnic
a563f41232
Remove second node since only 1 is needed for the test 2024-08-27 19:00:37 -03:00
Martin Saposnic
1f4cdb3d69
Replace custom funding tx creation with MiniWallet.
setup_clean_chain=True is deleted so it uses the default.
Also, vout is now returned from send_to_address,
so now there is no need to fetch it manually

Also remove not-needed code that was used with the old
transaction handling.
2024-08-27 19:00:33 -03:00
Ava Chow
2c7a4231db
Merge bitcoin/bitcoin#30569: node: reduce unsafe uint256S usage
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 13 native, x86_64, no depends, sqlite only, gui (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
18d65d2772 test: use uint256::FromUserHex for RANDOM_CTX_SEED (stickies-v)
6819e5a329 node: use uint256::FromUserHex for -assumevalid parsing (stickies-v)
2e58fdb544 util: remove unused IsHexNumber (stickies-v)
8a44d7d3c1 node: use uint256::FromUserHex for -minimumchainwork parsing (stickies-v)
70e2c87737 refactor: add uint256::FromUserHex helper (stickies-v)
85b7cbfcbe test: unittest chainstatemanager_args (stickies-v)

Pull request description:

  Since fad2991ba0, `uint256S` has been [deprecated](fad2991ba0 (diff-800776e2dda39116e889839f69409571a5d397de048a141da7e4003bc099e3e2R138)) because it is less robust than the `base_blob::FromHex()` introduced in [the same PR](https://github.com/bitcoin/bitcoin/pull/30482). Specifically, it tries to recover from length-mismatches, recover from untrimmed whitespace, 0x-prefix and garbage at the end, instead of simply requiring exactly 64 hex-only characters. _(see also #30532)_

  This PR carves out the few `uint256S` callsites that may potentially prove a bit more controversial to change because they deal with user input and backwards incompatible behaviour change.

  The main behaviour change introduced in this PR is:
  - `-minimumchainwork` will raise an error when input is longer than 64 hex digits
  - `-assumevalid` will raise an error when input contains invalid hex characters, or when it is longer than 64 hex digits
  - test: the optional RANDOM_CTX_SEED env var will now cause tests to abort when it contains invalid hex characters, or when it is longer than 64 hex digits

  After this PR, the remaining work to remove `uint256S` completely is almost entirely mechanical and/or test related. I will open that PR once #30560 is merged because it builds on that.

ACKs for top commit:
  hodlinator:
    re-ACK 18d65d2772
  l0rinc:
    ACK 18d65d2772
  achow101:
    ACK 18d65d2772
  ryanofsky:
    Code review ACK 18d65d2772. Very nice change that cleans up the API, adds checking for invalid values, makes parsing of values more consistent, and adds test coverage.

Tree-SHA512: ec118ea3d56e1dfbc4c79acdbfc797f65c4d2107b0ca9577c848b4ab9b7cb8d05db9f3c7fe8441a09291aca41bf671572431f4eddc59be8fb53abbea76bbbf86
2024-08-27 16:47:54 -04: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
furszy
ee47ca29d6
init: fix fatal error on '-wallet' negated option value
Because we don't have type checking for command-line/settings/config
args, strings are interpreted as 'false' for non-boolean args.
By convention, this "forces" us to interpret negated strings as 'true',
which conflicts with the negated option definition in all the settings
classes (they expect negated options to always be false and ignore any
other value preceding them). Consequently, when retrieving all "wallet"
values from the command-line/settings/config, we also fetch the negated
string boolean value, which is not of the expected 'string' type.

This mismatch leads to an internal fatal error, resulting in an unclean
shutdown during initialization. Furthermore, this error displays a poorly
descriptive error message:
"JSON value of type bool is not of expected type string"

This commit fixes the fatal error by ensuring that only string values are
returned in the "wallet" settings list, failing otherwise. It also improves
the clarity of the returned error message.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2024-08-26 18:30:35 -03: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
Sebastian Falbesoner
bd7ce05f9d test: fix TestShell initialization (late follow-up for #30463) 2024-08-25 20:57:22 +02: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
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 13 native, x86_64, no depends, sqlite only, gui (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
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
stickies-v
6819e5a329
node: use uint256::FromUserHex for -assumevalid parsing
Removes dependency on unsafe and deprecated uint256S.

This makes parsing more strict, by returning an error
when the input contains non-hex characters, or when it
contains more than 64 hex digits.

Also make feature_assumevalid.py more robust by using CBlock.hash
which is guaranteed to be 64 characters long, as opposed to the
variable-length hex(CBlock.sha256)
2024-08-23 13:53:40 +01:00
stickies-v
8a44d7d3c1
node: use uint256::FromUserHex for -minimumchainwork parsing
Removes dependency on unsafe and deprecated uint256S.

This makes parsing more strict, by returning an error
when the input contains more than 64 hex digits.
2024-08-23 13:53:40 +01:00
merge-script
c81c6bf65b
Merge bitcoin/bitcoin#30665: test: Enable detect_leaks=1 in ASAN_OPTIONS explicitly
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 13 native, x86_64, no depends, sqlite only, gui (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
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
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 13 native, x86_64, no depends, sqlite only, gui (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
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
Hennadii Stepanov
6ce50fd9d0
doc: Update for CMake-based build system
Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
Co-authored-by: pablomartin4btc <pablomartin4btc@gmail.com>
2024-08-16 21:24:08 +01:00
Hennadii Stepanov
c360837ca5
cmake, lint: Adjust lint_includes_build_config 2024-08-16 21:19:12 +01:00
Hennadii Stepanov
a8a2e364ac
cmake: Add Python-based tests 2024-08-16 19:27:41 +01: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
tdb3
27c976d11a
fix: increase consistency of rpcauth parsing
Previous rpcauth behavior was to sometimes
ignore empty -rpcauth= settings, and other times
treat them as errors.
Empty rpcauth is now consistently treated
as an error and prevents bitcoind from starting.
Updates associated test cases.
Also updates to non-deprecated logging macro.

Co-Authored-By: Luke Dashjr <luke-jr+git@utopios.org>
Co-Authored-By: Ryan Ofsky <ryan@ofsky.org>
2024-08-12 20:28:11 -04: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
tdb3
2ad3689512
test: add norpcauth test
Adds test for disabling rpcauth args.

Co-Authored-By: Luke Dashjr <luke-jr+git@utopios.org>
2024-08-09 17:56:57 -04:00
tdb3
67df0dec1a
test: blank rpcauth CLI interaction
Tests interactions between blank and
non-blank rpcauth args.
2024-08-09 17:18:23 -04: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
Ava Chow
0019f61fc5 tests: Test importing of multipath descriptors
Test that both importmulti and importdescriptors behave as expected when
importing a multipath descriptor.
2024-08-08 12:47:38 -04:00
Ava Chow
1692245525 tests: Multipath descriptors for scantxoutset and deriveaddresses 2024-08-08 12:47:38 -04:00
Ava Chow
360456cd22 tests: Multipath descriptors for getdescriptorinfo 2024-08-08 12:47:24 -04: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
naiyoma
ec317bc44b test: update satoshi_round function
Refactor satoshi_round function to accept different rounding modes.
Updated call site to use the revised `satoshi_round` function.

Co-authored-by: Kate Salazar <52637275+katesalazar@users.noreply.github.com>
2024-08-07 15:25:08 +03:00
tdb3
ecc98ccff2
test: add cases for blank rpcauth 2024-08-06 13:52:12 -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
naiyoma
c8e6771af0 test: restrict multiple CLI arguments 2024-08-06 14:55:30 +03: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
Greg Sanders
2a3a24296e test: check that P2A with witness data is still consensus-legal 2024-08-02 13:03:06 -04:00
Greg Sanders
68bd86cd7c test: P2A is a destination type with an address 2024-08-02 13:03:06 -04:00
glozow
2aff9a36c3
Merge bitcoin/bitcoin#30352: policy: Add PayToAnchor(P2A), OP_1 <0x4e73> as a standard output script for spending
75648cea5a test: add P2A ProduceSignature coverage (Greg Sanders)
7998ce6b20 Add release note for P2A output feature (Greg Sanders)
71c9b02a04 test: add P2A coverage for decodescript (Greg Sanders)
1349e9ec15 test: Add anchor mempool acceptance test (Greg Sanders)
9d89209937 policy: stop 3rd party wtxid malleability of anchor spend (Greg Sanders)
b60aaf8b23 policy: make anchor spend standard (Greg Sanders)
455fca86cf policy: Add OP_1 <0x4e73> as a standard output type (Greg Sanders)

Pull request description:

  This is a sub-feature taken out of the original proposal for ephemeral anchors #30239

  This PR makes *spending* of `OP_1 <0x4e73>` (i.e. `bc1pfeessrawgf`) standard. Creation of this output type is already standard.

  Any future witness output types are considered relay-standard to create, but not to spend. This preserves upgrade hooks, such as a completely new output type for a softfork such as BIP341.  It also gives us a bit of room to use a new output type for policy uses.

  This particular sized witness program has no other known use-cases (https://bitcoin.stackexchange.com/a/110664/17078), s it affords insufficient cryptographic security for a secure commitment to data, such as a script or a public key. This makes this type of output "keyless", or unauthenticated.

  As a witness program, the `scriptSig` of the input MUST be blank, by BIP141. This helps ensure txid-stability of the spending transaction, which may be required for smart contracting wallets. If we do not use segwit, a miner can simply insert an `OP_NOP` in the `scriptSig` without effecting the result of program execution.

  An additional relay restriction is to disallow non-empty witness data, which an adversary may use to penalize the "honest" transactor when RBF'ing the transaction due to the incremental fee requirement of RBF rules.

  The intended use-case for this output type is to "anchor" the transaction with a spending child to bring exogenous CPFP fees into the transaction package, encouraging the inclusion of the package in a block. The minimal size of creation and spending of this output makes it an attractive contrast to outputs like `p2sh(OP_TRUE)` and `p2wsh(OP_TRUE)` which
  are significantly larger in vbyte terms.

  Combined with TRUC transactions which limits the size of child transactions significantly, this is an attractive option for presigned transactions that need to be fee-bumped after the fact.

ACKs for top commit:
  sdaftuar:
    utACK 75648cea5a
  theStack:
    re-ACK 75648cea5a
  ismaelsadeeq:
    re-ACK 75648cea5a via [diff](e7ce6dc070..75648cea5a)
  glozow:
    ACK 75648cea5a
  tdb3:
    ACK 75648cea5a

Tree-SHA512: d529de23d20857e6cdb40fa611d0446b49989eaafed06c28280e8fd1897f1ed8d89a4eabbec1bbf8df3d319910066c3dbbba5a70a87ff0b2967d5205db32ad1e
2024-08-02 15:49:44 +01:00
merge-script
df241970a3
Merge bitcoin/bitcoin#30554: test: Avoid CScript() as default function argument
fa46a1b74b test: Avoid CScript() as default function argument (MarcoFalke)
fadf621825 test: Make leaf_script mandatory when scriptpath is set in TaprootSignatureMsg (MarcoFalke)

Pull request description:

  Unlike other function calls in default arguments, CScript should not cause any issues in the tests, because they are const.

  However, this change allows to enable the "function-call-in-default-argument (B008)" lint rule, which will help to catch severe test bugs, such as https://github.com/bitcoin/bitcoin/issues/30543#issuecomment-2259260024 .

  The lint rule will be enabled in a follow-up, when all violations are fixed.

ACKs for top commit:
  instagibbs:
    utACK fa46a1b74b
  theStack:
    lgtm ACK fa46a1b74b
  ismaelsadeeq:
    Tested ACK fa46a1b74b

Tree-SHA512: bc68b15121d50ead0fc70ad772360a7829908aedeaff8426efcb8a67f33117f67d26b4f5da94fa735dd8de9c9ff65fc10a29323f1b12f238b75486fa7cc32a89
2024-08-02 14:02:04 +01:00
MarcoFalke
faed533743
test: Disable known broken USDT test for now
(cherry picked from commit faf8be7c32)
2024-08-02 14:02:42 +02:00
glozow
b8755164cf
Merge bitcoin/bitcoin#30413: p2p: Lazy init some bloom filters; fuzz version handshake
afd237bb5d [fuzz] Harness for version handshake (dergoegge)
a90ab4aec9 scripted-diff: Rename lazily initialized bloom filters (dergoegge)
82de1bc478 [net processing] Lazily initialize m_recent_confirmed_transactions (dergoegge)
fa0c87f19c [net processing] Lazily initialize m_recent_rejects_reconsiderable (dergoegge)
662e8db2d3 [net processing] Lazily initialize m_recent_rejects (dergoegge)

Pull request description:

  This adds a fuzzing harness dedicated to the version handshake. To avoid determinism issues, the harness creates necessary components each iteration (addrman, peerman, etc). A harness like this would have easily caught https://bitcoincore.org/en/2024/07/03/disclose-timestamp-overflow/.

  As a performance optimization, this PR includes a change to `PeerManager` to lazily initialize various filters (to avoid large unnecessary memory allocations each iteration).

ACKs for top commit:
  brunoerg:
    ACK afd237bb5d
  marcofleon:
    Tested ACK afd237bb5d. I compared the coverage  of `net_processing` from this harness to the `process_message` and `process_messages` harnesses to see the differences. This target hits more specific parts of the version handshake. The stability looks good as well, at about 94%.
  glozow:
    utACK afd237bb5d lazy blooms look ok
  mzumsande:
    Code Review ACK afd237bb5d

Tree-SHA512: 62bba20aec0cd220e62368354891f9790b81ad75e8adf7b22a76a6d4663bd26aedc4cae8083658a75ea9043d60aad3f0e58ad36bd7bbbf93ff1d16e317bf15cc
2024-08-01 09:48:24 +01:00
MarcoFalke
fa46a1b74b
test: Avoid CScript() as default function argument
This does not cause any issues, because CScript in the tests are const.
However, this change allows to enable the
"function-call-in-default-argument (B008)" lint rule.
2024-07-31 15:19:10 +02:00
dergoegge
a90ab4aec9 scripted-diff: Rename lazily initialized bloom filters
-BEGIN VERIFY SCRIPT-
sed -i 's/m_recent_confirmed_transactions/m_lazy_recent_confirmed_transactions/g' $(git grep -l 'm_recent_confirmed_transactions')
sed -i 's/m_recent_rejects_reconsiderable/m_lazy_recent_rejects_reconsiderable/g' $(git grep -l 'm_recent_rejects_reconsiderable')
sed -i 's/m_recent_rejects/m_lazy_recent_rejects/g' $(git grep -l 'm_recent_rejects')
-END VERIFY SCRIPT-
2024-07-31 13:23:46 +01:00
MarcoFalke
fa2269dd65
test: Try previously intermittently broken USDT test again
This reverts commit faf8be7c32.
2024-07-31 14:06:51 +02:00
merge-script
33884e7e60
Merge bitcoin/bitcoin#30545: test: fix intermittent failures in feature_proxy.py
a6efc7e16e test: fix intermittent failures in feature_proxy.py (Martin Zumsande)

Pull request description:

  Fixes #29871

  If addnode connections are made with v2transport and the peer immediately disconnects us, reconnections with v1 are scheduled. This could interfere with later checks depending on timing. Avoid this by using `v2transport=False` in the addnode rpc - this test isn't about the message layer anyway, so running it with v2 would add no value.

ACKs for top commit:
  maflcko:
    ACK a6efc7e16e
  tdb3:
    cr re ACK a6efc7e16e

Tree-SHA512: 39353a392e75e4c6257d971ceecb65fb76ec6d3b121a087869831c24b767a18f57e2ae2968da445c7fa731cb03053c90df37dd2cd6e86f786ad4121bc68ca235
2024-07-31 12:03:22 +01:00
MarcoFalke
fadf621825
test: Make leaf_script mandatory when scriptpath is set in TaprootSignatureMsg
This removes the default value, because there should not be a use-case
to fall back to a an empty leaf_script by default. (If there was, it
could trivially be added back)
2024-07-31 09:57:42 +02:00
Martin Zumsande
ec5e294e4b test: fix constructor of msg_tx
In python, if the default value is a mutable object (here: a class)
its shared over all instances, so that one instance being changed
would affect others to be changed as well.
This was likely the source of various intermittent bugs in the
functional tests.
2024-07-30 17:49:07 -04:00
Greg Sanders
71c9b02a04 test: add P2A coverage for decodescript 2024-07-30 14:06:58 -04:00
Greg Sanders
1349e9ec15 test: Add anchor mempool acceptance test 2024-07-30 14:06:58 -04:00
Martin Zumsande
a6efc7e16e test: fix intermittent failures in feature_proxy.py
If addnode connections are made with v2transport and the peer immediately disconnects us, reconnections
with v1 are scheduled. This could interfere with later checks depending on timing. Avoid this by using
`v2transport=False` in the addnode rpc - this test isn't about the message layer anyway, so running it
with v2 would add no value.
2024-07-30 10:52:53 -04:00
merge-script
38c30a4b50
Merge bitcoin/bitcoin#30515: rpc: add utxo's blockhash and number of confirmations to scantxoutset output
17845e7f21 rpc: add utxo's blockhash and number of confirmations to scantxoutset output (Luis Schwab)

Pull request description:

  This PR resolves #30478 by adding two fields to the `scantxoutset` RPC:
  - blockhash: the blockhash that an UTXO was created
  - confirmations: the number of confirmations an UTXO has relative to the chaintip.

  The rationale for the first field is that a blockhash is a much more reliable identifier than the height:
  > When using the scantxoutset RPC, the current behaviour is to show the block height of the UTXO. This is not optimal, as block height is ambiguous, especially in the case of a block reorganization happening at the same instant of the query. In this case, an UTXO that does not exist would be assumed to exist, unless the chain's tip hash is recorded before the scan, and make sure it still exists after, as per https://github.com/bitcoindevkit/bdk/issues/895#issuecomment-1475766797 comment by evanlinjin.

  The second one was suggested by maflcko, and I agree it's useful for human users:
  > While touching this, another thing to add could be the number of confirmations? I understand that this wouldn't help machine consumers of the interface, but human callers may find it useful?

  This will yield an RPC output like so:

  ```diff
  bitcoin-cli scantxoutset start "[\"addr(bc1q5q9344vdyjkcgv79ve3tldz4jmx4lf7knmnx6r)\"]"
  {
    "success": true,
    "txouts": 185259116,
    "height": 853622,
    "bestblock": "00000000000000000002e97d9be8f0ddf31829cf873061b938c10b0f80f708b2",
    "unspents": [
      {
        "txid": "fae435084345fe26e464994aebc6544875bca0b897bf4ce52a65901ae28ace92",
        "vout": 0,
        "scriptPubKey": "0014a00b1ad58d24ad8433c56662bfb45596cd5fa7d6",
        "desc": "addr(bc1q5q9344vdyjkcgv79ve3tldz4jmx4lf7knmnx6r)#smk4xmt7",
        "amount": 0.00091190,
        "coinbase": false,
        "height": 852741,
  +     "blockhash": "00000000000000000002eefe7e7db44d5619c3dace4c65f3fdcd2913d4945c13",
  +     "confirmations": 882
      }
    ],
    "total_amount": 0.00091190
  }
  ```

ACKs for top commit:
  sipa:
    utACK 17845e7f21
  Eunovo:
    ACK 17845e7f21
  tdb3:
    ACK 17845e7f21

Tree-SHA512: 02366d0004e5d547522115ef0efe6794a35978db53dda12c675cfae38197bf43f0bf89ca99a3d79e3d2cff95186015fe1ab764abb8ab82bda440ae9302ad973b
2024-07-28 13:36:15 +01:00
Luis Schwab
17845e7f21 rpc: add utxo's blockhash and number of confirmations to scantxoutset output 2024-07-27 18:58:11 -03:00
MarcoFalke
fa359255fe
Add -blocksxor boolean option 2024-07-26 17:30:53 +02:00
MarcoFalke
fa530ec543
rpc: Return precise loadtxoutset error messages
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.
2024-07-26 14:11:24 +02:00
glozow
ec700f0a76
Merge bitcoin/bitcoin#30076: test: fix MiniWallet script-path spend (missing parity bit in leaf version)
e4b0dabb21 test: add functional test for tagged MiniWallet instances (Sebastian Falbesoner)
3162c917e9 test: fix MiniWallet internal key derivation for tagged instances (Sebastian Falbesoner)
c9f7364ab2 test: fix MiniWallet script-path spend (missing parity bit in leaf version) (Sebastian Falbesoner)
7774c314fb test: refactor: return TaprootInfo from P2TR address creation routine (Sebastian Falbesoner)

Pull request description:

  This PR fixes a dormant bug in MiniWallet that exists since support for P2TR was initially added in #23371 (see commit 041abfebe4).

  In the course of spending the output, the leaf version byte of the control block in the witness stack doesn't set the parity bit, i.e. we were so far just lucky that the used combinations of relevant data (internal pubkey, leaf script / version) didn't result in a tweaked pubkey with odd y-parity. If that was the case, we'd get the following validation error:

  `mandatory-script-verify-flag-failed (Witness program hash mismatch) (-26)`

  Since MiniWallets can now optionally be tagged (#29939), resulting in different internal pubkeys, the issue is more prevalent now. Fix it by passing the parity bit, as specified in BIP341.

  Can be tested with the following patch (fails on master, succeeds on PR):
  ```diff
  diff --git a/test/functional/test_framework/mempool_util.py b/test/functional/test_framework/mempool_util.py
  index 148cc935ed..7ebe858681 100644
  --- a/test/functional/test_framework/mempool_util.py
  +++ b/test/functional/test_framework/mempool_util.py
  @@ -42,7 +42,7 @@ def fill_mempool(test_framework, node):
       # Generate UTXOs to flood the mempool
       # 1 to create a tx initially that will be evicted from the mempool later
       # 75 transactions each with a fee rate higher than the previous one
  -    ephemeral_miniwallet = MiniWallet(node, tag_name="fill_mempool_ephemeral_wallet")
  +    ephemeral_miniwallet = MiniWallet(node, tag_name="fill_mempool_ephemeral_wallet3")
       test_framework.generate(ephemeral_miniwallet, 1 + num_of_batches * tx_batch_size)

       # Mine enough blocks so that the UTXOs are allowed to be spent
  ```

  In addition to that, another bug is fixed where the internal key derivation failed, as not every pseudorandom hash results in a valid x-only pubkey. Fix this by treating the hash result as private key and calculate the x-only public key out of that, to be used then as internal key.

  Fixes #30528.

ACKs for top commit:
  glozow:
    ACK e4b0dabb21
  rkrux:
    reACK [e4b0dab](e4b0dabb21)
  hodlinator:
    ACK e4b0dabb21

Tree-SHA512: a16f33f76bcb1012857cc3129438a9f6badf28aa2b1d25696da0d385ba5866b46de0f1f93ba777ed9263fe6952f98d7d9c44ea0c0170a2bcc86cbef90bf6ac58
2024-07-26 11:51:46 +01:00
merge-script
30e8a79aef
Merge bitcoin/bitcoin#30482: rest: Reject truncated hex txid early in getutxos parsing
fac0c3d4bf doc: Add release notes for two pull requests (MarcoFalke)
fa7b57e5f5 refactor: Replace ParseHashStr with FromHex (MarcoFalke)
fa90777245 rest: Reject truncated hex txid early in getutxos parsing (MarcoFalke)
fab6ddbee6 refactor: Expose FromHex in transaction_identifier (MarcoFalke)
fad2991ba0 refactor: Implement strict uint256::FromHex() (MarcoFalke)
fa103db2bb scripted-diff: Rename SetHex to SetHexDeprecated (MarcoFalke)
fafe4b8051 test: refactor: Replace SetHex with uint256 constructor directly (MarcoFalke)

Pull request description:

  In `rest_getutxos` truncated txids such as `aa` or `ff` are accepted. This is brittle at best.

  Fix it by rejecting any truncated (or overlarge) input.

  ----

  Review note: This also starts a major refactor to rework hex parsing in Bitcoin Core, meaning that a few refactor commits are included as well. They are explained individually in the commit message and the work will be continued in the future.

ACKs for top commit:
  stickies-v:
    re-ACK fac0c3d4bf - only doc and test updates to address review comments, thanks!
  hodlinator:
    ACK fac0c3d4bf

Tree-SHA512: 473feb3fcf6118443435d1dd321006135b0b54689bfbbcb1697bb5811a449bef51f475c715de6911ff3c4ea3bdb75f601861ff93347bc4414d6b9e5298105dd7
2024-07-25 13:49:21 +01:00
merge-script
f7ab3ba404
Merge bitcoin/bitcoin#30275: Fee Estimation: change estimatesmartfee default mode to economical
25bf86a225 [test]: ensure `estimatesmartfee` default mode is `economical` (ismaelsadeeq)
41a2545046 [fees]: change `estimatesmartfee` default mode to `economical` (ismaelsadeeq)

Pull request description:

  Fixes #30009

  This PR changes the `estimatesmartfee` default mode to `economical`.

  This was also suggested on IRC https://bitcoin-irc.chaincode.com/bitcoin-core-dev/2024-04-26#1021609

  - `conservative` mode: This is the `estimatesmartfee` RPC mode which considers a longer history of blocks. It potentially returns a higher fee rate and is more likely to be sufficient for the desired target, but it is not as responsive to short-term drops in the prevailing fee market.
  - `economical` mode: This is the `estimatesmartfee` RPC mode where estimates are potentially lower and more responsive to short-term drops in the prevailing fee market.

  Since users are likely to use the default mode, this change will reduce overestimation for many users. The conservative mode remains available for those who wish to opt-in.

  For an in-depth analysis of how significantly the `conservative` mode overestimates, see
  https://delvingbitcoin.org/t/bitcoind-policy-estimator-modes-analysis/964.

ACKs for top commit:
  instagibbs:
    reACK 25bf86a225
  glozow:
    ACK 25bf86a225
  willcl-ark:
    ACK 25bf86a225

Tree-SHA512: 78ebda667eb9c8f87dcc2f0e6c14968bd1de30358dc77a13611b186fb8427ad97d9f537bad6e32e0a1aa477ccd8c64fee4d41e19308ef3cb184ff1664e6ba8a6
2024-07-25 10:44:50 +01:00
MarcoFalke
fa90777245
rest: Reject truncated hex txid early in getutxos parsing 2024-07-24 17:40:13 +02:00
Sergi Delgado Segura
6eeb188d40 test: adds seednode functional tests
Adds functional tests to test the interaction between seednode and the AddrMan
2024-07-24 11:14:02 -04:00
ismaelsadeeq
25bf86a225 [test]: ensure estimatesmartfee default mode is economical 2024-07-24 15:28:47 +01:00
MarcoFalke
fa3ea3b83c
test: Fix intermittent issue in p2p_v2_misbehaving.py
Without the fix, the test could fail intermittently. For example:

 node0 2024-07-22T16:31:54.104994Z [httpworker.0] [rpc/request.cpp:232] [parse] [rpc] ThreadRPCServer method=setmocktime user=__cookie__
 test  2024-07-22T16:31:54.291000Z TestFramework (INFO): Sending first 4 bytes of ellswift which match network magic
 test  2024-07-22T16:31:54.292000Z TestFramework (INFO): If a response is received, assertion failure would happen in our custom data_received() function
 test  2024-07-22T16:31:54.292000Z TestFramework.p2p (DEBUG): Connecting to Bitcoin Node: 127.0.0.1:12644
 test  2024-07-22T16:31:54.293000Z TestFramework.p2p (DEBUG): Connected & Listening: 127.0.0.1:12644
 test  2024-07-22T16:31:54.588000Z TestFramework.p2p (DEBUG): sending 4050 bytes of garbage data
 test  2024-07-22T16:31:54.588000Z TestFramework (INFO): Sending remaining ellswift and garbage which are different from V1_PREFIX. Since a response is
 test  2024-07-22T16:31:54.588000Z TestFramework (INFO): expected now, our custom data_received() function wouldn't result in assertion failure
 node0 2024-07-22T16:31:55.523868Z (mocktime: 2024-07-22T16:31:54Z) [net] [net.cpp:3764] [CNode] [net] Added connection peer=0
 node0 2024-07-22T16:31:55.625145Z (mocktime: 2024-07-22T16:31:54Z) [net] [net.cpp:1814] [CreateNodeFromAcceptedSocket] [net] connection from 127.0.0.1:45154 accepted
 node0 2024-07-22T16:31:55.625769Z (mocktime: 2024-07-22T16:31:54Z) [http] [httpserver.cpp:305] [http_request_cb] [http] Received a POST request for / from 127.0.0.1:33320
 node0 2024-07-22T16:31:55.626543Z (mocktime: 2024-07-22T16:31:54Z) [httpworker.1] [rpc/request.cpp:232] [parse] [rpc] ThreadRPCServer method=getpeerinfo user=__cookie__
 test  2024-07-22T16:31:55.818000Z TestFramework (ERROR): Unexpected exception caught during testing
                                   Traceback (most recent call last):
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 132, in main
                                       self.run_test()
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_v2_misbehaving.py", line 133, in run_test
                                       self.test_earlykeyresponse()
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_v2_misbehaving.py", line 151, in test_earlykeyresponse
                                       self.wait_until(lambda: node0.getpeerinfo()[-1]["bytesrecv"] > 4)
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 791, in wait_until
                                       return wait_until_helper_internal(test_function, timeout=timeout, timeout_factor=self.options.timeout_factor)
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/util.py", line 289, in wait_until_helper_internal
                                       if predicate():
                                          ^^^^^^^^^^^
                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_v2_misbehaving.py", line 151, in <lambda>
                                       self.wait_until(lambda: node0.getpeerinfo()[-1]["bytesrecv"] > 4)
                                                               ~~~~~~~~~~~~~~~~~~~^^^^
                                   IndexError: list index out of range
2024-07-23 19:48:40 +02:00
Ava Chow
8ae79f1155
Merge bitcoin/bitcoin#30403: test, assumeutxo: Remove resolved todo comments and add new test
d63ef73800 test: Add loadtxoutset test with tip on snapshot block (Fabian Jahr)
c2f86d4bcb test: Remove already resolved assumeutxo todo comments (Fabian Jahr)

Pull request description:

  The first commit removes three Todos that have been addressed previously (see commit message for details).

  The second message resolves another todo by adding the missing test case. This is a special case of "the tip has more work than the snapshot" where the tip is the same block as the snapshot base block.

  Related to #28648.

ACKs for top commit:
  jrakibi:
    ACK [d63ef73](d63ef73800)
  achow101:
    ACK d63ef73800
  maflcko:
    ACK d63ef73800
  alfonsoromanz:
    Re ACK d63ef73800

Tree-SHA512: 8d5a25fc0b26531db3a9740132694138f2103b7b42eeb1d4a64095bfc901c1372e23601c0855c7def84c8a4e185d10611e4e830c4e479f1b663ae6ed53abb130
2024-07-23 13:36:11 -04:00
Lőrinc
bccfca0382 Fix lint-spelling warnings
These warnings were often polluting the CI output, e.g. https://github.com/bitcoin/bitcoin/pull/30499/checks?check_run_id=27745036545

> ./test/lint/lint-spelling.py

before the change:
```
doc/design/libraries.md💯 targetted ==> targeted
doc/developer-notes.md:495: dependant ==> dependent
src/bench/sign_transaction.cpp:49: hashIn ==> hashing, hash in
src/bitcoin-chainstate.cpp:213: hashIn ==> hashing, hash in
src/bitcoin-chainstate.cpp:213: hashIn ==> hashing, hash in
src/coins.cpp:24: viewIn ==> viewing, view in
src/coins.cpp:24: viewIn ==> viewing, view in
src/coins.cpp:29: viewIn ==> viewing, view in
src/coins.cpp:29: viewIn ==> viewing, view in
src/coins.h:44: outIn ==> outing, out in
src/coins.h:44: outIn ==> outing, out in
src/coins.h:45: outIn ==> outing, out in
src/coins.h:45: outIn ==> outing, out in
src/coins.h:215: viewIn ==> viewing, view in
src/coins.h:220: viewIn ==> viewing, view in
src/primitives/transaction.h:37: hashIn ==> hashing, hash in
src/primitives/transaction.h:37: hashIn ==> hashing, hash in
src/protocol.cpp:51: hashIn ==> hashing, hash in
src/protocol.cpp:51: hashIn ==> hashing, hash in
src/protocol.h:497: hashIn ==> hashing, hash in
src/qt/forms/optionsdialog.ui:344: incomin ==> incoming
src/qt/optionsdialog.cpp:445: proxys ==> proxies
src/rpc/mining.cpp:987: hashIn ==> hashing, hash in
src/rpc/mining.cpp:987: hashIn ==> hashing, hash in
src/script/interpreter.h:298: amountIn ==> amounting, amount in
src/script/interpreter.h:298: amountIn ==> amounting, amount in
src/script/interpreter.h:299: amountIn ==> amounting, amount in
src/script/interpreter.h:299: amountIn ==> amounting, amount in
src/script/sigcache.h:70: amountIn ==> amounting, amount in
src/script/sigcache.h:70: amountIn ==> amounting, amount in
src/signet.cpp:144: amountIn ==> amounting, amount in
src/test/fuzz/util/net.cpp:386: occured ==> occurred
src/test/fuzz/util/net.cpp:398: occured ==> occurred
src/util/vecdeque.h:79: deques ==> dequeues
src/util/vecdeque.h:160: deques ==> dequeues
src/util/vecdeque.h:184: deques ==> dequeues
src/util/vecdeque.h:194: deques ==> dequeues
src/validation.cpp:2130: re-declared ==> redeclared
src/validation.h:348: outIn ==> outing, out in
src/validation.h:349: outIn ==> outing, out in
test/functional/wallet_bumpfee.py:851: atleast ==> at least
```
2024-07-22 13:59:42 +02:00
glozow
3a29ff5dea
Merge bitcoin/bitcoin#30463: qa: Functional test improvements
a8e3af1a82 qa: Do not assume running `feature_asmap.py` from source directory (Hennadii Stepanov)
9bf7ca6cad qa: Consider `cache` and `config.ini` relative to invocation directory (Hennadii Stepanov)
a0473442d1 scripted-diff: Add `__file__` argument to `BitcoinTestFramework.init()` (Hennadii Stepanov)

Pull request description:

  This PR includes changes split from https://github.com/bitcoin/bitcoin/pull/30454. They improve the functional test framework, allowing users to [run individual functional tests](https://github.com/hebasto/bitcoin/issues/146) from the build directory in the new CMake-based build system.

  This functionality is not available for out-of-source builds using the current Autotools-based build system, which always requires write permissions for the source directory. Nevertheless, this PR can be tested as suggested in https://github.com/bitcoin/bitcoin/pull/30463#issuecomment-2232618421:
  1. Make an out-of-source build:
  ```
  $ ./autogen.sh
  $ mkdir ../build && cd ../build
  $ ../bitcoin/configure
  $ make
  ```
  2. Create a symlink in the build directory to a functional test:
  ```
  $ ln --symbolic ../../../bitcoin/test/functional/wallet_disable.py ./test/functional/
  ```
  3. Run this symlink:
  ```
  $ ./test/functional/wallet_disable.py
  ```
  The last command fails on the master branch:
  ```
  Traceback (most recent call last):
    File "/home/hebasto/git/build/./test/functional/wallet_disable.py", line 31, in <module>
      DisableWalletTest().main()
      ^^^^^^^^^^^^^^^^^^^
    File "/home/hebasto/git/bitcoin/test/functional/test_framework/test_framework.py", line 106, in __init__
      self.parse_args()
    File "/home/hebasto/git/bitcoin/test/functional/test_framework/test_framework.py", line 210, in parse_args
      config.read_file(open(self.options.configfile))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  FileNotFoundError: [Errno 2] No such file or directory: '/home/hebasto/git/bitcoin/test/config.ini'

  ```
  and succeeds with this PR.

ACKs for top commit:
  maflcko:
    tested ACK a8e3af1a82 🎨
  glozow:
    ACK a8e3af1a82, tested with the steps in op
  stickies-v:
    ACK a8e3af1a82

Tree-SHA512: 899e4efc09edec13ea3f5b47825d03173fb21d3569c360deda7fa6a56b99b4d24e09ad4f0883bad1ee926b1c706e47ba07c6a6160c63c07c82b3cf4ae5816e91
2024-07-22 12:08:32 +01:00
Fabian Jahr
d63ef73800
test: Add loadtxoutset test with tip on snapshot block
Also pulls out the guarding assert and calls it explicitly before the test function is called. This is already done before the existing call of the test function so it was not needed there.
2024-07-19 00:54:26 +01:00
Fabian Jahr
c2f86d4bcb
test: Remove already resolved assumeutxo todo comments
- "Valid snapshot file, but referencing a snapshot block that turns out
  to be invalid, or has an invalid parent" has been addressed in #30267
- "An ancestor of snapshot block" - If chain tip refers to blocks in this context then any successful load is addressing this because if we have synced past the snapshot base block we fail because we don't need assumeutxo anymore. And if this is about headers then this is the `test_headers_not_synced()` case.
- "A descendant of the snapshot block" - If this refers to blocks the
  `test_snapshot_with_less_work()` addressed this and if it is just headers in this case again it would be represented in all of the successful loads in the test.

Co-authored-by: Alfonso Roman Zubeldia <alfonsoromanz24@gmail.com>
2024-07-19 00:54:01 +01:00
Ava Chow
0cac45755e
Merge bitcoin/bitcoin#30320: assumeutxo: Don't load a snapshot if it's not in the best header chain
55b6d7be68 validation: Don't load a snapshot if it's not in the best header chain. (Martin Zumsande)

Pull request description:

  This was suggested by me in the discussion of #30288, which has more context.

  If the snapshot is not an ancestor of the most-work header (`m_best_header`), syncing from that alternative chain leading to  `m_best_header` should be prioritised. Therefore it's not useful loading the snapshot in this situation.
  If the other chain turns out to be invalid or the chain with the snapshot retrieves additional headers so that it's the most-work one again (see functional test), `m_best_header` will change and loading the snapshot will be possible again.

  Because of the work required to generate a conflicting headers chain, a situation with two conflicting chains should only be possible under extreme circumstances, such as major forks.

ACKs for top commit:
  fjahr:
    re-ACK 55b6d7be68
  achow101:
    ACK 55b6d7be68
  alfonsoromanz:
    Re ACK 55b6d7be68

Tree-SHA512: 4fbea5ab1038ae353fc949a186041cf9b397e7ce4ac59ff36f881c9437b4f22ada922490ead5b2661389eb1ca0f3d1e7e7e6a4261057678643e71594a691ac36
2024-07-18 17:28:22 -04:00
Ava Chow
6144aa21d0
Merge bitcoin/bitcoin#30444: rest: Reject negative outpoint index early in getutxos parsing
fac932bf93 refactor: Use util::Split to avoid a harmless unsigned-integer-overflow (MarcoFalke)
fab54db9f1 rest: Reject negative outpoint index in getutxos parsing (MarcoFalke)

Pull request description:

  In `rest_getutxos` outpoint indexes such as `+N` or `-N` are accepted. This should be harmless, because any index out of range should be treated as a non-existent utxo. However, a negative index can't exist ever, so it seems better to reject all signs, whether `+` or `-`.

ACKs for top commit:
  achow101:
    ACK fac932bf93
  hodlinator:
    ut-ACK fac932bf93
  tdb3:
    re ACK fac932bf93
  danielabrozzoni:
    ACK fac932bf93
  brunoerg:
    reACK fac932bf93

Tree-SHA512: 8f1a75248cb61e1c4beceded6ed170db83b07f30fbcf93a26acfffc00ec4546572366eff87907a7e1423d7d3a2a9e57a0a7a9bacb787c86463f842d7161c16bc
2024-07-18 16:51:42 -04:00
glozow
20ccb30b7a
Merge bitcoin/bitcoin#30453: test: Non-Shy version sender
faed5d3870 test: Non-Shy version sender (MarcoFalke)

Pull request description:

  After `add_outbound_p2p_connection`, the test framework normally sends a version message only in reply to a received version. This is fine, but the protocol does not require this and tolerates a version to be sent earlier.

  However, this is untested, and the missing test coverage leads to bugs being missed. For example https://github.com/bitcoin/bitcoin/pull/30394#pullrequestreview-2166824948

  Fix it by adding a test.

ACKs for top commit:
  brunoerg:
    ACK faed5d3870
  tdb3:
    ACK faed5d3870
  theStack:
    tACK faed5d3870
  glozow:
    ACK faed5d3870

Tree-SHA512: dbf527a39c932e994a1e8248ba78058000811a4bf69275278f1fd1e545716ac4d2d3be5dcf362976bbafa2a49f91d13e3601daf71d29e9c556179b01af62c03c
2024-07-18 17:07:51 +01:00
Ava Chow
efbf4e71ce
Merge bitcoin/bitcoin#29523: Wallet: Add max_tx_weight to transaction funding options (take 2)
734076c6de [wallet, rpc]: add `max_tx_weight` to tx funding options (ismaelsadeeq)
b6fc5043c1 [wallet]: update the data type of `change_output_size`, `change_spend_size` and `tx_noinputs_size` to `int` (ismaelsadeeq)
baab0d2d43 [doc]: update reason for deducting change output weight (ismaelsadeeq)
7f61d31a5c [refactor]: update coin selection algorithms input parameter `max_weight` name (ismaelsadeeq)

Pull request description:

  This PR taken over from #29264

  The PR added an option `max_tx_weight` to transaction funding RPC's that ensures the resulting transaction weight does not exceed the specified `max_tx_weight` limit.

  If `max_tx_weight` is not given `MAX_STANDARD_TX_WEIGHT` is used as the max threshold.

  This PR addressed outstanding review comments in #29264

  For more context and rationale behind this PR see https://delvingbitcoin.org/t/lightning-transactions-with-v3-and-ephemeral-anchors/418/11?u=instagibbs

ACKs for top commit:
  achow101:
    ACK 734076c6de
  furszy:
    utACK 734076c6de
  rkrux:
    reACK [734076c](734076c6de)

Tree-SHA512: 013501aa443d239ee2ac01bccfc5296490c27b4edebe5cfca6b96c842375e895e5cfeb5424e82e359be581460f8be92095855763a62779a18ccd5bdfdd7ddce7
2024-07-17 18:27:59 -04:00
merge-script
5f5862f382
Merge bitcoin/bitcoin#30468: test: bump mocktime only after node has received and sent bytes
c322bddd08 test: bump mocktime after node has received and sent bytes (stratospher)

Pull request description:

  Fixes an intermittent failure for `p2p_v2_misbehaving.py` reported in https://github.com/bitcoin/bitcoin/pull/30420#discussion_r1680462164.

  A [different error message](262260ce1e/src/net.cpp (L1970)) `"socket no message in first %i seconds"` will be displayed if `m_last_send=0` or if `m_last_recv is 0`.  Fix this by:
  1. mocktime bump is done after all the bytes are received. (`m_last_recv is not 0 now`)
  2. wait until bytes are sent by `TestNode`/`bitcoind` (`m_last_send is not 0 now`)

  See https://cirrus-ci.com/task/5359619151757312?logs=ci#L3935 for an example failure (I wasn't able to reproduce the intermittent failure locally but I think the fix is logical)

ACKs for top commit:
  maflcko:
    reACK c322bddd08

Tree-SHA512: 1c05524c2819041eb2001c2baf2c912d4f812a39347f784f212634e8c53131357a73116a46b4b7542bc7fc8c1370c4d36fc9898a2cbdb40bcee61105123c4a35
2024-07-17 16:11:08 +01:00
merge-script
37992244e6
Merge bitcoin/bitcoin#30457: doc: getaddressinfo[isscript] is optional
fa6390df20 doc: getaddressinfo[isscript] is optional (MarcoFalke)

Pull request description:

  `isscript` is unknown for unknown witness versions, so it should be marked optional in the docs

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

ACKs for top commit:
  stickies-v:
    ACK fa6390df20
  tdb3:
    ACK fa6390df20

Tree-SHA512: f728f18e0871923225e0bf29594f8095997456cf55409f42087b5f70f95bef10f984323b48d2b484b6705f23b04e9e8a3fe42446830638fdd70453c18fd7f189
2024-07-17 13:58:34 +01:00
stratospher
c322bddd08 test: bump mocktime after node has received and sent bytes
a different error message "socket no message in first %i seconds"
will be displayed if m_last_send=0 or if m_last_recv is 0. make
the test robust by ensuring that they will not be 0 before
bumping mocktime.
2024-07-17 17:56:19 +05:30
MarcoFalke
faed5d3870
test: Non-Shy version sender 2024-07-17 11:49:01 +02:00
MarcoFalke
fa6390df20
doc: getaddressinfo[isscript] is optional 2024-07-17 06:51:58 +02:00
Ava Chow
6f9db1ebca
Merge bitcoin/bitcoin#30357: Fix cases of calls to FillPSBT errantly returning complete=true
7e36dca657 test: add test for modififed walletprocesspsbt calls (willcl-ark)
39cea21ec5 wallet: fix FillPSBT errantly showing as complete (willcl-ark)

Pull request description:

  Fixes: #30077

  Fix cases of calls to `FillPSBT` returning `complete=true` when it's not
  the case.

  This can happen when some inputs have been signed but the transaction is
  subsequently modified, e.g. in the context of PayJoins.

  Also fixes a related bug where a finalized hex string is attempted to be
  added during `walletprocesspsbt` but a CHECK_NONFATAL causes an abort.

ACKs for top commit:
  achow101:
    ACK 7e36dca657
  ismaelsadeeq:
    Tested ACK 7e36dca657
  pinheadmz:
    re-ACK 7e36dca657

Tree-SHA512: e35d19789899c543866d86d513506494d672e4bed9aa36a995dbec4e72f0a8ec5536b57c4a940a18002ae4a8efd0b007c77ba64e57cd52af98e4ac0e7bf650d6
2024-07-16 17:10:19 -04:00
Hennadii Stepanov
a8e3af1a82
qa: Do not assume running feature_asmap.py from source directory 2024-07-16 22:06:47 +01:00
Hennadii Stepanov
9bf7ca6cad
qa: Consider cache and config.ini relative to invocation directory
In CMake-based build system (1) `config.ini` is created in the build
directory, and (2) `cache` must also be created in the same directory.

This change enables running individual functional tests from the build
directory.
2024-07-16 22:06:47 +01:00
Hennadii Stepanov
a0473442d1
scripted-diff: Add __file__ argument to BitcoinTestFramework.init()
-BEGIN VERIFY SCRIPT-
sed -i -e 's/\s*().main\s*()/(__file__).main()/' $(git ls-files test/functional/*.py)
sed -i -e 's/def __init__(self)/def __init__(self, test_file)/' test/functional/test_framework/test_framework.py
-END VERIFY SCRIPT-
2024-07-16 22:06:47 +01:00
Ava Chow
45750f61d6
Merge bitcoin/bitcoin#22729: Make it possible to disable Tor binds and abort startup on bind failure
bca346a970 net: require P2P binds to succeed (Vasil Dimov)
af552534ab net: report an error if unable to bind on the Tor listening addr:port (Vasil Dimov)
9a7e5f4d68 net: don't extra bind for Tor if binds are restricted (Vasil Dimov)

Pull request description:

  Make it possible to disable the Tor binding on `127.0.0.1:8334` and stop startup if any P2P bind fails instead of "if all P2P binds fail".

  Fixes https://github.com/bitcoin/bitcoin/issues/22726
  Fixes https://github.com/bitcoin/bitcoin/issues/22727

ACKs for top commit:
  achow101:
    ACK bca346a970
  cbergqvist:
    ACK bca346a970
  pinheadmz:
    ACK bca346a970

Tree-SHA512: fabef89a957191eea4f3e3b6109d2b8389f27ecc74440a920b0c10f31fff00a85bcfd1eb3c91826c7169c618f4de8a8d0a260e2caf40fd854f07ea9a980d8603
2024-07-16 16:27:24 -04:00
Ava Chow
ad5579e056
Merge bitcoin/bitcoin#30429: rpc: Use CHECK_NONFATAL over Assert
fa6270737e rpc: Use CHECK_NONFATAL over Assert (MarcoFalke)

Pull request description:

  Any RPC method should not abort the whole node when an internal logic error happens.

  Fix it by just aborting this single RPC method call when an error happens.

  Also, fix the linter to find the fixed cases.

ACKs for top commit:
  achow101:
    ACK fa6270737e
  stickies-v:
    ACK fa6270737e
  tdb3:
    ACK fa6270737e
  hodlinator:
    ACK fa6270737e

Tree-SHA512: dad2f31b01a66578949009499e4385fb4d72f0f897419f2a6e0ea02e799b9a31e6ecb5a67fa5d27fcbc7939fe8acd62dc04e877b35831493b7f2c604dec7dc64
2024-07-16 16:00:33 -04:00
glozow
35dddbccf1
Merge bitcoin/bitcoin#30394: net: fix race condition in self-connect detection
16bd283b3a Reapply "test: p2p: check that connecting to ourself leads to disconnect" (Sebastian Falbesoner)
0dbcd4c148 net: prevent sending messages in `NetEventsInterface::InitializeNode` (Sebastian Falbesoner)
66673f1c13 net: fix race condition in self-connect detection (Sebastian Falbesoner)

Pull request description:

  This PR fixes a recently discovered race condition in the self-connect detection (see #30362 and #30368).

  Initiating an outbound network connection currently involves the following steps after the socket connection is established (see [`CConnman::OpenNetworkConnection`](bd5d1688b4/src/net.cpp (L2923-L2930)) method):
  1. set up node state
  2. queue VERSION message (both steps 1 and 2 happen in [`InitializeNode`](bd5d1688b4/src/net_processing.cpp (L1662-L1683)))
  3. add new node to vector `m_nodes`

  If we connect to ourself, it can happen that the sent VERSION message (step 2) is received and processed locally *before* the node object is added to the connection manager's `m_nodes` vector (step 3). In this case, the self-connect remains undiscovered, as the detection doesn't find the outbound peer in `m_nodes` yet (see `CConnman::CheckIncomingNonce`).

  Fix this by swapping the order of 2. and 3., by taking the `PushNodeVersion` call out of `InitializeNode` and doing that in the `SendMessages` method instead, which is only called for `CNode` instances in `m_nodes`.

  The temporarily reverted test introduced in #30362 is readded. Fixes #30368.

  Thanks go to vasild, mzumsande and dergoegge for suggestions on how to fix this (see https://github.com/bitcoin/bitcoin/issues/30368#issuecomment-2200625017 ff. and https://github.com/bitcoin/bitcoin/pull/30394#discussion_r1668290789).

ACKs for top commit:
  naiyoma:
    tested ACK [16bd283b3a),  built and tested locally,  test passes successfully.
  mzumsande:
    ACK 16bd283b3a
  tdb3:
    ACK 16bd283b3a
  glozow:
    ACK 16bd283b3a
  dergoegge:
    ACK 16bd283b3a

Tree-SHA512: 5b8aced6cda8deb38d4cd3fe4980b8af505d37ffa0925afaa734c5d81efe9d490dc48a42e1d0d45dd2961c0e1172a3d5b6582ae9a2d642f2592a17fbdc184445
2024-07-16 09:40:53 +01:00
merge-script
d41f4a69e7
Merge bitcoin/bitcoin#30420: test: Fix intermittent failure in p2p_v2_misbehaving.py
c6d43367a1 test: Fix intermittent failure in p2p_v2_misbehaving.py (stratospher)

Pull request description:

  Fixes #30419.

  Make sure that ellswift computation is complete in the `NetworkThread` in `test/functional/p2p_v2_misbehaving.py` before sending the ellswift in the `MainThread`.

  One way to reproduce this failure on master would be:

  ```diff
  diff --git a/test/functional/test_framework/v2_p2p.py b/test/functional/test_framework/v2_p2p.py
  index 87600c36de..ea0615ef3b 100644
  --- a/test/functional/test_framework/v2_p2p.py
  +++ b/test/functional/test_framework/v2_p2p.py
  @@ -111,6 +111,7 @@ class EncryptedP2PState:

       def generate_keypair_and_garbage(self, garbage_len=None):
           """Generates ellswift keypair and 4095 bytes garbage at max"""
  +        import time; time.sleep(3)
           self.privkey_ours, self.ellswift_ours = ellswift_create()
           if garbage_len is None:
               garbage_len = random.randrange(MAX_GARBAGE_LEN + 1)

  ```

ACKs for top commit:
  maflcko:
    ACK c6d43367a1
  mzumsande:
    Code Review ACK c6d43367a1
  tdb3:
    cr and t ACK c6d43367a1

Tree-SHA512: dfc3a6afa09773b7e84d35aff0aa14e0b8a4475860e0b31ab5c1a8d54911c814f07138f624fea651fba90cc5c526c0d05c3fe33d2ce0ad833b2be3a3caa9f522
2024-07-16 08:58:42 +01:00
stratospher
c6d43367a1 test: Fix intermittent failure in p2p_v2_misbehaving.py
The ellswift bytes are computed in the NetworkThread and sent in
the MainThread. Add a `wait_until()` to make sure that ellswift
computation is completed in NetworkThread before sending it in
the MainThread. Also wait until bytes sent are actually received
and use mocktime for more robust disconnection checking.
2024-07-15 20:51:05 +05:30
merge-script
c4d45b695e
Merge bitcoin/bitcoin#30295: #28984 package rbf followups
3f00aae140 package rbf: cpfp structure requires package > parent feerate (Greg Sanders)
ad7f1f697f test package rbf boundary conditions more closely (Greg Sanders)
ff4558d441 doc: reword package RBF documentation (Greg Sanders)
de669a883b doc: replace mention of V3 with TRUC (Greg Sanders)

Pull request description:

  Some suggested nits/changes from #28984

ACKs for top commit:
  glozow:
    ACK 3f00aae140
  murchandamus:
    ACK 3f00aae140

Tree-SHA512: 79434cc8aba25a43e99793298cdc99cad807db2c3a2e780a31953f244b95eecd97b90559abd67fbf30996c00966675fa257253a7812ec4727420226162c629ae
2024-07-12 17:15:27 +01:00
MarcoFalke
fab54db9f1
rest: Reject negative outpoint index in getutxos parsing 2024-07-12 17:48:26 +02:00
MarcoFalke
fa6270737e
rpc: Use CHECK_NONFATAL over Assert 2024-07-12 09:27:41 +02:00
Ava Chow
33af14e31b
Merge bitcoin/bitcoin#30353: test: fix inconsistency in fundrawtransaction weight limits test
00b8e26bd6 test: fix inconsistency in fundrawtransaction weight limits test (furszy)

Pull request description:

  Fix https://github.com/bitcoin/bitcoin/pull/30309#discussion_r1657628378 inconsistency.

  Currently, the test is passing due to a mistake in the test inputs
  selection process. We are selecting the parent transaction change
  output as one of the inputs of the transaction to fund, which
  helps to surpass the target amount when it shouldn't due to the
  fee reduction.

  The failure arises when the test behaves as intended by its coder;
  that is, when it does not select the change output. In this case,
  the pre-selected inputs aren't enough to cover the target amount.

  Fix this by excluding the parent transaction's change output from
  the inputs selection and including an extra input to cover the tx
  fee.

  The CI failure can be replicated with the following patch in master:

  ```diff
  diff --git a/test/functional/wallet_fundrawtransaction.py b/test/functional/wallet_fundrawtransaction.py
  --- a/test/functional/wallet_fundrawtransaction.py(revision 9b480f7a25)
  +++ b/test/functional/wallet_fundrawtransaction.py(date 1720652934739)
  @@ -1322,7 +1322,7 @@
           outputs = []
           for _ in range(1472):
               outputs.append({wallet.getnewaddress(address_type="legacy"): 0.1})
  -        txid = self.nodes[0].send(outputs=outputs)["txid"]
  +        txid = self.nodes[0].send(outputs=outputs, change_position=0)["txid"]
           self.generate(self.nodes[0], 1)

           # 272 WU per input (273 when high-s); picking 1471 inputs will exceed the max standard tx weight.
  @@ -1330,7 +1330,7 @@

           # 1) Try to fund transaction only using the preset inputs
           input_weights = []
  -        for i in range(1471):
  +        for i in range(1, 1472):  # skip first output as it is the parent tx change output
               input_weights.append({"txid": txid, "vout": i, "weight": 273})
           assert_raises_rpc_error(-4, "Transaction too large", wallet.fundrawtransaction, hexstring=rawtx, input_weights=input_weights)
  ```

ACKs for top commit:
  achow101:
    ACK 00b8e26bd6
  ismaelsadeeq:
    Code review and Tested ACK 00b8e26bd6

Tree-SHA512: 5ef792961b7fad4999fc30aa03366432103ddf672ca5cbb366c9eab4c2e46d5ae1ab0c073dfc4fbb2b4e63203653bc0e54463c731c5f8655140207ba5f8e542e
2024-07-11 15:08:13 -04:00
Martin Zumsande
55b6d7be68 validation: Don't load a snapshot if it's not in the best header chain.
If the snapshot is not an ancestor of the most-work header (m_best_header),
syncing from that alternative chain should be prioritised.
Therefore don't accept loading a snapshot in this situation.

If that other chain turns out to be invalid, m_best_header
would be reset and loading the snapshot should be possible again.

Because of the work required to generate a conflicting headers chain,
this should only be possible under extreme circumstances, such as major forks.
2024-07-11 13:06:22 -04:00
glozow
d9aa7b23e4
Merge bitcoin/bitcoin#26596: wallet: Migrate legacy wallets to descriptor wallets without requiring BDB
8ce3739edb test: verify wallet is still active post-migration failure (furszy)
771bc60f13 wallet: Use LegacyDataSPKM when loading (Ava Chow)
61d872f1b3 wallet: Move MigrateToDescriptor and DeleteRecords to LegacyDataSPKM (Ava Chow)
b231f4d556 wallet: Move LegacyScriptPubKeyMan::IsMine to LegacyDataSPKM (Ava Chow)
7461d0c006 wallet: Move LegacySPKM data storage and handling to LegacyDataSPKM (Ava Chow)
517e204bac Change MigrateLegacyToDescriptor to reopen wallet as BERKELEY_RO (Ava Chow)

Pull request description:

  #26606 introduced `BerkeleyRODatabase` which is an independent parser for BDB files. This PR uses this in legacy wallet migration so that migration will continue to work once the legacy wallet and BDB are removed. `LegacyDataSPKM` is introduced to have the minimum data and functions necessary for a legacy wallet to be loaded for migration.

ACKs for top commit:
  cbergqvist:
    ACK 8ce3739edb
  theStack:
    Code-review ACK 8ce3739edb
  furszy:
    Code review ACK 8ce3739edb

Tree-SHA512: dccea12d6c597de15e3e42f97ab483cfd069e103611200279a177e021e8e9c4e74387c4f45d2e58b3a1e7e2bdb32a1d2d2060b1f8086c03eeaa0c68579d9d54e
2024-07-11 16:47:02 +01:00
furszy
00b8e26bd6
test: fix inconsistency in fundrawtransaction weight limits test
Currently, the test is passing due to a mistake in the test inputs
selection process. We are selecting the parent transaction change
output as one of the inputs of the transaction to fund, which
helps to surpass the target amount when it shouldn't due to the
fee reduction.

The failure arises when the test behaves as intended by its coder;
that is, when it does not select the change output. In this case,
the pre-selected inputs aren't enough to cover the target amount.

Fix this by excluding the parent transaction's change output from
the inputs selection and including an extra input to cover the tx
fee.
2024-07-10 20:04:21 -03:00
Ava Chow
f4849f6922
Merge bitcoin/bitcoin#29668: prune, rpc: Check undo data when finding pruneheight
8789dc8f31 doc: Add note to getblockfrompeer on missing undo data (Fabian Jahr)
4a1975008b rpc: Make pruneheight also reflect undo data presence (Fabian Jahr)
96b4facc91 refactor, blockstorage: Generalize GetFirstStoredBlock (Fabian Jahr)

Pull request description:

  The function `GetFirstStoredBlock()` helps us find the first block for which we have data. So far this function only looked for a block with `BLOCK_HAVE_DATA`. However, this doesn't mean that we also have the undo data of that block, and undo data might be required for what a user would like to do with those blocks. One example of how this might happen is if some blocks were fetched using the `getblockfrompeer` RPC. Blocks fetched from a peer will have data but no undo data.

  The first commit here allows `GetFirstStoredBlock()` to check for undo data as well by passing a parameter. This alone is useful for #29553 and I would use it there.

  In the second commit I am applying the undo check to the RPCs that report `pruneheight` to the user. I find this much more intuitive because I think the user expects to be able to do all operations on blocks up until the `pruneheight` but that is not the case if undo data is missing. I personally ran into this once before and now again when testing for assumeutxo when I had used `getblockfrompeer`. The following commit adds test coverage for this change of behavior.

  The last commit adds a note in the docs of `getblockfrompeer` that undo data will not be available.

ACKs for top commit:
  achow101:
    ACK 8789dc8f31
  furszy:
    Code review ACK 8789dc8f31.
  stickies-v:
    ACK 8789dc8f31

Tree-SHA512: 90ae8bdd07a496ade579aa25240609c61c9ed173ad38d30533f6c631fe674e5a41727478ade69ca4b71a571ad94c9da4b33ebba6b5d8821109313c2de3bdfb3d
2024-07-10 15:27:05 -04:00
Ava Chow
394651ff10
Merge bitcoin/bitcoin#29996: Assumeutxo: bugfix on loadtxoutset with a divergent chain + test
5b7f70ba26 test: loadtxoutset in divergent chain with less work (Alfonso Roman Zubeldia)
d35efe1efc p2p: Start downloading historical blocks from common ancestor (Martin Zumsande)

Pull request description:

  This PR adds a test to cover the scenario of loading an assumeutxo snapshot when the current chain tip is not an ancestor of the snapshot block but has less work.

  During the review process, a bug was discovered where blocks between the last common ancestor and the background tip were not being requested if the background tip was not an ancestor of the snapshot block. mzumsande suggested a fix (65343ec49a6b73c4197dfc38e1c2f433b0a3838a) to start downloading historical blocks from the last common ancestor to address this issue. This fix has been incorporated into the PR with a slight modification.

  Related to https://github.com/bitcoin/bitcoin/issues/28648

ACKs for top commit:
  fjahr:
    tACK 5b7f70ba26
  achow101:
    ACK 5b7f70ba26
  mzumsande:
    Code Review ACK 5b7f70ba26

Tree-SHA512: f8957349686a6a1292165ea9e0fd8c912d21466072632a10f8ef9d852a5f430bc6b2a531e6884a4dbf2e3adb28b3d512b25919e78f5804a67320ef54c3b1aaf6
2024-07-10 15:18:33 -04:00
Ava Chow
9adebe1455
Merge bitcoin/bitcoin#29154: tests: improve wallet multisig descriptor test and docs
d93b794709 tests: improve wallet multisig descriptor test and docs (Michael Dietz)

Pull request description:

  It is best to store all key origin information
  (master key fingerprint and all derivation steps)
  in the multisig descriptor. Being explicit with
  this information should be beneficial if this approach is used with other wallets/signers (whether hardware or software). There is no harm including all of this with xpubs (if anything it simplifies the test code) and makes this example/docs more complete and safer incase it is referenced by others.

ACKs for top commit:
  S3RK:
    Code Review ACK d93b794709
  achow101:
    ACK d93b794709

Tree-SHA512: 0e5c4d13f060489405e6cf50c8a09911f5a0cee71023649235afd80a5e3aae38d52c6e12ad4660205b9357b09f45596941391bdcf6fceccbe07c4e5a1592a482
2024-07-09 20:09:07 -04:00
Ava Chow
c51c694ede
Merge bitcoin/bitcoin#29431: test/BIP324: disconnection scenarios during v2 handshake
c9dacd958d test: Check that non empty version packet is ignored and no disconnection happens (stratospher)
997cc00b95 test: Check that disconnection happens when AAD isn't filled (stratospher)
b5e6238fdb test: Check that disconnection happens when garbage sent/received are different (stratospher)
ad1482d5a2 test: Check that disconnection happens when wrong garbage terminator is sent (stratospher)
e351576862 test: Check that disconnection happens when >4095 garbage bytes is sent (stratospher)
e075fd131d test: Introduce test types and modify v2 handshake function accordingly (stratospher)
7d07daa623 log: Add V2 handshake timeout (stratospher)
d4a1da8543 test: Make global TRANSPORT_VERSION variable an instance variable (stratospher)
c642b08c4e test: Log when the garbage is actually sent to transport layer (stratospher)
86cca2cba2 test: Support disconnect waiting for add_p2p_connection (stratospher)
bf9669af9c test: Rename early key response test and move random_bitflip to util (stratospher)

Pull request description:

  Add tests for the following v2 handshake scenarios:
  1. Disconnection happens when > `MAX_GARBAGE_LEN` bytes garbage is sent
  2. Disconnection happens when incorrect garbage terminator is sent
  3. Disconnection happens when garbage bytes are tampered with
  4. Disconnection happens when AAD of first encrypted packet after the garbage terminator is not filled
  5. bitcoind ignores non-empty version packet and no disconnection happens

  All these tests require a modified v2 P2P class (different from `EncryptedP2PState` used in `v2_p2p.py`) to implement our custom handshake behaviour based on different scenarios and have been kept in a single test file (`test/functional/p2p_v2_misbehaving.py`). Shifted the test in `test/functional/p2p_v2_earlykeyresponse.py` which is of the same pattern to this file too.

ACKs for top commit:
  achow101:
    ACK c9dacd958d
  mzumsande:
    ACK c9dacd958d
  theStack:
    Code-review ACK c9dacd958d

Tree-SHA512: 90df81f0c7f4ecf0a47762d290a618ded92cde9f83d3ef3cc70e1b005ecb16125ec39a9d80ce95f99e695d29abd63443240cb5490aa57c5bc8fa2e52149a0672
2024-07-09 16:37:27 -04:00
Ryan Ofsky
5239e935cf
Merge bitcoin/bitcoin#30329: fuzz: improve utxo_snapshot target
de71d4dece fuzz: improve utxo_snapshot target (Martin Zumsande)

Pull request description:

  Add the possibility of giving more guidance to the creation of the metadata and/or coins, so that the fuzzer gets the chance
  to reach more error conditions in ActivateSnapshot and sometimes successfully creates a valid snapshot.

  This also changes the asserts for the success case that were outdated (after #29370) and only didn't result in a crash because the fuzzer wasn't able to reach this code before.

ACKs for top commit:
  maflcko:
    re-ACK de71d4dece 🎆
  fjahr:
    utACK de71d4dece
  TheCharlatan:
    ACK de71d4dece

Tree-SHA512: 346974d594164544d8cd3df7d8362c905fd93116215e9f5df308dfdac55bab04d727bfd7fd001cf11318682d11ee329b4b4a43308124c04d64b67840ab8a58a0
2024-07-09 16:13:14 -04:00
Sebastian Falbesoner
16bd283b3a Reapply "test: p2p: check that connecting to ourself leads to disconnect"
This reverts commit 9ec2c53701 with
a tiny change included (identation of the wait_until call).
2024-07-09 21:36:35 +02:00
Greg Sanders
3f00aae140 package rbf: cpfp structure requires package > parent feerate 2024-07-09 13:18:04 -04:00
Greg Sanders
ad7f1f697f test package rbf boundary conditions more closely 2024-07-09 13:18:04 -04:00
Ryan Ofsky
1f9d30744d
Merge bitcoin/bitcoin#29855: psbt: Check non witness utxo outpoint early
9e13ccc50e psbt: Check non witness utxo outpoint early (Ava Chow)

Pull request description:

  A common issue that our fuzzers keep finding is that outpoints don't exist in the non witness utxos. Instead of trying to track this down and checking in various individual places, do the check early during deserialization. This also unifies the error message returned for this class of problems.

ACKs for top commit:
  maflcko:
    lgtm ACK 9e13ccc50e
  S3RK:
    tACK 9e13ccc50e
  dergoegge:
    utACK 9e13ccc50e

Tree-SHA512: 81b8055b146c6358052226578ddfec0ae5bd877968c7f4f62dc3d6a684545ea568f37c7f1bd619918441af9e453ba8b26531a2280d218da37fa15480f1b45d0e
2024-07-08 13:56:52 -04:00
Alfonso Roman Zubeldia
5b7f70ba26 test: loadtxoutset in divergent chain with less work 2024-07-05 12:08:06 +02:00
Martin Zumsande
de71d4dece fuzz: improve utxo_snapshot target
Add the possibility of giving more guidance to the creation of the
metadata and/or coins, so that the fuzzer gets the chance
to reach more error conditions in ActivateSnapshot and sometimes
successfully creates a valid snapshot.

This also changes the asserts for the success case that were outdated,
and only didn't result in a crash because the fuzzer wasn't able
to reach this code before.
2024-07-04 20:12:47 -04:00
merge-script
5c0cd205a1
Merge bitcoin/bitcoin#29625: Several randomness improvements
ce8094246e random: replace construct/assign with explicit Reseed() (Pieter Wuille)
2ae392d561 random: use LogError for init failure (Pieter Wuille)
97e16f5704 tests: make fuzz tests (mostly) deterministic with fixed seed (Pieter Wuille)
2c91330dd6 random: cleanup order, comments, static (Pieter Wuille)
8e31cf9c9b net, net_processing: use existing RNG objects more (Pieter Wuille)
d5fcbe966b random: improve precision of MakeExponentiallyDistributed (Pieter Wuille)
cfb0dfe2cf random: convert GetExponentialRand into rand_exp_duration (Pieter Wuille)
4eaa239dc3 random: convert GetRand{Micros,Millis} into randrange (Pieter Wuille)
82de1b80d9 net: use GetRandMicros for cache expiration (Pieter Wuille)
ddc184d999 random: get rid of GetRand by inlining (Pieter Wuille)
e2d1f84858 random: make GetRand() support entire range (incl. max) (Pieter Wuille)
810cdf6b4e tests: overhaul deterministic test randomness (Pieter Wuille)
6cfdc5b104 random: convert XoRoShiRo128PlusPlus into full RNG (Pieter Wuille)
8cc2f45065 random: move XoRoShiRo128PlusPlus into random module (Pieter Wuille)
8f5ac0d0b6 xoroshiro128plusplus: drop comment about nonexisting copy() (Pieter Wuille)
8924f5120f random: modernize XoRoShiRo128PlusPlus a bit (Pieter Wuille)
ddb7d26cfd random: add RandomMixin::randbits with compile-known bits (Pieter Wuille)
21ce9d8658 random: Improve RandomMixin::randbits (Pieter Wuille)
9b14d3d2da random: refactor: move rand* utilities to RandomMixin (Pieter Wuille)
40dd86fc3b random: use BasicByte concept in randbytes (Pieter Wuille)
27cefc7fd6 random: add a few noexcepts to FastRandomContext (Pieter Wuille)
b3b382dde2 random: move rand256() and randbytes() to .h file (Pieter Wuille)
493a2e024e random: write rand256() in function of fillrand() (Pieter Wuille)

Pull request description:

  This PR contains a number of vaguely-related improvements to the random module.

  The specific changes and more detailed rationale is in the commit messages, but the highlights are:

  * `XoRoShiRo128PlusPlus` (previously a test-only RNG) moves to random.h and becomes `InsecureRandomContext`, which is even faster than `FastRandomContext` but non-cryptographic. It also gets all helper randomness functions (`randrange`, `fillrand`, ...), making it a lot more succinct to use.
  * During tests, **all** randomness is made deterministic (except for `GetStrongRandBytes`) but non-repeating (like `GetRand()` used to be when `g_mock_deterministic_tests` was used), either fixed, or from a random seed (overridden by env var).
  * Several infrequently used top-level functions (`GetRandMillis`, `GetRandMicros`, `GetExponentialRand`) are converted into member functions of `FastRandomContext` (and `InsecureRandomContext`).
  * `GetRand<T>()` (without argument) can now return the maximum value of the type (previously e.g. `GetRand<uint32_t>()` would never return 0xffffffff).

ACKs for top commit:
  achow101:
    ACK ce8094246e
  maflcko:
    re-ACK ce8094246e 🐈
  hodlinator:
    ACK ce8094246e
  dergoegge:
    utACK ce8094246e

Tree-SHA512: 79bc0cbafaf27e95012c1ce2947a8ca6f9a3c78af5f1f16e69354b6fc9b987a28858adf4cd356dc5baf21163e9af8dcc24e70f8d7173be870e8a3ddcdd47c02c
2024-07-04 11:26:43 +01:00
willcl-ark
dea7afd5e4
lint: remove unneeded trailing line fix 2024-07-03 11:14:01 +01:00
willcl-ark
4d942547a8
lint: ignore files ignored by git in mlc
Updating to MLC v0.18.0 includes a new feature which will ignore all
files ignored by git: `--gitignore`.

This helps avoid false-positives flagged by this linter in non-project
files, such as a developer might expect to have in their directory (e.g.
guix-builds, python venvs, etc.)
2024-07-03 09:46:15 +01:00
willcl-ark
7e36dca657
test: add test for modififed walletprocesspsbt calls
This test checks that we can successfully process PSBTs and opt out of
finalization.

Previously trying to call `walletprocesspsbt` would attempt to
auto-finalize (as a convenience), and would not permit opt-out of
finalization, instead aborting via `CHECK_NONFATAL`.
2024-07-03 09:16:17 +01:00
Ava Chow
173ab0ccf2
Merge bitcoin/bitcoin#29720: rpc: Avoid getchaintxstats invalid results
2342b46c45 test: Add coverage for getchaintxstats in assumeutxo context (Fabian Jahr)
faf2a6750b rpc: Reorder getchaintxstats output (MarcoFalke)
fa2dada0c9 rpc: Avoid getchaintxstats invalid results (MarcoFalke)

Pull request description:

  The `getchaintxstats` RPC reply during AU background download may return non-zero, but invalid, values for `window_tx_count` and `txrate`.

  For example, `txcount` may be zero for a to-be-downloaded block, but may be non-zero for an ancestor block which is already downloaded. Thus, the values returned may be negative (and cause intermediate integer sanitizer violations).

  Also, `txcount` may be accurate for the snapshot base block, or a descendant of it. However it may be zero for an ancestor block that still needs to be downloaded. Thus, the values returned may be positive, but wrong.

  Fix all issues by skipping the returned value if either `txcount` is unset (equal to zero).
  Also, skip `txcount` in the returned value, if it is unset (equal to zero).

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

ACKs for top commit:
  fjahr:
    re-ACK 2342b46c45
  achow101:
    ACK 2342b46c45
  mzumsande:
    ACK 2342b46c45

Tree-SHA512: 931cecc40ee5dc0f96be728db7eb297155f8343076cd29c8b8c050c99fd1d568b80f54c9459a34ca7a9489c2474c729796d00eeb1934d6a9f7b4d6a53e3ec430
2024-07-02 18:02:26 -04:00
Ava Chow
3325a0afa4
Merge bitcoin/bitcoin#30272: doc: use TRUC instead of v3 and add release note
926b8e39dc [doc] add release note for TRUC (glozow)
19a9b90617 use version=3 instead of v3 in debug strings (glozow)
881fac8e60 scripted-diff: change names from V3 to TRUC (glozow)
a573dd2617 [doc] replace mentions of v3 with TRUC (glozow)
089b5757df rename mempool_accept_v3.py to mempool_truc.py (glozow)
f543852a89 rename policy/v3_policy.* to policy/truc_policy.* (glozow)

Pull request description:

  Adds a release note for TRUC policy which will be live in v28.0.

  For clarity, replaces mentions of "v3" with "TRUC" in most places. Suggested in
  - https://github.com/bitcoin/bitcoin/pull/29496#discussion_r1629749583
  - https://github.com/bitcoin/bitcoin/pull/29496#discussion_r1624500904

  I changed error strings from "v3-violation" to "TRUC-violation" but left v3 in the debug strings because I think it might be clearer for somebody who is debugging. Similarly, I left some variables unchanged because I think they're more descriptive this way, e.g. `tx_v3_from_v2_and_v3`. I'm happy to debate places that should or shouldn't be documented differently in this PR, whatever is clearest to everyone.

ACKs for top commit:
  instagibbs:
    reACK 926b8e39dc
  achow101:
    ACK 926b8e39dc
  ismaelsadeeq:
    Code review ACK 926b8e39dc

Tree-SHA512: 16c88add0a29dc6d1236c4d45f34a17b850f6727b231953cbd52eb9f7268d1d802563eadfc8b7928c94ed3d7a615275dd103e57e81439ebf3ba2b12efa1e42af
2024-07-02 17:49:32 -04:00
Ava Chow
9251bc7111
Merge bitcoin/bitcoin#30267: assumeutxo: Check snapshot base block is not in invalid chain
2f9bde69f4 test: Remove unnecessary restart in assumeutxo test (Fabian Jahr)
19ce3d407e assumeutxo: Check snapshot base block is not marked invalid (Fabian Jahr)
80315c0118 refactor: Move early loadtxoutset checks into ActiveSnapshot (Fabian Jahr)

Pull request description:

  This was discovered in a discussion in #29996

  If the base block of the snapshot is marked invalid or part of an invalid chain, we currently still load the snapshot and get stuck in a weird state where we have the snapshot chainstate but it will never connect to our valid chain.

  While this scenario is highly unlikely to occur on mainnet, it still seems good to prevent this inconsistent state.

  The behavior change described above is in the second commit.

  The first commit refactors the early checks in the `loadtxoutset` RPC by moving them into `ActivateSnapshot()` in order to have the chance to cover them by unit tests in the future and have a more consistent interface. Previously checks were spread out between `rpc/blockchain.cpp` and `validation.cpp`. In order to be able to return the error message to users of the RPC, the return type of `ActivateSnapshot()` is changed from `bool` to `util::Result`.

  The third commit removes an unnecessary restart introduced in #29428.

ACKs for top commit:
  mzumsande:
    re-ACK 2f9bde6
  alfonsoromanz:
    Re-ACK 2f9bde69f4. The RPC code looks much cleaner after the refactor. Also, it seems very useful to get the error message in the RPC response rather than having to rely on the logs in some scenarios if you are an RPC user.
  achow101:
    ACK 2f9bde69f4

Tree-SHA512: 5328dd88c3c7be3f1be97c9eef52ac3666c27188c30a798b3e949f3ffcb83be075127c107e4046f7f39f961a79911ea3d61b61f3c11e451b3e4c541c264eeed4
2024-07-02 17:06:39 -04:00
Ava Chow
74d61151e5
Merge bitcoin/bitcoin#30365: #27307 follow-up: update mempool conflict tests + docs
7d55796c53 wallet: update mempool conflicts tests + docs (ishaanam)

Pull request description:

  #27307 follow-up:
  - updates description of `mempoolconflicts` and `walletconflicts` in `gettransaction`
  - adds release notes for 27307
  - removes unnecessary line from `wallet_conflicts.py`

ACKs for top commit:
  fjahr:
    ACK 7d55796c53
  achow101:
    ACK 7d55796c53
  furszy:
    utACK 7d55796c53
  tdb3:
    ACK 7d55796c53

Tree-SHA512: b3c368c7072cacdaf5fd18ecb0a88ab76ce02f65d56fce55a3316afa0989b9417c31e563aa8d9dd8f6294add154b4fdeb4ada5081c6b8a5fe9953f0e8a4812f4
2024-07-02 16:51:07 -04:00
Ava Chow
1e16b10cfa
Merge bitcoin/bitcoin#30340: test: Added coverage to Block not found error using gettxoutsetinfo
8ec24bdad8 test: Added coverage to Block not found error using gettxoutsetinfo (kevkevinpal)

Pull request description:

  #### Description
  There were no tests that checked for the `Block not found` error called in `ParseHashOrHeight` when using `gettxoutsetinfo`, this change adds coverage to it.

  You can see there are no tests that do the following by doing the below
  `grep -nri "Block not found.*gettxoutsetinfo" ./test/functional/`

  which leads to no results

ACKs for top commit:
  achow101:
    ACK 8ec24bdad8
  tdb3:
    ACK 8ec24bdad8
  kristapsk:
    ACK 8ec24bdad8
  brunoerg:
    crACK 8ec24bdad8
  alfonsoromanz:
    Re ACK 8ec24bdad8

Tree-SHA512: 2c61c681e7304c679cc3d7dd13af1b795780e85716c25c7423d68104e253d01271e048e21bc21be35dbc7ec1a4fde94e439542f3cfd669fe5a16478c5fa982ab
2024-07-02 16:35:25 -04:00
Ava Chow
6afc707c4f
Merge bitcoin/bitcoin#30339: test: add coverage for node field of getaddednodeinfo RPC
e38eadb2c2 test: change comments to `self.log.info` for `test_addnode_getaddednodeinfo` (brunoerg)
c838e3b610 test: add coverage for `node` field of `getaddednodeinfo` RPC (brunoerg)

Pull request description:

  We currently do not test a successful call to `getaddednodeinfo` filtering by `node`, we only test it with an unknown address and checks whether it fails. This PR adds coverage to it.

ACKs for top commit:
  kevkevinpal:
    ACK [e38eadb](e38eadb2c2)
  achow101:
    ACK e38eadb2c2
  tdb3:
    re ACK e38eadb2c2
  BrandonOdiwuor:
    Code Review ACK e38eadb2c2
  rkrux:
    tACK [e38eadb](e38eadb2c2)

Tree-SHA512: e9f768b7aa86e58b0b0ced089ead57040ff9a5204493da1ab99c8bc897b6dcdce7c856855f74c52010fceef19af1e12a39eee9f8f2e7294b42476b6f980fe754
2024-07-02 16:28:44 -04:00
Vasil Dimov
bca346a970
net: require P2P binds to succeed
In the Tor case, this prevents us from telling the Tor daemon to send
our incoming connections from the Tor network to an address where we
do not listen (we tried to listen but failed probably because another
application is already listening).

In the other cases (IPv4/IPv6 binds) this also prevents unpleasant
surprises caused by continuing operations even on bind failure. For
example, another application may be listening on portX, bitcoind tries
to bind on portX and portY, only succeeds with portY and continues
operation leaving the user thinking that his bitcoind is listening on
portX whereas another application is listening (the error message in
the log could easily be missed).

Avoid having the functional testing framework start multiple `bitcoind`s
that try to listen on the same `127.0.0.1:18445` (Tor listen for
regtest) if `bind_to_localhost_only` is set to `False`.

Also fix a typo in `test-shell.md` related to `bind_to_localhost_only`.

Fixes https://github.com/bitcoin/bitcoin/issues/22727
2024-07-02 14:17:51 +02:00
Vasil Dimov
9a7e5f4d68
net: don't extra bind for Tor if binds are restricted
If only `-bind=addr:port` is given (without `-bind=...=onion`) then we
would bind to `addr:port` _and_ to `127.0.0.1:8334` in addition which
may be unexpected, assuming the semantic of `-bind=addr:port` is
"bind _only_ to `addr:port`".

Change the above to not do the additional bind: if only
`-bind=addr:port` is given (without `-bind=...=onion`) then bind to
`addr:port` (only). If we are creating a Tor hidden service then use
`addr:port` as target (same behavior as before
https://github.com/bitcoin/bitcoin/pull/19991).

This allows disabling binding on the onion port.

Fixes https://github.com/bitcoin/bitcoin/issues/22726
2024-07-02 14:17:50 +02:00