Commit graph

41539 commits

Author SHA1 Message Date
Ava Chow
cddc0ba9a9 rpc: Have deriveaddresses derive receiving and change
When given a multipath descriptor, derive all of the descriptors.
The derived addresses will be returned in an object
consisting of multiple arrays. For compatibility, when given a single path
descriptor, the addresses are provided in a single array as before.
2024-08-08 12:47:37 -04:00
Ava Chow
360456cd22 tests: Multipath descriptors for getdescriptorinfo 2024-08-08 12:47:24 -04:00
Ava Chow
a90eee444c tests: Add unit tests for multipath descriptors 2024-08-08 12:47:24 -04:00
Ava Chow
1bbf46e2da descriptors: Change Parse to return vector of descriptors
When given a descriptor which contins a multipath derivation specifier,
a vector of descriptors will be returned.
2024-08-08 12:47:22 -04:00
Ava Chow
0d640c6f02 descriptors: Have ParseKeypath handle multipath specifiers
Multipath specifiers are derivation path indexes of the form `<i;j;k;...>`
used for specifying multiple derivation paths for a descriptor.
Only one multipath specifier is allowed per PubkeyProvider.
This is syntactic sugar which is parsed into multiple distinct descriptors.
One descriptor will have all of the `i` paths, the second all of the `j` paths,
the third all of the `k` paths, and so on.

ParseKeypath will always return a vector of keypaths with the same size
as the multipath specifier. The callers of this function are updated to deal
with this case and return multiple PubkeyProviders. Their callers have
also been updated to handle vectors of PubkeyProviders.

Co-Authored-By: furszy <matiasfurszyfer@protonmail.com>
2024-08-08 12:46:34 -04:00
Ava Chow
a5f39b1034 descriptors: Change ParseScript to return vector of descriptors
To prepare for returning multipath descriptors which will be a shorthand
for specifying multiple descriptors, change ParseScript's signature to return a
vector.
2024-08-08 12:46:32 -04:00
Ava Chow
0d55deae15 descriptors: Add DescriptorImpl::Clone 2024-08-07 16:28:59 -04:00
Ava Chow
7e86541f72 descriptors: Add PubkeyProvider::Clone 2024-08-07 16:28:57 -04:00
glozow
79b8472040
Merge bitcoin/bitcoin#30393: refactor: use existing RNG object in ProcessGetBlockData
fa2e74879a net_processing: use existing RNG object in ProcessGetBlockData (MarcoFalke)

Pull request description:

  Small follow-up to commit 8e31cf9c9b

ACKs for top commit:
  dergoegge:
    Code review ACK fa2e74879a
  glozow:
    ACK fa2e74879a

Tree-SHA512: 12709c79e6eefad184609b7306e0f65cb00123e39636cf8b7d538feb25c05ba3c36aa41468886c904a5f44fea267e67f9c4fbbab8733753d1c891b90fa40ce8b
2024-07-09 14:38:03 +01: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
Ryan Ofsky
94d56b9def
Merge bitcoin/bitcoin#30141: kernel: De-globalize validation caches
606a7ab862 kernel: De-globalize signature cache (TheCharlatan)
66d74bfc45 Expose CSignatureCache class in header (TheCharlatan)
021d38822c kernel: De-globalize script execution cache hasher (TheCharlatan)
13a3661aba kernel: De-globalize script execution cache (TheCharlatan)
ab14d1d6a4 validation: Don't error if maxsigcachesize exceeds uint32::max (TheCharlatan)

Pull request description:

  The validation caches are currently setup independently from where the rest of the validation code is initialized. This makes their ownership semantics unclear. There is also no clear enforcement on when and in what order they need to be initialized. The caches are always initialized in the `BasicTestingSetup` although a number of tests don't actually need them.

  Solve this by moving the caches from global scope into the `ChainstateManager` class. This simplifies the usage of the kernel library by no longer requiring manual setup of the caches prior to using the `ChainstateManager`. Tests that need to access the caches can instantiate them independently.

  ---
  This pull request is part of the [libbitcoinkernel project](https://github.com/bitcoin/bitcoin/issues/27587).

ACKs for top commit:
  stickies-v:
    re-ACK 606a7ab862
  glozow:
    reACK 606a7ab
  ryanofsky:
    Code review ACK 606a7ab862. Just small formatting, include, and static_assert changes since last review.

Tree-SHA512: e7f3ee41406e3b233832bb67dc3a63c4203b5367e5daeed383df9cb590f227fcc62eae31311029c077d5e81b273a37a88a364db3dee2efe91bb3b9c9ddc8a42e
2024-07-08 12:14:12 -04:00
merge-script
1c11089c7f
Merge bitcoin/bitcoin#30263: build: Bump clang minimum supported version to 16
fa8f53273c refactor: Remove no longer needed clang-15 workaround for std::span (MarcoFalke)
9999dbc1bd fuzz: Clarify Apple-Clang-16 workaround (MarcoFalke)
fa7462c67a build: Bump clang minimum supported version to 16 (MarcoFalke)

Pull request description:

  Most supported operating systems ship with clang-16 (or later), so bump the minimum to that and allow new code to drop workarounds for previous clang bugs.

  For reference:
  * https://packages.debian.org/bookworm/clang-16
  * https://packages.ubuntu.com/noble/clang (clang-18)
  * CentOS-like 8/9 Stream: All Clang versions from 16 to 17
  * FreeBSD 12/13: All Clang versions from 16 to 18
  * OpenSuse Tumbleweed ships with https://software.opensuse.org/package/clang (`clang18`); No idea about OpenSuse Leap

  On operating systems where the clang version is not shipped by default, the user would have to use GCC, or install clang in a different way. For example:

  * https://packages.debian.org/bookworm/g++ (g++-12)
  * https://packages.ubuntu.com/jammy/g++ (g++-11)
  * https://apt.llvm.org/, or nix, or guix, or compile clang from source, ...

  **Ubuntu 22.04 LTS does not ship with clang-16**, so one of the above workarounds is needed there.

  macOS 13 is unaffected, and the previous minimum requirement of Xcode15.0 remains, see also b1ba1b178f/.github/workflows/ci.yml (L93). For macOS 11 (Big Sur) and 12 (Monterey) you need to install a more recent version of llvm, this remains unchanged as well, see b1ba1b178f/doc/build-osx.md (L54).

ACKs for top commit:
  hebasto:
    ACK fa8f53273c, I have reviewed the code and it looks OK.
  TheCharlatan:
    Re-ACK fa8f53273c
  stickies-v:
    ACK fa8f53273c

Tree-SHA512: 18b79f88301a63bb5e367d2f52fffccd5fb84409061800158e51051667f6581a4cd71d4859d4cfa6d23e47e92963ab637e5ad87e3170ed23b5bebfbe99e759e2
2024-07-08 16:20:17 +01:00
glozow
a83f050dbe
Merge bitcoin/bitcoin#30404: Use WITH_LOCK in Warnings::Set
6af51e8198 Use WITH_LOCK in Warnings::Set (Ava Chow)

Pull request description:

  The scope of the lock should be limited to just guarding m_warnings as anything listening on `NotifyAlertChanged` may execute code that requires the lock as well.

  Fixes #30400

ACKs for top commit:
  maflcko:
    lgtm ACK 6af51e8198
  TheCharlatan:
    ACK 6af51e8198
  glozow:
    ACK 6af51e8198
  willcl-ark:
    ACK 6af51e8198
  stickies-v:
    ACK 6af51e8198

Tree-SHA512: 9884046c70dcad996276931b6d154f0330200332403828f34f7f7b285fc0e770ba7b25056131ab24dcb8a4b18f58d31633aa17fbb09b0eaea8a29e28fca10ec4
2024-07-08 15:50:46 +01:00
Ryan Ofsky
e53a3fb9b1
Merge bitcoin/bitcoin#30355: wallet: use LogTrace for walletdb log messages at trace level
46819f5df6 wallet: use LogTrace for walletdb log messages at trace level (Anthony Towns)

Pull request description:

  Wallet sqlite logging is enabled by `-debug=walletdb -loglevel=walletdb:trace` however the actual log messages are sent at `BCLog::Level::Info`. Switch to the trace level to make this consistent. This adds `[walletdb:trace]` to the log output, eg:

  ```
  [httpworker.3] [wallet/sqlite.cpp:55] [TraceSqlCallback] [/tmp/bitcoin_func_test_4fsnatpg/node0/regtest/wallets/boring/wallet.dat] SQLite Statement: BEGIN EXCLUSIVE TRANSACTION
  ```

  becomes

  ```
  [httpworker.0] [wallet/sqlite.cpp:55] [TraceSqlCallback] [walletdb:trace] [/tmp/bitcoin_func_test_9lcwth4z/node0/regtest/wallets/boring/wallet.dat] SQLite Statement: BEGIN EXCLUSIVE TRANSACTION
  ```

ACKs for top commit:
  maflcko:
    ACK 46819f5df6
  ryanofsky:
    Code review ACK 46819f5df6. Nice catch!
  furszy:
    ACK 46819f5df6
  luke-jr:
    utACK 46819f5df6

Tree-SHA512: 6fc1bc63c2ee686d4ca8f4f558f06c0cd9e7813b5fce1588351f55ef8bedfc23c97ea443e54a6a447008fa79ea022b6d631cb010929932f1db23fa8e255e6482
2024-07-08 10:26:24 -04:00
Ava Chow
6af51e8198 Use WITH_LOCK in Warnings::Set
The scope of the lock should be limited to just guarding m_warnings as
anything listening on `NotifyAlertChanged` may execute code that
requires the lock as well.
2024-07-06 13:00:53 -04:00
MarcoFalke
fa2e74879a
net_processing: use existing RNG object in ProcessGetBlockData
Minor follow-up to 8e31cf9c9b, which did
the same.
2024-07-05 16:59:31 +02:00
TheCharlatan
606a7ab862
kernel: De-globalize signature cache
Move its ownership to the ChainstateManager class.

Next to simplifying usage of the kernel library by no longer requiring
manual setup of the cache prior to using validation code, it also slims
down the amount of memory allocated by BasicTestingSetup.

Use this opportunity to make SignatureCache RAII styled

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
2024-07-05 09:03:04 +02:00
TheCharlatan
66d74bfc45
Expose CSignatureCache class in header
This is done in preparation for the following commit. Also rename it to
SignatureCache.
2024-07-04 22:45:27 +02:00
TheCharlatan
021d38822c
kernel: De-globalize script execution cache hasher
Move it to the ChainstateManager class.
2024-07-04 22:45:25 +02:00
TheCharlatan
13a3661aba
kernel: De-globalize script execution cache
Move its ownership to the ChainstateManager class.

Next to simplifying usage of the kernel library by no longer requiring
manual setup of the cache prior to using validation code, it also slims
down the amount of memory allocated by BasicTestingSetup.
2024-07-04 22:39:37 +02:00
TheCharlatan
ab14d1d6a4
validation: Don't error if maxsigcachesize exceeds uint32::max
Instead clamp it to uint32::max if it exceeds it.

Co-authored-by: Anthony Towns <aj@erisian.com.au>
2024-07-04 22:35:29 +02:00
merge-script
bd5d1688b4
Merge bitcoin/bitcoin#29835: depends: build libevent with CMake
f59e9057e2 depends: switch libevent to CMake (Cory Fields)

Pull request description:

  Switches libevent in depends to be built with CMake.

ACKs for top commit:
  TheCharlatan:
    ACK f59e9057e2
  willcl-ark:
    ACK f59e9057e2

Tree-SHA512: 875bf9bc57653c78775a1f8192a2c964fea8f4490d733ff796d9efb00e786f0ca9a7c1a3fd610cda032273c4f2ae06394585b03567d5f241ab073c83a47cf927
2024-07-04 14:28:16 +01:00
glozow
aa61d4feb0
Merge bitcoin/bitcoin#30388: validation: Check if mempool exists before size check in ActivateSnapshot
33c48c106c validation: Check if mempool exists before asserting in ActivateSnapshot (TheCharlatan)

Pull request description:

  The mempool is an optional component of the chainstate manager, so don't assume its presence and instead check if it is there first.

ACKs for top commit:
  maflcko:
    re-ACK 33c48c106c
  fjahr:
    ACK 33c48c106c

Tree-SHA512: 7a3568d5b7af45efa7bf54bae7bac1f00dc99bc9d47a744d73594f283c952be9500168f680d72f4aee09761da4e878ddca83ba675cdea8ee9e44eeff00ac09da
2024-07-04 14:23:54 +01: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
TheCharlatan
33c48c106c
validation: Check if mempool exists before asserting in ActivateSnapshot 2024-07-04 09:57:56 +02:00
merge-script
3714692644
Merge bitcoin/bitcoin#30380: lint: Ignore files ignored by git in the Markdown Link Checker
dea7afd5e4 lint: remove unneeded trailing line fix (willcl-ark)
4d942547a8 lint: ignore files ignored by git in mlc (willcl-ark)

Pull request description:

  Updating to MLC v0.18.0 includes a new feature which will ignore all files ignored by git: `mlc --gitignore`.

  This helps avoid false-positives flagged by this linter in non-project files, such as a developer might expect to have in their working directory (e.g. guix-builds, python venvs, etc.)

Top commit has no ACKs.

Tree-SHA512: 1752448e0c85abd3c73570a17cc69294de2248d7773c6499833ae33806f6c03f3f345261aa7b855a557b45982fbdcb8190e758d087c43b4fb0254fbb39173432
2024-07-03 11:42:32 +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
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
be63674c18
Merge bitcoin/bitcoin#30324: optimization: Moved repeated -printpriority fetching out of AddToBlock
323ce30308 Moved the repeated -printpriority fetching out of AddToBlock (Lőrinc)

Pull request description:

  `AddToBlock` was called repeatedly from `addPackageTxs` where the constant value of `printpriority` is recalculated every time.

  <img src="https://github.com/bitcoin/bitcoin/assets/1841944/6fd89647-7b6c-4f44-bd04-98d16cd2a938">

  This showed up during profiling of AssembleBlock, fetching it once in the constructor results in a small speed increase for many iterations.

  > ./src/bench/bench_bitcoin --filter='AssembleBlock' --min-time=10000

  before:
  |               ns/op |                op/s |    err% |     total | benchmark
  |--------------------:|--------------------:|--------:|----------:|:----------
  |          156,460.15 |            6,391.40 |    0.1% |     11.03 | `AssembleBlock`

  after:
  |               ns/op |                op/s |    err% |     total | benchmark
  |--------------------:|--------------------:|--------:|----------:|:----------
  |          149,289.55 |            6,698.39 |    0.3% |     10.97 | `AssembleBlock`

  ---

  The slight speedup shows up in CI as well:
  <img src="https://github.com/bitcoin/bitcoin/assets/1841944/3be779c9-2dce-4a96-ae5f-cab5435bd72f">

ACKs for top commit:
  maflcko:
    ACK 323ce30308
  achow101:
    ACK 323ce30308
  tdb3:
    re ACK 323ce30308
  furszy:
    utACK 323ce30308

Tree-SHA512: c2a0aab429646453ad0470956529f1cac8c38778c4c53f82c92c6cbaaaeb69f3d3603c0014ff097844b151e9da7caa2371a4676244caea96527cb540e66825a3
2024-07-02 16:43:45 -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
glozow
926b8e39dc [doc] add release note for TRUC 2024-07-02 12:20:12 +01:00
glozow
19a9b90617 use version=3 instead of v3 in debug strings
Make it more clear to the user what we mean by v3.
2024-07-02 12:20:12 +01:00
glozow
881fac8e60 scripted-diff: change names from V3 to TRUC
-BEGIN VERIFY SCRIPT-
sed -i 's/SingleV3Checks/SingleTRUCChecks/g' $(git grep -l 'SingleV3Checks')
sed -i 's/PackageV3Checks/PackageTRUCChecks/g' $(git grep -l 'PackageV3Checks')
sed -i 's/PV3C/PTRUCC/g' src/policy/truc_policy.h
sed -i 's/V3_MAX_VSIZE/TRUC_MAX_VSIZE/g' $(git grep -l 'V3_MAX_VSIZE')
sed -i 's/V3_CHILD_MAX_VSIZE/TRUC_CHILD_MAX_VSIZE/g' $(git grep -l 'V3_CHILD_MAX_VSIZE')
sed -i 's/V3_DESCENDANT_LIMIT/TRUC_DESCENDANT_LIMIT/g' $(git grep -l 'V3_DESCENDANT_LIMIT')
sed -i 's/V3_ANCESTOR_LIMIT/TRUC_ANCESTOR_LIMIT/g' $(git grep -l 'V3_ANCESTOR_LIMIT')
sed -i 's/CheckMempoolV3Invariants/CheckMempoolTRUCInvariants/g' $(git grep -l 'CheckMempoolV3Invariants')
-END VERIFY SCRIPT-
2024-07-02 12:06:07 +01:00
glozow
a573dd2617 [doc] replace mentions of v3 with TRUC
Keep mentions of v3 in debug strings to help people who might not know
that TRUC is applied when version=3.
Also keep variable names in tests, as it is less verbose to keep v3 and v2.
2024-07-02 12:06:07 +01:00
glozow
089b5757df rename mempool_accept_v3.py to mempool_truc.py 2024-07-02 11:57:59 +01:00
glozow
d2c8d161b4
Merge bitcoin/bitcoin#30344: kernel: remove mempool_persist
f1478c0545 mempool: move LoadMempool/DumpMempool to node (Cory Fields)
6d242ff1e9 kernel: remove mempool_persist.cpp (Cory Fields)

Pull request description:

  DumpMempool/LoadMempool are not necessary for the kernel.

  Noticed while working on instantiated logging.

  I suppose these could have been left in on purpose, but I'm assuming it was probably just an oversight.

ACKs for top commit:
  TheCharlatan:
    Re-ACK f1478c0545
  glozow:
    ACK f1478c0545
  stickies-v:
    ACK f1478c0545

Tree-SHA512: 5825da0cf2e67470524eb6ebe397eb90755a368469a25f184df99ab935b3eb6d89eb802b41a6c3661e869bba3bbfa8ba9d95281bc75ebbf790ec5d9d1f79c66f
2024-07-02 10:25:25 +01:00
merge-script
04d63fb8c3
Merge bitcoin/bitcoin#30374: Revert "test: p2p: check that connecting to ourself leads to disconnect"
9ec2c53701 Revert "test: p2p: check that connecting to ourself leads to disconnect" (Sebastian Falbesoner)

Pull request description:

  As suggested in https://github.com/bitcoin/bitcoin/issues/30368#issuecomment-2200786670, this PR reverts the recently  added test  #30362 that causes frequent CI failures. A TODO is added in the functional test file to re-add it later when the race condition is fixed.

ACKs for top commit:
  mzumsande:
    utACK 9ec2c53701
  brunoerg:
    utACK 9ec2c53701
  tdb3:
    ACK 9ec2c53701

Tree-SHA512: df211ab194dc47f2ff8192f3827382974db922ed9fa54bc44fac75de4edfb3af43c1340cd5434b15b0b573f7b0ddd4451a0bbbbd7deaf7f4244e4865b9d5977e
2024-07-02 09:41:00 +01:00
Fabian Jahr
2342b46c45 test: Add coverage for getchaintxstats in assumeutxo context 2024-07-02 08:47:24 +02:00
MarcoFalke
faf2a6750b
rpc: Reorder getchaintxstats output 2024-07-02 08:46:06 +02:00
MarcoFalke
fa2dada0c9
rpc: Avoid getchaintxstats invalid results 2024-07-02 08:46:02 +02:00
Sebastian Falbesoner
9ec2c53701 Revert "test: p2p: check that connecting to ourself leads to disconnect"
This reverts commit 5d2fb14baf and
adds a TODO to add it later again once the race condition is fixed.
2024-07-01 20:53:16 +02:00
Pieter Wuille
ce8094246e random: replace construct/assign with explicit Reseed() 2024-07-01 12:39:57 -04:00
Pieter Wuille
2ae392d561 random: use LogError for init failure 2024-07-01 12:39:57 -04:00
Pieter Wuille
97e16f5704 tests: make fuzz tests (mostly) deterministic with fixed seed 2024-07-01 12:39:57 -04:00
Pieter Wuille
2c91330dd6 random: cleanup order, comments, static 2024-07-01 12:39:57 -04:00