Commit graph

23118 commits

Author SHA1 Message Date
Hennadii Stepanov
5c5b85d0e7
refactor: Make 64-bit shift explicit
Also this change enables MSVC warning C4334 for all codebase.

https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4334
2022-10-04 21:49:07 +01:00
fanquake
8a6b6dfcd8
fuzz: pass max fee into ConsumeTxMemPoolEntry 2022-10-04 21:12:50 +01:00
fanquake
eb15569280
fuzz: add util/mempool/h.cpp
Moving the mempool code (Boost) out of util.h, results in a ~10% speedup
(for me) when compiling the fuzz tests.
2022-10-04 21:12:50 +01:00
James O'Beirne
626b7c8493 fuzz: add scanblocks as safe for fuzzing 2022-10-04 13:51:35 -04:00
Jonas Schnelli
6ef2566b68 rpc: add scanblocks - scan for relevant blocks with descriptors
Co-authored-by: James O'Beirne <james.obeirne@gmail.com>
2022-10-04 13:51:35 -04:00
James O'Beirne
a4258f6e81 rpc: move-only: consolidate blockchain scan args
For later reuse in `scanblocks`.
2022-10-04 13:51:33 -04:00
MacroFake
dddd1acf58
net: Set relay in version msg to peers with relay permission 2022-10-04 16:07:00 +02:00
Cory Fields
192325a77d kernel: move RunCommandParseJSON to its own file
Because libbitcoinkernel does not include this new object, this has the
side-effect of eliminating the unnecessary boost::process dependency.
2022-10-04 13:51:40 +00:00
MacroFake
fa9436e908
test: Remove unused fCheckpointsEnabled from miner_tests
The earliest checkpoint is at height 11111, so this can't possibly have
any impact on this test.
2022-10-04 12:40:19 +02:00
MacroFake
914c00074b
Merge bitcoin/bitcoin#26235: refactor: move *index constants out of validation
7d14577d0f refactor: move DEFAULT_BLOCKFILTERINDEX from val to blockfilterindex (fanquake)
c87d569189 refactor: move DEFAULT_COINSTATSINDEX from validation to coinstatsindex (fanquake)
2bfc1e6aaa refactor: move DEFAULT_TXINDEX from validation to txindex (fanquake)

Pull request description:

  Move `*index` default constants out of `validation.h`.

ACKs for top commit:
  stickies-v:
    re-ACK 7d14577d0f
  aureleoules:
    ACK 7d14577d0f

Tree-SHA512: 3021db1a63ceb714dee4b91f755d1fb9a6633adb6f1081e34e4179900e7543e3a7b06fe47507d580a3a2caf52f7ede784cb36716d521c76b0404bdc798f0186a
2022-10-04 12:36:13 +02:00
MacroFake
f65a2c6f57
Merge bitcoin/bitcoin#26237: kernel: remove util/bytevectorhash.cpp
4bee62e9b8 kernel: remove util/bytevectorhash.cpp (fanquake)

Pull request description:

  This is no-longer used.

ACKs for top commit:
  hebasto:
    ACK 4bee62e9b8, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 4d61f87b640ef3c759008631433b3e6d2bd2ac54bbe0b287f32ea1569760048f17a66cfe846b94ec458a7db5d064be6da59299b9280572a3dc649df60760c63f
2022-10-04 11:34:23 +02:00
fanquake
44a29758a0
Merge bitcoin/bitcoin#26209: Update leveldb subtree
1a463c70a3 Squashed 'src/leveldb/' changes from 22f1e4a02f..e2f10b4e47 (fanquake)

Pull request description:

  Pulls in https://github.com/bitcoin-core/leveldb-subtree/pull/34: win32: fix -Wmissing-field-initializers warnings
  Related to #26090, #25972.

  Guix Build:
  ```bash
  a8c49e700309e9268ad0a503e7813775f58daf37813501775ae5831eab0cf26a  guix-build-13601da17e7a/output/aarch64-linux-gnu/SHA256SUMS.part
  3a1722403f8daf8ea152c72004fb1021f8a7241ee7f51fb0e6adeeb50881f001  guix-build-13601da17e7a/output/aarch64-linux-gnu/bitcoin-13601da17e7a-aarch64-linux-gnu-debug.tar.gz
  3b7c1f2361ef4832c305ff4b0d9eb7419f787f8cf537952d7c20be549debe0af  guix-build-13601da17e7a/output/aarch64-linux-gnu/bitcoin-13601da17e7a-aarch64-linux-gnu.tar.gz
  329cb5bc932621785a6aeca43af307279c47d87a4983ee3d59636f8e3dc27afa  guix-build-13601da17e7a/output/arm-linux-gnueabihf/SHA256SUMS.part
  4030f344c4c31cc0877c11d3b89f6ea93f930a4ae7e7976d49ad5123cc31a367  guix-build-13601da17e7a/output/arm-linux-gnueabihf/bitcoin-13601da17e7a-arm-linux-gnueabihf-debug.tar.gz
  ab50945c416b256b4c92ea0a50c0b7ec241e4c1f5803a4e7cb4ba83a6c5db888  guix-build-13601da17e7a/output/arm-linux-gnueabihf/bitcoin-13601da17e7a-arm-linux-gnueabihf.tar.gz
  604557cc73c4065697255c6971547a46cd0d6ad1cdf74261d4c73d002abe8c46  guix-build-13601da17e7a/output/arm64-apple-darwin/SHA256SUMS.part
  11e781c64fab7933df4a9b4f56357ad18dd8f149b3c9195bf2d310b58355851d  guix-build-13601da17e7a/output/arm64-apple-darwin/bitcoin-13601da17e7a-arm64-apple-darwin-unsigned.dmg
  e3fe9e278310f3dc97f463bb8cf2b930b587dba5095e18a7f38c4ef76338daad  guix-build-13601da17e7a/output/arm64-apple-darwin/bitcoin-13601da17e7a-arm64-apple-darwin-unsigned.tar.gz
  00828a9bfd74013a439b7f0254bd72904b99ff1e3a9503ef6307ee57de81c5eb  guix-build-13601da17e7a/output/arm64-apple-darwin/bitcoin-13601da17e7a-arm64-apple-darwin.tar.gz
  d80032d2509a982dc81790b3ef3cd8d44551b41047082ebc506f01bbb8830de1  guix-build-13601da17e7a/output/dist-archive/bitcoin-13601da17e7a.tar.gz
  61655cdf7c081c43275da57e5b42c21e33d7864378f3784652969ffdf7c3c2b2  guix-build-13601da17e7a/output/powerpc64-linux-gnu/SHA256SUMS.part
  3d213e2f25ca72dc0c3d372c0ad3f6803865825a233b29dd80b5cff3e3963621  guix-build-13601da17e7a/output/powerpc64-linux-gnu/bitcoin-13601da17e7a-powerpc64-linux-gnu-debug.tar.gz
  ef8cad747428b6b46c5d2c598fb7896b320a5321cf9a0c9dba2209c638bfbc7b  guix-build-13601da17e7a/output/powerpc64-linux-gnu/bitcoin-13601da17e7a-powerpc64-linux-gnu.tar.gz
  2302e022394ca46570c70bc5977f35bbed258bfbb19c2c6d80f1982a725c9e35  guix-build-13601da17e7a/output/powerpc64le-linux-gnu/SHA256SUMS.part
  5ca3104b7d546c7d905f82dfd92b5350af754e3973b533adc50c6cbde8f59f96  guix-build-13601da17e7a/output/powerpc64le-linux-gnu/bitcoin-13601da17e7a-powerpc64le-linux-gnu-debug.tar.gz
  2781824d8d08f8ac6663925db8b2d1b50b80165e67ed69df86580438284f0c3b  guix-build-13601da17e7a/output/powerpc64le-linux-gnu/bitcoin-13601da17e7a-powerpc64le-linux-gnu.tar.gz
  24a73f91c5ab9e72f2471cd7b31482c702a3de8dade9aff6b76af34253748cec  guix-build-13601da17e7a/output/riscv64-linux-gnu/SHA256SUMS.part
  b09658af4bd24eb5e76bacbfc7f8750a8941f117511b5c55a44ef1beffec8367  guix-build-13601da17e7a/output/riscv64-linux-gnu/bitcoin-13601da17e7a-riscv64-linux-gnu-debug.tar.gz
  56bde3f3df115dbf801944e4f923a08752fd05cda0bbf0e0e3c915387f98e4a8  guix-build-13601da17e7a/output/riscv64-linux-gnu/bitcoin-13601da17e7a-riscv64-linux-gnu.tar.gz
  ca9a5acb332fb2ffda42e44d84b58e273a769e94f0abaaa0623ed1d1c5267dde  guix-build-13601da17e7a/output/x86_64-apple-darwin/SHA256SUMS.part
  ccae805bca5d4075d1bccbaeca7ac40bb4dac0a97f4fd4c3c80b2d6134d6acb0  guix-build-13601da17e7a/output/x86_64-apple-darwin/bitcoin-13601da17e7a-x86_64-apple-darwin-unsigned.dmg
  b12c9682b69b3662150abd6680bb60f9fef656a1fdc3cd21951c2da571be40cc  guix-build-13601da17e7a/output/x86_64-apple-darwin/bitcoin-13601da17e7a-x86_64-apple-darwin-unsigned.tar.gz
  fd3378e4d60f0ef3ae1b18f526e96ed9e838df4def021de332dd0b6cd20ed0c4  guix-build-13601da17e7a/output/x86_64-apple-darwin/bitcoin-13601da17e7a-x86_64-apple-darwin.tar.gz
  47c7af42153850a94d70de6489389f6faf8772d6adc88269705a12e6b894e84e  guix-build-13601da17e7a/output/x86_64-linux-gnu/SHA256SUMS.part
  876898d116041680ea6fa3bbce1becb05e45ea5bdbaf973a1465fde4bd2df26d  guix-build-13601da17e7a/output/x86_64-linux-gnu/bitcoin-13601da17e7a-x86_64-linux-gnu-debug.tar.gz
  56671e22f25ba695c7315de916c6a2d1b57d5f00982b331c68a43912ac3ebc44  guix-build-13601da17e7a/output/x86_64-linux-gnu/bitcoin-13601da17e7a-x86_64-linux-gnu.tar.gz
  f5b9b7d83ad34b7b6c3cb98b9d7878795a1f6fb7b422ffb02b23266beb76d3a6  guix-build-13601da17e7a/output/x86_64-w64-mingw32/SHA256SUMS.part
  a72cfb4ce41cad3bb24df2e4bb318edd05370e12fc31f9ba21637b3fd412dccd  guix-build-13601da17e7a/output/x86_64-w64-mingw32/bitcoin-13601da17e7a-win64-debug.zip
  4b175eac7355715884be279dd4595665912b62815f1d0186ca9874cb9e6424cb  guix-build-13601da17e7a/output/x86_64-w64-mingw32/bitcoin-13601da17e7a-win64-setup-unsigned.exe
  c45d927f0adedc3eb0a01cee0f9fa734c17d9e9a6692b0f416a3830c007b52cc  guix-build-13601da17e7a/output/x86_64-w64-mingw32/bitcoin-13601da17e7a-win64-unsigned.tar.gz
  360a5b8806c72dbfcfed616d5cec78606461d664e21fb28a44bd473a2b7c9326  guix-build-13601da17e7a/output/x86_64-w64-mingw32/bitcoin-13601da17e7a-win64.zip
  ```

ACKs for top commit:
  hebasto:
    ACK 13601da17e, I have reviewed the code and it looks OK, I agree it can be merged.
  theuni:
    ACK 13601da17e

Tree-SHA512: 1450618714a456d8969fa5bfc3ed700452e0737213af50656a0a1e0764e6063390fb528eb1889d8bf1e02e451f601f0a5bc63a02ac34ef10aeb7dc80fe41acd1
2022-10-04 10:20:26 +01:00
glozow
cda6c79190
Merge bitcoin/bitcoin#26203: wallet: Use correct effective value when checking target
d0d9cf7aea test: Check external coin effective value is used in CoinSelection (Aurèle Oulès)
76b79c1a17 wallet: Use correct effective value when checking target (Aurèle Oulès)

Pull request description:

  Fixes #26185. The following assert failed because it was not checked in the parent function.

  2bd9aa5a44/src/wallet/coinselection.cpp (L391)

ACKs for top commit:
  glozow:
    reACK d0d9cf7aea
  furszy:
    ACK d0d9cf7a

Tree-SHA512: e126daba1115e9d143f2a582c6953e7ea55e96853b6e819c7744fd7a23668f7d9854681d43ef55d8774655bc54e7e87c1c9fccd746d9e30fbf3caa82ef808ae9
2022-10-04 09:57:17 +01:00
fanquake
4bee62e9b8
kernel: remove util/bytevectorhash.cpp 2022-10-03 18:49:07 +01:00
fanquake
1730f6cb23
Merge bitcoin/bitcoin#26189: refactor: Do not discard try_lock() return value
30cc1c6609 refactor: Drop `owns_lock()` call (Hennadii Stepanov)
bff4e068b6 refactor: Do not discard `try_lock()` return value (Hennadii Stepanov)

Pull request description:

  Microsoft's C++ Standard Library uses the `[[nodiscard]]` attribute for `try_lock()`.
  See: https://github.com/microsoft/STL/blob/main/stl/inc/mutex

  This change allows to drop the current suppression for the warning C4838 and helps to prevent the upcoming warning C4858.
  See: 539c26c923

  Fixes bitcoin/bitcoin#26017.

  Split from bitcoin/bitcoin#25819.

ACKs for top commit:
  vasild:
    ACK 30cc1c6609

Tree-SHA512: ce17404e1c78af4f763129753caf8e5a0e1c91ba398778fe912f9fcc56a847e8112460d1a1a35bf905a593b7d8e0b16c6b099ad74976b67dca5f4f3eda6ff621
2022-10-03 18:21:35 +01:00
fanquake
7d14577d0f
refactor: move DEFAULT_BLOCKFILTERINDEX from val to blockfilterindex 2022-10-03 18:19:40 +01:00
fanquake
c87d569189
refactor: move DEFAULT_COINSTATSINDEX from validation to coinstatsindex 2022-10-03 18:19:39 +01:00
fanquake
2bfc1e6aaa
refactor: move DEFAULT_TXINDEX from validation to txindex 2022-10-03 18:19:39 +01:00
fanquake
b92b12e8f3
Merge bitcoin/bitcoin#25735: net: remove useless call to IsReachable() from CConnman::Bind()
9cbfe40d8a net: remove useless call to IsReachable() from CConnman::Bind() (Vasil Dimov)

Pull request description:

  `CConnman::Bind()` is called without `BF_EXPLICIT` only when passed
  either `0.0.0.0` or `::`. For those addresses `IsReachable()` is always
  true (regardless of the `-onlynet=` setting!), meaning that the `if`
  condition never evaluates to true.

  `IsReachable()` is always true for the "any" IPv4 and IPv6 addresses
  because `CNetAddr::GetNetwork()` returns `NET_UNROUTABLE` instead of
  `NET_IPV4` or `NET_IPV6` and the network `NET_UNROUTABLE` is always
  considered reachable.

  It follows that `BF_EXPLICIT` is unnecessary, remove it too.

ACKs for top commit:
  naumenkogs:
    ACK 9cbfe40d8a
  aureleoules:
    ACK 9cbfe40d8a
  mzumsande:
    ACK 9cbfe40d8a

Tree-SHA512: 4e53ee8a73ddd133fd4ff25635135b65e5c19d1fc56fe5c30337406560664616c0adff414dca47602948919f34c81073aae6bfc2871509f3912663d86750928e
2022-10-03 18:16:10 +01:00
Hennadii Stepanov
30cc1c6609
refactor: Drop owns_lock() call
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2022-10-03 12:26:37 +01:00
fanquake
c21b32ccd1
Merge bitcoin/bitcoin#26198: refactor: move Boost Datetime usage to wallet
079cf88c0d refactor: move Boost datetime usage to wallet (fanquake)

Pull request description:

  This means we don't need Boost Datetime in a `--disable-wallet` build, and it isn't included in the kernel (via time.h/cpp). Split from a larger boost removal branch/effort.

ACKs for top commit:
  hebasto:
    re-ACK 079cf88c0d
  aureleoules:
    re-ACK 079cf88c0d - rebased and two additional unit tests since my last review.
  jarolrod:
    crACK 079cf88c0d

Tree-SHA512: c84f47158a4f21902f211c059d8c4bd55ffe95a256835deee723653be08cca49eeddfc33a2316b0cd31805e81cf77eaa39c6c9dcff4cda11a26ba4c1c143974e
2022-10-03 11:13:12 +01:00
Hennadii Stepanov
5c9a27a46f
test: Use proper Boost macros instead of assertions 2022-10-03 00:00:31 +01:00
fanquake
93001b16a4
Merge bitcoin/bitcoin#26216: fuzz: Limit outpoints.size in txorphan target to avoid OOM
fa5752da6a fuzz: Limit outpoints.size in txorphan target to avoid OOM (MacroFake)

Pull request description:

  Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52008

ACKs for top commit:
  fanquake:
    ACK fa5752da6a

Tree-SHA512: f010c0eabb72ad4bbf428954f6f978e88d6d15ec3ee77536334b11c0ca605377bdaa40ecf1984f027a430d62f05e9201775f5a6b047ffa38563aeefc04958a1f
2022-10-02 16:37:40 +01:00
Aurèle Oulès
d0d9cf7aea
test: Check external coin effective value is used in CoinSelection 2022-10-02 01:34:45 +02:00
Aurèle Oulès
76b79c1a17
wallet: Use correct effective value when checking target 2022-10-02 01:34:25 +02:00
fanquake
079cf88c0d
refactor: move Boost datetime usage to wallet
This means we don't need datetime in a --disable-wallet build, and it
isn't included in the kernel.
2022-10-01 11:41:53 +01:00
MacroFake
fa5752da6a
fuzz: Limit outpoints.size in txorphan target to avoid OOM 2022-09-30 16:52:01 +02:00
MacroFake
f59e91511a
Merge bitcoin/bitcoin#26131: log: log RPC port on startup
9d14f27bdd log: log RPC port on startup (James O'Beirne)

Pull request description:

  I just spent a few hours trying to figure out why "18444" wasn't getting me to regtest's RPC server. I'm not the sharpest tool in the shed, but I was maybe understandably confused because "Bound to 127.0.0.1:18445" appears in the logs, which I assumed was the P2P port.

  This change logs the RPC listening address by default on startup, which seems like a basic piece of information that shouldn't be buried under `-debug`.

ACKs for top commit:
  dergoegge:
    ACK 9d14f27bdd
  jarolrod:
    ACK 9d14f27bdd
  aureleoules:
    ACK 9d14f27bdd

Tree-SHA512: 5c86f018c0b8d6264abf878c921afe53033b23ab4cf289276bb1ed28fdf591c9d8871a4baa4098c363cb2aa9a637d2e4e18e56b14dfc7d767ee40757d7ff2e7c
2022-09-30 16:29:22 +02:00
stickies-v
b01682a812
refactor: revert m_next_resend to not be std::atomic
Since m_next_resend is now only called from MaybeResendWalletTxs()
we don't have any potential race conditions anymore, so the usage
of std::atomic can be reverted.
2022-09-30 14:47:39 +01:00
stickies-v
9245f45670
wallet: only update m_next_resend when actually resending
We only want to relay our resubmitted transactions once every 12-36h.
By separating the timer update logic out of ResubmitWalletTransactions
and into MaybeResendWalletTxs we avoid non-relay calls (previously in
the separate ReacceptWalletTransactions function) from resetting that
timer.
2022-09-30 14:47:39 +01:00
stickies-v
7fbde8af5c
refactor: carve out tx resend timer logic into ShouldResend
Moves the logic of whether or not transactions should actually be
resent out of the function that's resending them. This reduces
responsibilities of ResubmitWalletTransactions and allows
carving out the updating of m_next_resend in a future commit.
2022-09-30 14:47:38 +01:00
MacroFake
33eef562a3
Merge bitcoin/bitcoin#26074: refactor: Set RPCArg options with designated initializers
fa2c72dda0 rpc: Set RPCArg options with designated initializers (MacroFake)

Pull request description:

  For optional constructor arguments, use a new struct. This comes with two benefits:
  * Earlier unused optional arguments can be omitted
  * Designated initializers can be used

ACKs for top commit:
  stickies-v:
    re-ACK fa2c72dda0

Tree-SHA512: 2a0619548187cc7437fee2466ac4780746490622f202659f53641be01bc2a1fea4416d1a77f3e963bf7c4cce62899b61fab0b9683440cf82f68be44f63826658
2022-09-30 10:06:14 +02:00
stickies-v
01f3534632
refactor: remove unused locks for ResubmitWalletTransactions
ReacceptWalletTransactions is replaced by ResubmitWalletTransactions
which already handles acquiring the necessary locks internally.
2022-09-29 17:32:53 +01:00
stickies-v
c6e8e11fb0
wallet: fix capitalization in docstring 2022-09-29 17:32:52 +01:00
fanquake
13601da17e
Update leveldb-subtree subtree to latest upstream 2022-09-29 16:43:30 +01:00
furszy
f1593780b8
bench: place benchmark implementation inside benchmark namespace 2022-09-28 13:27:51 -03:00
Hennadii Stepanov
b147322a7a
Use PACKAGE_NAME in messages rather than hardcoding "Bitcoin Core" 2022-09-27 23:04:37 +01:00
Hennadii Stepanov
bff4e068b6
refactor: Do not discard try_lock() return value
Microsoft's C++ Standard Library uses the `[[nodiscard]]` attribute for
`try_lock()`.
See: https://github.com/microsoft/STL/blob/main/stl/inc/mutex

This change allows to drop the current suppression for the warning C4838
and helps to prevent the upcoming warning C4858.
See: 539c26c923
2022-09-27 22:35:16 +01:00
glozow
9fcdb9f3a0
Merge bitcoin/bitcoin#26172: p2p: ProcessHeadersMessage(): fix received_new_header
bdcafb9133 p2p: ProcessHeadersMessage(): fix received_new_header (Larry Ruane)

Pull request description:

  Follow-up to #25717. The commit "Utilize anti-DoS headers download strategy" changed how this bool variable is computed, so that its value is now the opposite of what it should be.

  Prior to #25717:
  ```
  bool received_new_header{WITH_LOCK(::cs_main, return m_chainman.m_blockman.LookupBlockIndex(headers.back().GetHash()) == nullptr)};
  ```
  After #25717 (simplified):
  ```
  {
      LOCK(cs_main);
      last_received_header = m_chainman.m_blockman.LookupBlockIndex(headers.back().GetHash());
  }
  bool received_new_header{last_received_header != nullptr};
  ```

ACKs for top commit:
  dergoegge:
    ACK bdcafb9133
  glozow:
    ACK bdcafb9133, I believe this is correct and don't see anything to suggest the switch was intentional.
  stickies-v:
    ACK bdcafb9133

Tree-SHA512: 35c12762f1429585a0b1c15053e310e83efb28c3d8cbf4092fad9fe81c893f6d766df1f2b20624882acb9654d0539a0c871f587d7090dc2a198115adf59db3ec
2022-09-27 11:02:44 +01:00
MacroFake
eeac05aa22
Merge bitcoin/bitcoin#26156: test: check that listdescriptors descriptor strings are sorted
810c3dc7ef doc, rpc: mention that `listdescriptors` result is sorted by string representation (Sebastian Falbesoner)
d99af861d0 test: check that `listdescriptors` descriptor strings are sorted (Sebastian Falbesoner)

Pull request description:

  This small PR adds a test for the change introduced in PR #25931 ("rpc: sort listdescriptors result", commit 50996241f2). The correctness of the test can easily be verified by commenting out the `std::sort` call in the `listdescriptors` RPC implementation:
  ```diff
  diff --git a/src/wallet/rpc/backup.cpp b/src/wallet/rpc/backup.cpp
  index 09c74ea2da..3ed1a69b26 100644
  --- a/src/wallet/rpc/backup.cpp
  +++ b/src/wallet/rpc/backup.cpp
  @@ -1829,9 +1829,11 @@ RPCHelpMan listdescriptors()
           });
       }

  +    /*
       std::sort(wallet_descriptors.begin(), wallet_descriptors.end(), [](const auto& a, const auto& b) {
           return a.descriptor < b.descriptor;
       });
  +    */

       UniValue descriptors(UniValue::VARR);
       for (const WalletDescInfo& info : wallet_descriptors) {

  ```
  leading to a fail of the functional test `wallet_listdescriptors.py`.

ACKs for top commit:
  jarolrod:
    ACK 810c3dc7ef
  aureleoules:
    ACK 810c3dc7ef

Tree-SHA512: 31770e3149b8a0251ecfa8662a2270c149f778eb910985f48a91d6a5d288b7b1c2244f9f1b798ebe3f1aa9f0b935cb4d6f12d5d28f78bcde3c4a61af76d11d0a
2022-09-27 09:27:00 +00:00
Sebastian Falbesoner
810c3dc7ef doc, rpc: mention that listdescriptors result is sorted by string representation 2022-09-26 15:16:01 +02:00
Hennadii Stepanov
f09d47b263
bench: Add missed ECCVerifyHandle instance 2022-09-26 11:03:36 +01:00
MacroFake
ec13810a00
Merge bitcoin/bitcoin#26159: build: Remove stdlib.h from header checks
553ff452c0 build: remove stdlib.h from header checks (fanquake)
a63d4cb26a refactor: use <cstdlib> over stdlib.h (fanquake)

Pull request description:

  We already use a mix of `<cstlib>` and `stdlib.h` unconditionally throughout
  the codebase.

  Us checking this header also duplicates work already done by autotools.
  Currently stdlib.h is checked for 3 times during a ./configure run, after
  this change, at least it's only twice.

  Similar to #26150.

ACKs for top commit:
  kristapsk:
    ACK 553ff452c0
  TheCharlatan:
    ACK 553ff452c0

Tree-SHA512: 0a43d39d3df180a1614dbd3a1ee1531b0969ffe4a0c09dfe9d2f3f0ec16196b5fd7523309f6722936a8c8b20908508724e1903e939dd81c3b4538d85d0f42953
2022-09-25 11:45:41 +00:00
MacroFake
0cfbb171bd
Merge bitcoin/bitcoin#26130: Bugfix: Wallet: Lock cs_wallet for SignMessage
a60d9eb9e6 Bugfix: Wallet: Lock cs_wallet for SignMessage (Luke Dashjr)

Pull request description:

  cs_desc_main is typically locked within scope of a cs_wallet lock, but:

  CWallet::IsLocked locks cs_wallet
  ...called from DescriptorScriptPubKeyMan::GetKeys
  ...called from DescriptorScriptPubKeyMan::GetSigningProvider which locks cs_desc_main first, but has no access to cs_wallet ...called from DescriptorScriptPubKeyMan::SignMessage ...called from CWallet::SignMessage which can access and lock cs_wallet

  Resolve the out of order locks by grabbing cs_wallet in CWallet::SignMessage first

  -------------

  Note this is currently only an issue for the GUI (which lacks sufficient testing apparently), but can be reproduced by #26082 (CI fails as a result)

ACKs for top commit:
  achow101:
    ACK a60d9eb9e6
  w0xlt:
    ACK a60d9eb9e6

Tree-SHA512: 60f6959b0ceaf4d9339ba1a47154734034b637c41b1f9e26748a2dbbc3a2a95fc3696019103c55ae70c91d910ba8f3d7f4e27d263030eb60b689f290c4d82ea9
2022-09-24 14:02:13 +00:00
Larry Ruane
bdcafb9133 p2p: ProcessHeadersMessage(): fix received_new_header
Follow-up to #25717. The commit "Utilize anti-DoS headers download
strategy" changed how this bool variable is computed, so that its value
is now the opposite of what it should be.
2022-09-24 00:07:46 -06:00
fanquake
a63d4cb26a
refactor: use <cstdlib> over stdlib.h
We currently use both. Consolidate on the former.
2022-09-23 10:48:47 +01:00
Jon Atack
a3789c700b Improve getpeerinfo pingtime, minping, and pingwait help docs 2022-09-22 16:45:48 +02:00
Jon Atack
df660ddb1c Update getpeerinfo/-netinfo/TxRelay#m_relay_txs relaytxes docs (for v24 backport)
to the current p2p behavior.  We only initialize the Peer::TxRelay m_relay_txs
data structure if it isn't an outbound block-relay-only connection and fRelay=true
(the peer wishes to receive tx announcements) or we're offering NODE_BLOOM to this peer.
2022-09-22 16:45:32 +02:00
Jon Atack
1f448542e7 Always return getpeerinfo "minfeefilter" field (for v24 backport)
with its pre-existing v23 default value of 0.
2022-09-22 16:45:20 +02:00
Jon Atack
9cd6682545 Make getpeerinfo field order consistent with its help (for v24 backport)
This also keeps it consistent with the last release (v23)
2022-09-22 16:44:38 +02:00
fanquake
100949af0e
Merge bitcoin/bitcoin#26012: fuzz: Avoid timeout in bitdeque fuzz target
fa4ba04c15 fuzz: Remove no-op call to get() (MacroFake)
fa642286b8 fuzz: Avoid timeout in bitdeque fuzz target (MacroFake)

Pull request description:

  I'd guess that any bug should be discoverable within `10` ops. However, `900` seems also better than no limit at all, which causes timeouts such as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50892

ACKs for top commit:
  sipa:
    ACK fa4ba04c15

Tree-SHA512: f6bd25e78d5f04c6f88e9300c2fa3d0993a0911cb0fd1b414077adc0edde1a06ad72af5e2f50f0ab1324f91999ae57d879686c545b2e6c19ae7f637a8804bd48
2022-09-22 14:55:43 +01:00
fanquake
590d206444
Merge bitcoin/bitcoin#26150: build: remove stdio.h from header checks
55aad5f3a9 build: remove stdio.h from header checks (fanquake)
b95633121b refactor: use <cstdio> over stdio.h (fanquake)

Pull request description:

  We already use a mix of `<cstdio>` and `stdio.h` unconditionally throughout
  the codebase.

  Us checking this header also duplicates work already done by autotools.
  Currently `stdio.h` is checked for 3 times during a ./configure run, after
  this change, at least it's only twice.

ACKs for top commit:
  TheCharlatan:
    ACK 55aad5f3a9
  kristapsk:
    ACK 55aad5f3a9

Tree-SHA512: a83cc724528ab92aacfa53048b12fcccec3962637ca7fad30f6c610365edeb0e951f74e37832ad7d3f79ca9b8d7203cb10165c89d0e4b63eeda7a970dab82dfb
2022-09-22 14:45:13 +01:00
Andrew Chow
2b2c970627
Merge bitcoin/bitcoin#26149: Fix assert failure in miniscript string parsing
648f6950cd Correct sanity-checking script_size calculation (Pieter Wuille)

Pull request description:

  Fix a bug in the script_size sanity-check in the miniscript string parser, found by oss-fuzz in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51636, and introduced in e8cc2e4afc (#25540).

  This bug would cause an assertion failure when feeding a miniscript with a `thresh(k,...)` fragment, with k >= 128, to an RPC.

ACKs for top commit:
  darosior:
    utACK 648f6950cd
  achow101:
    ACK 648f6950cd

Tree-SHA512: d86a0721758cd1e42ef02050b542f0935efdc19447a1ca76a3ade96352a6ee8261eef3d4a5cbdec77bf0ad14dfed42e9eb6bd4246b816a9f6f06d786900da9e7
2022-09-21 13:17:07 -04:00
fanquake
b95633121b
refactor: use <cstdio> over stdio.h
We currently use both. Consolidate on the former.
2022-09-21 16:53:11 +01:00
Andrew Chow
25cd47de71
Merge bitcoin/bitcoin#25933: wallet: AvailableCoins, simplify output script type acquisition
58b7df3caa wallet: AvailableCoins, simplify output script type acquisition (furszy)

Pull request description:

  There is an unnecessary `ExtractDestination()` call and subsequent result parse into an `CScriptID`.

  The `Solver()` call, which we are already doing below anyway, retrieves the script type and, in the P2SH case, the program id.

ACKs for top commit:
  achow101:
    ACK 58b7df3caa
  aureleoules:
    re-ACK 58b7df3caa
  rajarshimaitra:
    ACK 58b7df3caa
  w0xlt:
    ACK 58b7df3caa

Tree-SHA512: 51080766877c34cb2232ee3a1cb6b6a62b829c9297c67b99577742b94854a737a74d248015a4603ca9b6cd0a3c9e1d6d78673ff3cc9fc65dd82deea72dc537fd
2022-09-21 11:27:37 -04:00
Pieter Wuille
648f6950cd Correct sanity-checking script_size calculation 2022-09-21 09:17:45 -04:00
fanquake
80d1598133
Merge bitcoin/bitcoin#26099: build: remove duplicate / unneeded libs from bench_bitcoin
ff7c81f63a build: remove duplicate / unneeded libs from bench_bitcoin (fanquake)

Pull request description:

  EVENT_*_LIBS are already in LDADD.
  Move wallet libs into the wallet conditional, similar to zmq.

ACKs for top commit:
  theuni:
    ACK ff7c81f63a

Tree-SHA512: 6bd92f03478d56cd38645e38c0e6c4614cdf9c745124069d0d1d80483d76f5c656e1749061455ba04c619684513a063dda3f8f4bd09fe7b66911714d83592f25
2022-09-21 11:25:47 +01:00
fanquake
b1f44ecdcd
Merge bitcoin/bitcoin#25737: rpc: treat univalue type check error as RPC_TYPE_ERROR, not RPC_MISC_ERROR
e68d380797 rpc: remove unneeded RPCTypeCheckArgument checks (furszy)
55566630c6 rpc: treat univalue type check error as RPC_TYPE_ERROR, not RPC_MISC_ERROR (furszy)

Pull request description:

  Same rationale as #26039, tackling another angle of the problem.

  #### Context
  We have the same univalue type error checking code spread/duplicated few times:
  `RPCTypeCheckObj`, `RPCTypeCheckArgument`, `UniValue::checkType`.

  In the first two functions, we are properly returning an `RPC_TYPE_ERROR` while in `UniValue::checkType`
  we are throwing an `std::runtime_error` which is caught by the RPC server request handler, who invalidly
  treats it as `RPC_MISC_ERROR` (which is a generic error return code that provides no information to the user).

  #### Proposed Changes

  Throw a custom exception from `Univalue::checkType` (instead of a plain
  `std::runtime_error`) and catch it on the RPC server request handler.

  So we properly return `RPC_TYPE_ERROR` (-3) on every arg type error and
  not the general `RPC_MISC_ERROR` (-1).

  This will allow us to remove all the `RPCTypeCheckArgument` calls. As them are redundant since #25629.

Top commit has no ACKs.

Tree-SHA512: 4e4c41851fd4e2b01a2d8b94e71513f9831f810768ebd89684caca4901e87d3677980003949bcce441f9ca607a1b38a5894839b6c492f5947b8bab8cd9423ba6
2022-09-21 11:19:44 +01:00
fanquake
97f865bb76
Merge bitcoin/bitcoin#25989: init: abort if i2p/cjdns are chosen via -onlynet but are unreachable
68209a7b5c rpc: make addpeeraddress work with cjdns addresses (Martin Zumsande)
a8a9ed67cc init: Abort if i2p/cjdns are chosen via -onlynet but unreachable (Martin Zumsande)

Pull request description:

  If the networks i2p / cjdns are chosen via `-onlynet` but the user forgot to provide `-i2psam` / `-cjdnsreachable`, no outbound connections will be made - it would be nice to inform the user about that.
  The solution proposed here mimics existing behavior for `-onlynet=onion` and non-specified `-onion`/`-proxy` where we already abort with an InitError - if reviewers would prefer to just print a warning, please say so.

  The second commit adds CJDNS support to the debug-only `addpeeraddress` RPC allowing to add CJDNS addresses to addrman for testing and debug purposes. (if `-cjdnsreachable=1`)

  This is the result of an [IRC discussion](https://bitcoin-irc.chaincode.com/bitcoin-core-dev/2022-09-01#848066;) with vasild.

ACKs for top commit:
  vasild:
    ACK 68209a7b5c
  dergoegge:
    ACK 68209a7b5c

Tree-SHA512: 6db9787f01820190f14f90a0b39e4206603421eb7521f792879094d8bbf4d4d0bfd70665eadcc40994ac7941a15ab5a8d65c4779fba5634c0e6fa66eb0972b8d
2022-09-21 11:00:47 +01:00
Andrew Chow
9e2a2b88d5
Merge bitcoin/bitcoin#26132: wallet: Fix nNextResend data race in ResubmitWalletTransactions
fad61573ed Fix nNextResend data race in ResubmitWalletTransactions (MacroFake)

Pull request description:

  Now that `ResubmitWalletTransactions` is called from more than one thread, it is no longer thread-safe.

  Introduced in 5291933fed.

ACKs for top commit:
  achow101:
    ACK fad61573ed
  jonatack:
    ACK fad61573ed
  stickies-v:
    However, I think the current data race UB fix in fad61573e is the most critical to get into v24, so: ACK fad61573e - but open to further improvements.

Tree-SHA512: 54da2ed1c5f44e33588ac1d21ce26908fcf0bfe785c28ba8f6a479389b5ab7a0b32b016d4c482a2ccb405e0686efb61ffe23e427f5e589dc7d2b3c7469978977
2022-09-20 18:48:06 -04:00
Andrew Chow
fc4017552c
Merge bitcoin/bitcoin#26116: rpc: Allow importmulti watchonly imports with locked wallet
2c03465dfa test: Test watchonly imports with passphrase-locked wallet (Aurèle Oulès)
1fcf9e6e81 rpc: Allow importmulti watchonly imports with locked wallet (Aurèle Oulès)

Pull request description:

  Allows watch-only imports on locked wallets with `importmulti`.
  Also adds a test.

  Fixes #17867.

ACKs for top commit:
  achow101:
    ACK 2c03465dfa
  kristapsk:
    re-ACK 2c03465dfa
  theStack:
    re-ACK 2c03465dfa

Tree-SHA512: 9978d6e59a230c0d160efd312c671cf59458797387d6622b6bf5c9e0681c1fcfebedb3d834fa9314dc5a1eda97e3295696352eacbeab9b43a46b942990087035
2022-09-20 12:00:02 -04:00
fanquake
5b6f0f31fa
Merge bitcoin/bitcoin#26036: net: add NetEventsInterface::g_msgproc_mutex
d575a675cc net_processing: add thread safety annotation for m_highest_fast_announce (Anthony Towns)
0ae7987f68 net_processing: add thread safety annotations for PeerManagerImpl members accessed only via the msgproc thread (Anthony Towns)
a66a7ccb82 net_processing: add thread safety annotations for Peer members accessed only via the msgproc thread (Anthony Towns)
bf12abe454 net: drop cs_sendProcessing (Anthony Towns)
1e78f566d5 net: add NetEventsInterface::g_msgproc_mutex (Anthony Towns)

Pull request description:

  There are many cases where we assume message processing is single-threaded in order for how we access node-related memory to be safe. Add an explicit mutex that we can use to document this, which allows the compiler to catch any cases where we try to access that memory from other threads and break that assumption.

ACKs for top commit:
  MarcoFalke:
    review ACK d575a675cc 📽
  dergoegge:
    Code review ACK d575a675cc
  w0xlt:
    ACK d575a675cc
  vasild:
    ACK d575a675cc modulo the missing runtime checks

Tree-SHA512: b886d1aa4adf318ae64e32ccaf3d508dbb79d6eed3f1fa9d8b2ed96f3c72a3d38cd0f12e05826c9832a2a1302988adfd2b43ea9691aa844f37d8f5c37ff20e05
2022-09-20 14:18:23 +01:00
MacroFake
fad61573ed
Fix nNextResend data race in ResubmitWalletTransactions 2022-09-20 11:49:57 +02:00
MacroFake
71ac70d877
Merge bitcoin/bitcoin#26095: script: bump codespell to 2.2.1, update ignored words and fix spelling
b6a65568df Fix issues identified by codespell 2.2.1 and update ignored words (Jon Atack)
8f2010de6e Bump codespell version to 2.2.1 (Jon Atack)

Pull request description:

  as well as one in `test/lint/lint-locale-dependence.py` not seen by the spelling linter.

  Can be tested locally by running `test/lint/lint-spelling.py` on this branch versus on master and by checking the CI linter result.

ACKs for top commit:
  satsie:
    ACK b6a65568df

Tree-SHA512: ab4ba029a9a5de5926fa5d336bd3b21245acf0649c6aa69a48c223bd22327e13beb32e970f66f54db58cd318731b643e1c7ace9a89776ed2a069cddc02363b71
2022-09-20 11:22:22 +02:00
MacroFake
d76a423809
Merge bitcoin/bitcoin#26067: util: improve bitcoin-wallet exit codes
fa2b8ae0a2 util: improve bitcoin-wallet exit codes (MacroFake)

Pull request description:

  Refactors `bitcoin-wallet` so that it doesn't return a non-zero exit code by default, and makes the option handling more inline with the other binaries. i.e outputting `Error: too few parameters` if you don't pass any options.

  Fixing this means we can check the process output in `gen-manpages.py`; which addresses the remaining [review comment](https://github.com/bitcoin/bitcoin/pull/24263#discussion_r806126705) from #24263.

Top commit has no ACKs.

Tree-SHA512: 80bd8098faefb4401ca1e4d49937ef6c960cf60ce0e7fb9dc38904fbc2fd92e319ec04570381da84943b7477845bf6be00e977f4c0451b247a6698662ce8f1bf
2022-09-20 09:54:04 +02:00
James O'Beirne
9d14f27bdd log: log RPC port on startup
I just spent a few hours trying to figure out why "18444" wasn't getting
me to regtest's RPC server. I'm not the sharpest tool in the shed, but I
was maybe understandably confused because "Bound to
127.0.0.1:18445" appears in the logs, which I assumed was the P2P port.

This change logs the RPC listening address, which seems like a basic
piece of information that shouldn't be buried in debug logs.
2022-09-19 21:43:26 -04:00
Luke Dashjr
a60d9eb9e6 Bugfix: Wallet: Lock cs_wallet for SignMessage
cs_desc_main is typically locked within scope of a cs_wallet lock, but:

CWallet::IsLocked locks cs_wallet
...called from DescriptorScriptPubKeyMan::GetKeys
...called from DescriptorScriptPubKeyMan::GetSigningProvider which locks cs_desc_main first, but has no access to cs_wallet
...called from DescriptorScriptPubKeyMan::SignMessage
...called from CWallet::SignMessage which can access and lock cs_wallet

Resolve the out of order locks by grabbing cs_wallet in CWallet::SignMessage first
2022-09-20 00:46:27 +00:00
MacroFake
9843a8c1f3
Merge bitcoin/bitcoin#26119: doc: Move -permitbaremultisig to the relay help category
faf5bb87da doc: Move -permitbaremultisig to the relay help category (MacroFake)

Pull request description:

  This transaction relay setting doesn't have anything to do with establishing p2p connections.

ACKs for top commit:
  glozow:
    concept ACK faf5bb87da
  luke-jr:
    utACK faf5bb87da, but (nit) prefer to keep it on a single line

Tree-SHA512: 436fcff5191c346fe16b3208411886e3239fb5819322673a45cf0c0f9a3070563d312da8bb5d5f6060b36d305e59e5b58928526d5042cb3dac29ce7740d17c1c
2022-09-19 18:12:34 +02:00
fanquake
9f650062fc
Merge bitcoin/bitcoin#26005: Wallet: Fix error handling (copy_file failure in RestoreWallet, and in general via interfaces)
c3e536555a Bugfix: Wallet: Return util::Error rather than non-error nullptr when CreateWallet/LoadWallet/RestoreWallet fail (Luke Dashjr)
335ff98c8a Bugfix: Wallet: Wrap RestoreWallet content in a try block to ensure exceptions become returned errors and incomplete wallet directory is removed (Luke Dashjr)

Pull request description:

  Bug 1: `copy_file` can throw exceptions, but `RestoreWallet` is expected to return a nullptr with a populated `errors` parameter. This is fixed by wrapping `copy_file` and `LoadWallet` (for good measure) in a `try` block, and converting any exceptions to the intended return style.

  Bug 2: `util::Result` turns what would have been a `false` unique_ptr into a `true` nullptr result, which leads to nullptr dereferences in at least the 3 cases of wallet creation/loading/restoring. This is fixed by keeping the pointer as a plain `std::unique_ptr` until actually returning it (ie, after the nullptr check).

  Fixes https://github.com/bitcoin-core/gui/issues/661

ACKs for top commit:
  achow101:
    ACK c3e536555a

Tree-SHA512: 4291b3dbbb147acea2e63a704324c9371bc16ecb4237f8753729b0b0a6e55c9758ad61bfe8bd432fd7b0bae95d8b63a9831e61ac8b8d5c0197b550a2e0f4a105
2022-09-19 16:10:47 +01:00
Martin Zumsande
68209a7b5c rpc: make addpeeraddress work with cjdns addresses
This allows us to add cjdns addresses to addrman for
testing and debug purposes (if -cjdnsreachable is true)
2022-09-19 11:06:43 -04:00
Martin Zumsande
a8a9ed67cc init: Abort if i2p/cjdns are chosen via -onlynet but unreachable
...because -i2psam or -cjdnsreachable are not provided.
This mimics existing behavior for -onlynet=onion and non-specified proxy.
2022-09-19 11:06:43 -04:00
MacroFake
faf5bb87da
doc: Move -permitbaremultisig to the relay help category 2022-09-19 14:09:34 +02:00
MacroFake
fabf1cdb20
Use steady clock for bench logging 2022-09-19 11:51:34 +02:00
MacroFake
faed342a23
scripted-diff: Rename time symbols
-BEGIN VERIFY SCRIPT-

 ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ':(exclude)src/versionbits.cpp') ; }

 ren nStart                 time_start
 ren nTimeStart             time_start
 ren nTimeReadFromDiskTotal time_read_from_disk_total
 ren nTimeConnectTotal      time_connect_total
 ren nTimeFlush             time_flush
 ren nTimeChainState        time_chainstate
 ren nTimePostConnect       time_post_connect
 ren nTimeCheck             time_check
 ren nTimeForks             time_forks
 ren nTimeConnect           time_connect
 ren nTimeVerify            time_verify
 ren nTimeUndo              time_undo
 ren nTimeIndex             time_index
 ren nTimeTotal             time_total
 ren nTime1                 time_1
 ren nTime2                 time_2
 ren nTime3                 time_3
 ren nTime4                 time_4
 ren nTime5                 time_5
 ren nTime6                 time_6

 ren nBlocksTotal num_blocks_total

 # Newline after semicolon
 perl -0777 -pi -e 's/; time_connect_total/;\n        time_connect_total/g' src/validation.cpp
 perl -0777 -pi -e 's/; time_/;\n    time_/g'                               src/validation.cpp

-END VERIFY SCRIPT-
2022-09-19 10:45:49 +02:00
Aurèle Oulès
1fcf9e6e81
rpc: Allow importmulti watchonly imports with locked wallet 2022-09-17 21:38:55 +02:00
furszy
58b7df3caa
wallet: AvailableCoins, simplify output script type acquisition 2022-09-17 10:29:30 -03:00
Pieter Wuille
e8cc2e4afc
Make miniscript string parsing account for exact script size as bound
Co-Authored-by: Antoine Poinsot <darosior@protonmail.com>
2022-09-17 15:12:48 +02:00
Pieter Wuille
4cb8f9a92c
Permit delaying duplicate key check in miniscript::Node construction 2022-09-17 10:47:05 +02:00
Luke Dashjr
c3e536555a Bugfix: Wallet: Return util::Error rather than non-error nullptr when CreateWallet/LoadWallet/RestoreWallet fail 2022-09-16 23:28:21 +00:00
Luke Dashjr
335ff98c8a Bugfix: Wallet: Wrap RestoreWallet content in a try block to ensure exceptions become returned errors and incomplete wallet directory is removed 2022-09-16 21:07:10 +00:00
fanquake
a688ff9046
Merge bitcoin/bitcoin#26087: build: prune BOOST_CPPFLAGS from libbitcoin_zmq
a10df7cf35 build: prune BOOST_CPPFLAGS from libbitcoin_zmq (fanquake)

Pull request description:

  Rather than including `validation.h`, which ultimately means needing boost via `txmempool.h`, include `primitives/block.h` for `CBlock`, and remove `validation.h`, as we can get `cs_main` from `node/blockstorage.h`.

ACKs for top commit:
  theuni:
    Nice. ACK a10df7cf35.
  hebasto:
    ACK a10df7cf35, tested on Linux x86_64 using theuni's [patch](e131d8f1e3) with depends.

Tree-SHA512: 792b6f9e7e7788d10333b4943609efbc798f3b187c324a0f2d5acbb2d44e3c67705dc54d698eb04c23e5af7b8b73a47f8e7974e819eac12f12ae62f28c807476
2022-09-16 14:53:53 +01:00
fanquake
3d892d8695
Merge bitcoin/bitcoin#26086: build: remove BOOST_CPPFLAGS usage from bitcoin-tx
f839697d9b build: remove BOOST_CPPFLAGS usage from bitcoin-tx (fanquake)

Pull request description:

  The only reason `BOOST_CPPFLAGS` was needed here, is because of the `policy/rbf.h` include, which ultimately includes boost multi_index via `txmempool.h`. However this include is unused.

ACKs for top commit:
  theuni:
    Nice. ACK f839697d9b.
  hebasto:
    ACK f839697d9b, tested on Linux x86_64 using theuni's [patch](e131d8f1e3) with depends.

Tree-SHA512: ec93f4045d927789d70e2a96a6869c0df63891483bb61361327bfefafaabc2925f63382aa3d9302963df2306bc035edad4cabd5eeb315db6603266e677be7cd3
2022-09-16 12:12:14 +01:00
MacroFake
5eb9781763
Merge bitcoin/bitcoin#25971: refactor: Use std::string for thread and index names
26cf9ea8e4 scripted-diff: rename pszThread to thread_name (stickies-v)
200d84d568 refactor: use std::string for index names (stickies-v)
97f5b20c12 refactor: use std::string for thread names (stickies-v)

Pull request description:

  As a follow-up to https://github.com/bitcoin/bitcoin/pull/25967#discussion_r959637189, this PR changes the return type of [`BaseIndex::GetName()`](fa5c224d44/src/index/base.h (L120)) to `const std::string&` instead of `const char*`. The first commit is not essential for this change, but since the code is touched and index names are commonly used to specify thread names, I've made the same update there.

  No behaviour change, just refactoring to further phase out C-style strings.

  Note: `util::ThreadRename()` used to take an rvalue ref, but since it then passes this to `SetInternalName()` by value, I don't think there's any benefit to having both an rvalue and lvalue ref function so I just changed it into lvalue ref. Not 100% sure I'm missing something?

ACKs for top commit:
  MarcoFalke:
    review ACK 26cf9ea8e4 only change is new scripted-diff 😀
  hebasto:
    ACK 26cf9ea8e4, I have reviewed the code and it looks OK.
  w0xlt:
    reACK 26cf9ea8e4

Tree-SHA512: 44a03ebf2bb86ca1411a36222a575217cdba8ee3a3c985e74d74c934516f002b27336147fa22f59eda7dac21204a93951563317005d475da95b23c427014d77b
2022-09-16 12:39:39 +02:00
fanquake
08785aa75b
Merge bitcoin/bitcoin#25499: Use steady clock for all millis bench logging
fa521c9603 Use steady clock for all millis bench logging (MacroFake)

Pull request description:

  Currently `GetTimeMillis` is used for bench logging in milliseconds integral precision. Replace it to use a steady clock that is type-safe and steady.

  Microsecond or float precision can be done in a follow-up.

ACKs for top commit:
  fanquake:
    ACK fa521c9603 - started making the same change.

Tree-SHA512: 86a810e496fc663f815acb8771a6c770331593715cde85370226685bc50c13e8e987e3c5efd0b4e48b36ebd2372255357b709204bac750d41e94a9f7d9897fa6
2022-09-16 11:10:15 +01:00
fanquake
2530a24689
Merge bitcoin/bitcoin#26105: Use ReadLE64 in uint256::GetUint64 instead of duplicating logic
04fee75bac Use ReadLE64 in uint256::GetUint64() instead of duplicating logic (Pieter Wuille)

Pull request description:

  No need to have a (naive) copy of the `ReadLE64` logic inside `uint256::GetUint64`, when we have an optimized function for exactly that.

ACKs for top commit:
  davidgumberg:
    ACK 04fee75bac
  jonatack:
    ACK 04fee75bac review, this use of ReadLE64() is similar to the existing invocation by Num3072::Num3072(), sanity checked that before and after this change GetUint64() returns the same result (debug build, clang 13)

Tree-SHA512: 0fc2681536a18d82408411bcc6d5c6445fb96793fa43ff4021cd2933d46514c725318da35884f428d1799023921f33f8af091ef428ceb96a50866ac53a345356
2022-09-16 10:32:23 +01:00
fanquake
19526d937f
Merge bitcoin/bitcoin#26065: i2p: use the same destination type for transient and persistent addresses
8b2891a6d1 i2p: use the same destination type for transient and persistent addresses (Vasil Dimov)

Pull request description:

  We generate our persistent I2P address with type `EdDSA_SHA512_Ed25519` (`DEST GENERATE SIGNATURE_TYPE=7`).

  Use the same type for our transient addresses which are created by the `SESSION CREATE ...` command. If not specified, then the default one is `DSA_SHA1` according to https://geti2p.net/en/docs/api/samv3.

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

ACKs for top commit:
  mzumsande:
    ACK 8b2891a6d1
  sipa:
    utACK 8b2891a6d10f4a3875010d2e8eafd78bcf378952; didn't test but verified this matches the documentation

Tree-SHA512: 1b10e7e1e274b77609d08ee9cf9d73fef8c975c51aec452ce23e15fcf41709398c697087bfdece121b1fd26bc0501fc45857a91aaab679cadd0cbb37dd94c3a7
2022-09-16 09:13:49 +01:00
Pieter Wuille
04fee75bac Use ReadLE64 in uint256::GetUint64() instead of duplicating logic 2022-09-15 16:48:50 -04:00
Andrew Chow
a56876e6b9
Merge bitcoin/bitcoin#26024: wallet: fix sendall creates tx that fails tx-size check
cc434cbf58 wallet: fix sendall creates tx that fails tx-size check (kouloumos)

Pull request description:

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

  The `sendall` RPC doesn't use `CreateTransactionInternal` as the rest of
  the wallet RPCs. [This has already been discussed in the original PR](https://github.com/bitcoin/bitcoin/pull/24118#issuecomment-1029462114).
  By not going through that path, it never checks the transaction's weight
  against the maximum tx weight for transactions we're willing to relay.
  447f50e4ae/src/wallet/spend.cpp (L1013-L1018)
  This PR adds a check for tx-size as well as test coverage for that case.

  _Note: It seems that the test takes a bit of time on slower machines,
  I'm not sure if dropping it might be for the better._

ACKs for top commit:
  glozow:
    re ACK cc434cb via range-diff. Changes were addressing https://github.com/bitcoin/bitcoin/pull/26024#discussion_r971325299 and https://github.com/bitcoin/bitcoin/pull/26024#discussion_r970651614.
  achow101:
    ACK cc434cbf58
  w0xlt:
    reACK cc434cbf58

Tree-SHA512: 64a1d8f2c737b39f3ccee90689eda1dd9c1b65f11b2c7bc0ec8bfe72f0202ce90ab4033bb0ecfc6080af8c947575059588a00938fe48e7fd553f7fb5ee03b3cc
2022-09-15 13:26:22 -04:00
Andrew Chow
96f1b2d34f
Merge bitcoin/bitcoin#26091: test: Fix syncwithvalidationinterfacequeue calls
fa1ce96184 test: Add missing syncwithvalidationinterfacequeue (MacroFake)
faa4916529 test/doc: Remove unused syncwithvalidationinterfacequeue (MacroFake)

Pull request description:

  Fixes #26071

ACKs for top commit:
  achow101:
    ACK fa1ce96184
  glozow:
    ACK fa1ce96184
  w0xlt:
    ACK fa1ce96184

Tree-SHA512: d1e101b55477360ead2b99ade5d42b922aabe293ec84fb26764e29161c5be6c534aef6f22d2cc5ea63a4bd6b6e77b701f1a7a2283b8e7e815d343a604cd77656
2022-09-15 13:17:43 -04:00
fanquake
f332c4f64d
Merge bitcoin/bitcoin#26090: fs: fully initialize _OVERLAPPED for win32
02c9e56468 fs: fully initialize _OVERLAPPED for win32 (Cory Fields)

Pull request description:

  ```bash
  fs.cpp: In member function ‘bool fsbridge::FileLock::TryLock()’:
  fs.cpp:129:32: error: missing initializer for member ‘_OVERLAPPED::InternalHigh’ [-Werror=missing-field-initializers]
    129 |     _OVERLAPPED overlapped = {0};
        |                                ^
  fs.cpp:129:32: error: missing initializer for member ‘_OVERLAPPED::<anonymous>’ [-Werror=missing-field-initializers]
  fs.cpp:129:32: error: missing initializer for member ‘_OVERLAPPED::hEvent’ [-Werror=missing-field-initializers]
  ```

  Came up in #25972. That PR is now rebased on this change.

  Closes: #26006

ACKs for top commit:
  sipsorcery:
    tACK 02c9e56468.
  hebasto:
    ACK 02c9e56468, tested on Linux x86_64:

Tree-SHA512: 6a0495c34bd952b2bb8c994a1450da7d3eee61225bb4ff0ce009c013f5e29dba94bb1c3ecef9989dc18c939909fdc8eba690a38f96da431ae9d64c23656de7d0
2022-09-15 15:32:29 +01:00
furszy
e68d380797
rpc: remove unneeded RPCTypeCheckArgument checks
No-behavior change.

Since #25629, we check the univalue type internally.
2022-09-15 10:45:18 -03:00
furszy
55566630c6
rpc: treat univalue type check error as RPC_TYPE_ERROR, not RPC_MISC_ERROR
By throwing a custom exception from `Univalue::checkType` (instead of a plain
std::runtime_error) and catching it on the RPC server request handler.

So we properly return RPC_TYPE_ERROR (-3) on arg type errors and
not the general RPC_MISC_ERROR (-1).
2022-09-15 10:24:53 -03:00
Jon Atack
b6a65568df Fix issues identified by codespell 2.2.1 and update ignored words
and also fix spelling in test/lint/lint-locale-dependence.py not caught by the
spelling linter and fix up a paragraph we are touching here in test/README.md.
2022-09-15 13:03:40 +02:00
Anthony Towns
d575a675cc net_processing: add thread safety annotation for m_highest_fast_announce 2022-09-15 20:28:55 +10:00
Anthony Towns
0ae7987f68 net_processing: add thread safety annotations for PeerManagerImpl members accessed only via the msgproc thread 2022-09-15 20:28:55 +10:00
Anthony Towns
a66a7ccb82 net_processing: add thread safety annotations for Peer members accessed only via the msgproc thread 2022-09-15 20:28:55 +10:00
kouloumos
cc434cbf58 wallet: fix sendall creates tx that fails tx-size check
The `sendall` RPC doesn't use `CreateTransactionInternal`as the rest of
the wallet RPCs and it never checks against the tx-size mempool limit.
Add a check for tx-size as well as test coverage for that case.
2022-09-15 13:22:19 +03:00
fanquake
ff7c81f63a
build: remove duplicate / unneeded libs from bench_bitcoin
EVENT_*_LIBS are already in LDADD.
Move wallet libs into the wallet conditional, similar to zmq.
2022-09-15 10:29:12 +01:00
fanquake
4b656b9ed3
build: remove unused libevent cppflags 2022-09-15 09:30:26 +01:00
fanquake
afce044bb6
build: remove unused natpmp / upnp cppflags
Their inclusion is likely just the result of copy-paste.

The only place upnp/natpmpflags  should be used is `libbitcoin_node`
(mapport.cpp).
2022-09-15 09:30:26 +01:00
MacroFake
fa1ce96184
test: Add missing syncwithvalidationinterfacequeue 2022-09-15 09:06:13 +02:00
MacroFake
718304d222
Merge bitcoin/bitcoin#26084: sendall: check if the maxtxfee has been exceeded
6f8e3818af sendall: check if the maxtxfee has been exceeded (ishaanam)

Pull request description:

  Previously the `sendall` RPC didn't check whether the fees of the transaction it creates exceed the set `maxtxfee`. This PR adds this check to `sendall` and a test case for it.

ACKs for top commit:
  achow101:
    ACK 6f8e3818af
  Xekyo:
    ACK 6f8e3818af
  glozow:
    Concept ACK 6f8e3818af. The high feerate is unlikely but sendall should respect the existing wallet options.

Tree-SHA512: 6ef0961937091293d49be16f17e4451cff3159d901c0c7c6e508883999dfe0c20ed4d7126bf74bfea8150d4c1eef961a45f0c28ef64562e6cb817fede2319f1a
2022-09-15 08:45:08 +02:00
Anthony Towns
bf12abe454 net: drop cs_sendProcessing
SendMessages() is now protected g_msgproc_mutex; so this additional
per-node mutex is redundant.
2022-09-15 14:44:42 +10:00
Anthony Towns
1e78f566d5 net: add NetEventsInterface::g_msgproc_mutex
There are many cases where we assume message processing is
single-threaded in order for how we access node-related memory to be
safe. Add an explicit mutex that we can use to document this, which allows
the compiler to catch any cases where we try to access that memory from
other threads and break that assumption.
2022-09-15 14:44:38 +10:00
Andrew Chow
2e3cd26a1a
Merge bitcoin/bitcoin#26053: rpc: bugfix, 'add_inputs' default value is true unless 'inputs' are provided
b00fc44ca5 test: add coverage for 'add_inputs' dynamic default value (furszy)
ddbcfdf3d0 RPC: bugfix, 'add_inputs' default value is true unless 'inputs' are provided (furszy)

Pull request description:

  This bugfix was meant to be in #25685, but decoupled it to try to make it part of 24.0 release.
  It's a truly misleading functionality.

  This PR doesn't change behavior in any way. Just fixes two invalid RPC help messages and adds test
  coverage for the current behavior.

  #### Description
  In both RPC commands `send()` and `walletcreatefundedpsbt` the help message says
  that `add_inputs` default value is false when it's actually dynamically set by the following statement:

  ```c++
  coin_control.m_allow_other_inputs = rawTx.vin.size() == 0;
  ```

  Which means that, by default, `add_inputs` is true unless there is any pre-set input, in which
  case, the default is false.

ACKs for top commit:
  achow101:
    ACK b00fc44ca5
  S3RK:
    ACK b00fc44ca5

Tree-SHA512: 5c68a40d81c994e0ab6de0817db69c4d3dea3a9a64a60362531bf583b7a4c37d524b740905a3f3a89cdbf221913ff5b504746625adb8622788aea93a35bbcd40
2022-09-14 16:15:03 -04:00
Hennadii Stepanov
6725030e41
qt: Update translation source file for string freeze (round 2) 2022-09-14 15:03:07 +01:00
Hennadii Stepanov
f523df1ee8
Merge bitcoin-core/gui#664: Prevent wrong handling of %2 token by Transifex
8ed2b72767 qt: Prevent wrong handling of `%2` token by Transifex (Hennadii Stepanov)

Pull request description:

  On master (124e75a41e), Transifex translation check fails for 124e75a41e/src/qt/forms/intro.ui (L206) with a message:
  > The expression '%2G' is not present in the translation.

  In "Organization Settings" --> ["Translation checks"](https://www.transifex.com/bitcoin/settings/validations/) I have changed the status of the "**Variable substitution specifiers (like "%s") are preserved in the translations.**" check from "error" to "warning" temporarily. This setting should be reverted after applying this PR change.

  [Noted](https://www.transifex.com/bitcoin/bitcoin/translate/#ru/qt-translation-024x/436102928/) by Transifex user [AHOHNMYC](https://www.transifex.com/user/profile/AHOHNMYC/).

  I faced the same issue while working on Ukrainian translation.

ACKs for top commit:
  katesalazar:
    ACK 8ed2b72767
  jarolrod:
    ACK 8ed2b72767

Tree-SHA512: 304f795ac9241ac8453c614ed18d967226d9d515f9ea079b51af5bcbe2f0760ca7dcaea5efb38207720cb7a18159c2bcd337b961bc522a128715c70e0db81061
2022-09-14 14:58:59 +01:00
Hennadii Stepanov
bc29c4d4a5
Merge bitcoin-core/gui#663: Cleanup translation comment
5f28fc8160 qt: Cleanup translation comment (Hennadii Stepanov)

Pull request description:

  An unneeded character slipped in bitcoin-core/gui#629.

ACKs for top commit:
  jarolrod:
    ACK 5f28fc8160
  jonatack:
    utACK 5f28fc8160

Tree-SHA512: 210fb626e8035786cf6859160c60b2815c813e02908c75efc71a2c64d511edd6f81b2f67f1c98b29122b990260ebf663da445ea2d01b6268e3e046ada1ca5b6e
2022-09-14 14:56:26 +01:00
MacroFake
faa4916529
test/doc: Remove unused syncwithvalidationinterfacequeue
See https://github.com/bitcoin/bitcoin/pull/25768#discussion_r958562071

Also fix doc typo from https://github.com/bitcoin/bitcoin/pull/25768#discussion_r958571943
2022-09-14 14:34:53 +02:00
Vasil Dimov
9d7ae4b66c
sync: remove unused template parameter from ::UniqueLock
The template parameter `typename Base = typename Mutex::UniqueLock` is
not used, so remove it. Use internally defined type `Base` to avoid
repetitions of `Mutex::UniqueLock`.
2022-09-14 14:17:09 +02:00
Vasil Dimov
11c190e3f1
sync: simplify MaybeCheckNotHeld() definitions by using a template
Reduce 4 of the `MaybeCheckNotHeld()` definitions to 2 by using a
template. This also makes the function usable for other
[BasicLockable](https://en.cppreference.com/w/cpp/named_req/BasicLockable)
types.
2022-09-14 14:17:01 +02:00
MacroFake
a8c3590890
Merge bitcoin/bitcoin#25831: refactor: Remove trailing semicolon from LOCK2 macro
0f0cc05e4c refactor: Remove trailing semicolon from LOCK2 (Aurèle Oulès)

Pull request description:

  Macros should not have a trailing semi-colon to avoid empty statements when using them with another semi-colon.
  Noticed this while reviewing a PR.

ACKs for top commit:
  vasild:
    ACK 0f0cc05e4c

Tree-SHA512: 97fa4d89f5131ac30e05b293f750b757d5526feed56885c6feeb403b3ac3d3d3205874bc507c3b56a8296a6e3bdc8d879b2c339784f1e6ab1963d1b8a8d7b02f
2022-09-14 13:06:25 +02:00
Cory Fields
02c9e56468
fs: fully initialize _OVERLAPPED for win32 2022-09-14 11:55:10 +01:00
stickies-v
26cf9ea8e4
scripted-diff: rename pszThread to thread_name
Since it is now a string_view instead of a const char*, update the
name to reflect that the variable is no longer a "Pointer to
String, Zero-terminated" (psz).

-BEGIN VERIFY SCRIPT-
sed -i s/pszThread/thread_name/ $(git grep -l pszThread src)
-END VERIFY SCRIPT-
2022-09-14 11:00:14 +01:00
fanquake
a10df7cf35
build: prune BOOST_CPPFLAGS from libbitcoin_zmq
Rather than including validation.h, which ultimately means needing boost
via txmempool.h, include primitives/block.h for CBlock, and remove
validation.h, as we can get cs_main from node/blockstorage.h.
2022-09-14 09:33:34 +01:00
fanquake
f839697d9b
build: remove BOOST_CPPFLAGS usage from bitcoin-tx
The only reason BOOST_CPPFLAGS is needed here, is because of the
policy/rbf.h include, which ultimately includes boost multi_index
via txmempool.h. However this include is actually unused.
2022-09-14 09:10:04 +01:00
ishaanam
6f8e3818af sendall: check if the maxtxfee has been exceeded 2022-09-13 18:12:42 -04:00
furszy
ddbcfdf3d0
RPC: bugfix, 'add_inputs' default value is true unless 'inputs' are provided
In both RPC commands `send()` and `walletcreatefundedpsbt` the RPC help was saying
that `add_inputs` default value was false when it's actually dynamically set
by the following statement:

`coin_control.m_allow_other_inputs = rawTx.vin.size() == 0;`

Which means that, by default, `add_inputs` is true unless there
was any pre-set input, in which case, the default is false.
2022-09-13 16:13:05 -03:00
stickies-v
200d84d568
refactor: use std::string for index names 2022-09-13 19:10:41 +01:00
stickies-v
97f5b20c12
refactor: use std::string for thread names 2022-09-13 19:07:39 +01:00
James O'Beirne
e4d7995286 test: add testcases for snapshot initialization 2022-09-13 13:31:23 -04:00
James O'Beirne
cced4e7336 test: move-only-ish: factor out LoadVerifyActivateChainstate()
in TestingSetup(). This is used in the following commit to test
reinitializing chainstates after snapshot validation and cleanup.

Best reviewed with `git diff --color-moved=dimmed-zebra`.
2022-09-13 13:31:23 -04:00
James O'Beirne
51fc9241c0 test: allow on-disk coins and block tree dbs in tests
Used when testing cleanup of on-disk chainstate data for snapshot
testcases. Also necessary for simulating node restart in .cpp tests.
2022-09-13 13:31:23 -04:00
James O'Beirne
3c361391b8 test: add reset_chainstate parameter for snapshot unittests
This CreateAndActivateUTXOSnapshot parameter is necessary once we
perform snapshot completion within ABC, since the existing UpdateTip
test will fail because the IBD chain that has generated the snapshot
will exceed the base of the snapshot.

Being able to test snapshots being loaded into a mostly-uninitialized
datadir allows for more realistic unittest scenarios.
2022-09-13 13:31:21 -04:00
James O'Beirne
00b357c215 validation: add ResetChainstates()
Necessary for the following test commit.
2022-09-13 13:30:28 -04:00
James O'Beirne
3a29dfbfb2 move-only: test: make snapshot chainstate setup reusable
For use in next commit.

Most easily reviewed with
`--color-moved=dimmed_zebra --color-moved-ws=allow-indentation-change`.
2022-09-13 13:30:25 -04:00
James O'Beirne
8153bd9247 blockmanager: avoid undefined behavior during FlushBlockFile
If we call FlushBlockFile() without having intitialized the block index
with LoadBlockIndexDB(), we may be indexing into an empty vector.

Specifically this is an issue when we call MaybeRebalanceCaches() during
chainstate init before the block index has been loaded, which calls
FlushBlockFile().

Also add an assert to avoid undefined behavior.

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2022-09-13 13:30:25 -04:00
James O'Beirne
ad67ff377c validation: remove snapshot datadirs upon validation failure
If a UTXO snapshot fails to validate, don't leave the resulting datadir
on disk as this will confuse initialization on next startup and we'll
get an assertion error.
2022-09-13 13:30:25 -04:00
James O'Beirne
34d1590331 add utilities for deleting on-disk leveldb data
Used in later commits to remove leveldb directories for
- invalid snapshot chainstates, and
- background-vaildation chainstates that have finished serving their
  purpose.
2022-09-13 13:30:25 -04:00
James O'Beirne
252abd1e8b init: add utxo snapshot detection
Add functionality for activating a snapshot-based chainstate if one is
detected on-disk.

Also cautiously initialize chainstate cache usages so that we don't
somehow blow past our cache allowances during initialization, then
rebalance at the end of init.

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2022-09-13 13:30:14 -04:00
James O'Beirne
f9f1735f13 validation: rename snapshot chainstate dir
This changes the snapshot's leveldb chainstate dir name from
`chainstate_[blockhash]` to `chainstate_snapshot`. This simplifies
later logic that loads snapshot data, and enforces the limitation
of a single snapshot at any given time.

Since we still need to persis the blockhash of the base block, we
write that out to a file (`chainstate_snapshot/base_blockhash`) for
later use during initialization, so that we can reinitialize the
snapshot chainstate.

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2022-09-13 13:30:12 -04:00
James O'Beirne
d14bebf100 db: add StoragePath to CDBWrapper/CCoinsViewDB
This is used in subsequent commits. It allows us to clean up UTXO
snapshot chainstate after background validation completes.
2022-09-13 12:38:06 -04:00
MacroFake
fa2c72dda0
rpc: Set RPCArg options with designated initializers 2022-09-13 18:37:15 +02:00
fanquake
12de8f6262
build: extract $(BOOST_CPPFLAGS) from $(BITCOIN_INCLUDES)
This leaves $(BITCOIN_INCLUDES) as internal dependencies, and gives
finer control over Boost includes.
2022-09-13 17:15:17 +01:00
Andrew Chow
c85688347e
Merge bitcoin/bitcoin#26021: wallet: bugfix, load a wallet with an unknown/corrupt descriptor causes a fatal error
e06676377d wallet: coverage for loading an unknown descriptor (furszy)
d26c3cc444 wallet: bugfix, load wallet with an unknown descriptor cause fatal error (furszy)

Pull request description:

  Fixes #26015

  If the descriptor entry is unrecognized (due a soft downgrade) or corrupt, the
  unserialization fails and `LoadWallet`, instead of stop there and return the error,
  continues reading all the db records. As other records tied to the unrecognized
  or corrupt descriptor are scanned, a fatal error is being thrown.

  This fixes it by catching the descriptor parse failure and return which wallet failed.
  Logging its name/path, so the user can remove it from the settings file, to prevent
  its load at startup.

  Note: added the test in a separate file intentionally.
  Will continue adding coverage for the wallet load process in follow-up PRs.

ACKs for top commit:
  achow101:
    ACK e06676377d
  Sjors:
    re-utACK e06676377d

Tree-SHA512: d1f1a5d7e944c89c97a33b25b4411a36a11edae172c22f8524f69c84a035f84c570b284679f901fe60f1300f781b76a6c17b015a8e7ad44ebd25a0c295ef260f
2022-09-13 11:51:51 -04:00
glozow
3a7e0a210c
Merge bitcoin/bitcoin#24513: CChainState -> Chainstate
00eeb31c76 scripted-diff: rename CChainState -> Chainstate (James O'Beirne)

Pull request description:

  Alright alright alright, I know: we hate refactors. We especially hate cosmetic refactors.

  Nobody knows better than I that changing broad swaths of code out from under our already-abused collaborators, only to send a cascade of rebase bankruptcies, is annoying at best and sadistic at worst. And for a rename! The indignation!

  But just for a second, imagine yourself. Programming `bitcoin/bitcoin`, on a sandy beach beneath a lapis lazuli sky. You go to type the name of what is probably the most commonly used data structure in the codebase, and you *only hit shift once*.

  What could you do in such a world? You could do anything. [The only limit is yourself.](https://zombo.com/)

  ---

  So maybe you like the idea of this patch but really don't want to deal with rebasing. You're in luck!

  Here're the commands that will bail you out of rebase bankruptcy:

  ```sh
  git rebase -i $(git merge-base HEAD master) \
    -x 'sed -i "s/CChainState/Chainstate/g" $(git ls-files | grep -E ".*\.(py|cpp|h)$") && git commit --amend --no-edit'
  # <commit changed?>
  git add -u && git rebase --continue
  ```

  ---

  ~~Anyway I'm not sure how serious I am about this, but I figured it was worth proposing.~~ I have decided I am very serious about this.

  Maybe we can have nice things every once in a while?

ACKs for top commit:
  MarcoFalke:
    cr ACK 00eeb31c76
  hebasto:
    ACK 00eeb31c76
  glozow:
    ACK 00eeb31c76, thanks for being the one to propose this
  w0xlt:
    ACK 00eeb31c76

Tree-SHA512: b828a99780614a9b74f7a9c347ce0687de6f8d75232840f5ffc26e02bbb25a3b1f5f9deabbe44f82ada01459586ee8452a3ee2da05d1b3c48558c8df6f49e1b1
2022-09-13 15:42:18 +01:00
MacroFake
141540a71f
Merge bitcoin/bitcoin#25222: refactor: Pass reference to LookUpStats
faa3d38ec6 refactor: Pass reference to LookUpStats (MacroFake)

Pull request description:

  I find it confusing to have an interface that accepts nullptr, but immediately crashes the program when someone does pass nullptr.

  Fix that.

  Also some include fixups.

ACKs for top commit:
  aureleoules:
    ACK faa3d38ec6

Tree-SHA512: f90b649e9991e137b83a9899258ee73605719c081a6b789ac27fe7fe73eb70fbb41d89479bcd536d5c3ad788a5795de8451bc1b94e5c9267dcf9636d9e4a1109
2022-09-13 14:18:18 +02:00
fanquake
94d17845d0
Merge bitcoin/bitcoin#24991: init: allow startup with -onlynet=onion -listenonion=1
2d0b4e4ff6 init: allow startup with -onlynet=onion -listenonion=1 (Vasil Dimov)

Pull request description:

  It does not make sense to specify `-onlynet=onion` without providing a
  Tor proxy (even if other `-onlynet=...` are given). This is checked
  during startup. However, it was forgotten that a Tor proxy can also be
  retrieved from "Tor control" to which we connect if `-listenonion=1`.

  So, the full Tor proxy retrieval logic is:
  1. get it from `-onion`
  2. get it from `-proxy`
  3. if `-listenonion=1`, then connect to "Tor control" and get the proxy
     from there (was forgotten before this change)

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

ACKs for top commit:
  mzumsande:
    Tested ACK 2d0b4e4ff6
  MarcoFalke:
    ACK 2d0b4e4ff6 🕸

Tree-SHA512: d1d18e07a8a40a47b7f00c31cb291a3d3a9b24eeb28c5e4720d5df4997f488583a3a010d46902b4b600d2ed1136a368e1051c133847ae165e0748b8167603dc3
2022-09-13 12:36:29 +01:00
furszy
2870a97121
RPC: unify arg type error message
We were throwing two different errors for the same problematic:

* "Expected type {expected], got {type}" --> RPCTypeCheckArgument()
* "JSON value of type {type} is not of expected type {expected}" --> UniValue::checkType()
2022-09-12 10:04:15 -03:00
MacroFake
fa2b8ae0a2
util: improve bitcoin-wallet exit codes 2022-09-12 13:11:18 +02:00
Vasil Dimov
8b2891a6d1
i2p: use the same destination type for transient and persistent addresses
We generate our persistent I2P address with type `EdDSA_SHA512_Ed25519`
(`DEST GENERATE SIGNATURE_TYPE=7`).

Use the same type for our transient addresses which are created by the
`SESSION CREATE ...` command. If not specified, then the default one is
`DSA_SHA1` according to https://geti2p.net/en/docs/api/samv3.
2022-09-12 12:55:36 +02:00
MacroFake
5558d2f549
Merge bitcoin/bitcoin#26048: mempool clean up: replace update_* structs with lambdas
1b348d2725 [mempool] replace update_descendant_state with lambda (glozow)

Pull request description:

  These were introduced in commit 5add7a74a6, when the codebase was pre-C++11. We can use lambdas now.

ACKs for top commit:
  MarcoFalke:
    review ACK 1b348d2725 👮
  w0xlt:
    ACK 1b348d2725

Tree-SHA512: b664425b395e39ecf1cfc1e731200378261cf58c3985075fdc6027731a5caf995de72ea25be99b4c0dbec2e3ee6cf940e7c577638844619c66c8494ead5da459
2022-09-12 10:10:40 +02:00
MacroFake
8ca51aa5fb
Merge bitcoin/bitcoin#26009: test: remove Boost Test from libtest_util
a7dbf74d72 test: remove Boost Test from libtest util (fanquake)

Pull request description:

  Context is the discussion here:
  https://github.com/bitcoin/bitcoin/pull/25974/files#r961541457.

  Output:
  ```bash
  [test/util/chainstate.h:38] [CreateAndActivateUTXOSnapshot] Wrote UTXO snapshot to /var/folders/sq/z88fhjzj0b19ftsd2_bjrmjm0000gn/T/test_common_Bitcoin Core/8f2783bb3dbf10c669cd892192d70efcca4bab250226856fed7ffecdb378ffc7/test_snapshot.100.dat: {"coins_written":100,"base_hash":"571d80a9967ae599cec0448b0b0ba1cfb606f584d8069bd7166b86854ba7a191","base_height":100,"path":"/var/folders/sq/z88fhjzj0b19ftsd2_bjrmjm0000gn/T/test_common_Bitcoin Core/8f2783bb3dbf10c669cd892192d70efcca4bab250226856fed7ffecdb378ffc7/test_snapshot.100.dat","txoutset_hash":"cd1ba1c3f393058ae743b7c6bdbd00c897744cdcf022c9f2f0f2b4565c08a49c","nchaintx":101}
  ```

ACKs for top commit:
  Sjors:
    tACK a7dbf74
  theuni:
    ACK a7dbf74d72

Tree-SHA512: b9511f88a1a997f44637e3f613a71780026ce519f896af4209b01639883a3b1e40543928b213935c63d3e64c1813e9960a9004e47ed7de6cb7f7e36c33199bcc
2022-09-10 08:29:48 +02:00
furszy
e06676377d
wallet: coverage for loading an unknown descriptor
Previously, this was crashing the wallet.
2022-09-09 15:35:31 -03:00
furszy
d26c3cc444
wallet: bugfix, load wallet with an unknown descriptor cause fatal error
If the descriptor entry is unrecognized/corrupt, the unserialization fails and
`LoadWallet` instead of stop there and return the error, continues reading all
the db records. As other records tied to the unrecognized/corrupted descriptor
are scanned, a fatal error is thrown.
2022-09-09 15:35:04 -03:00
James O'Beirne
00eeb31c76 scripted-diff: rename CChainState -> Chainstate
-BEGIN VERIFY SCRIPT-
sed -i 's/CChainState/Chainstate/g' $(git grep -l CChainState ':(exclude)doc/release-notes*')
-END VERIFY SCRIPT-

Co-authored-by: MacroFake <falke.marco@gmail.com>
2022-09-09 11:47:27 -04:00
MacroFake
ef5bb742f0
Merge bitcoin/bitcoin#26040: doc: comment "add only reachable addresses to addrman"
ce42570266 doc: comment "add only reachable addresses to addrman" (Kristaps Kaupe)

Pull request description:

  Proposed by Sjors during review of #25678, was likely just missed, as it also for me looks a code where comment will not hurt.

  https://github.com/bitcoin/bitcoin/pull/25678#discussion_r964482832

ACKs for top commit:
  mzumsande:
    ACK ce42570266
  vasild:
    ACK ce42570266
  Zero-1729:
    re-ACK ce42570266

Tree-SHA512: ef085d527349de07c1b43ed39e55e34b29cb0137c9509bd14a1af88206f7d4aa7dfec1dca53a9deaed67a2d0f32fa21e0b1a04d4d5d7f8a265dfab3b62bf8c54
2022-09-09 17:23:41 +02:00
glozow
1b348d2725
[mempool] replace update_descendant_state with lambda
These were introduced in commit 5add7a7, when the codebase was
pre-C++11. They are no longer necessary.
2022-09-09 11:08:02 +01:00
MacroFake
19585eeb77
Merge bitcoin/bitcoin#25853: net: update testnet torv3 hardcoded seeds for 24.x
2ef33e936e contrib: update testnet torv3 hardcoded seeds (Jon Atack)

Pull request description:

  As a follow-up to https://github.com/bitcoin/bitcoin/issues/13550 and #22060, replace the mostly unreachable testnet torv3 hardcoded seeds from v0.22 with new ones that are consistently reachable recently and that have service bit 1 set.

  This needs to be done before v24.0 to make sure onion-only testnet nodes can still connect to the network.

  Ways to test:

  - Re-generate `src/chainparamsseeds.h` with `cd contrib/seeds && python3 generate-seeds.py . > ../../src/chainparamsseeds.h`, check if git tree stays the same
  - Re-compile and create a new testnet node with `bitcoind -testnet -dnsseed=0 -onlynet=onion -proxy=127.0.0.1:9050` (or delete `~/.bitcoin/testnet3/peers.dat` and launch bitcoind with `-testnet -dnsseed=0`). Make sure there are no `addnode=` in your `bitcoin.conf`. The debug log should print "Adding fixed seeds".  Check if the node is able to connect to the network and get blocks with for ex. `watch -t ./src/bitcoin-cli -testnet -rpcwait -netinfo 4`
  - Check the addrman contains the seeds by running for ex. `bitcoin-cli -rpcwait -testnet getnodeaddresses 0 onion | jq -r '.[] | (.address + ":" + (.port|tostring) + " " + (.services|tostring))' | sort`

  - Check if the addresses are connectable, for ex. with this python script by laanwj:

  ```python3
  #!/usr/bin/env python3
  import pprint
  import subprocess
  with open('contrib/seeds/nodes_test.txt') as f:
      for line in (line for line in (line.rstrip().split('#', 1)[0] for line in f) if line):
          pprint.pprint(line)
          subprocess.call(["nc", "-v", "-x", "127.0.0.1:9050", "-z"] + line.split(':'))
  ```

  Thanks to satsie (Stacie Waleyko) for help with the list.

ACKs for top commit:
  satsie:
    ACK 2ef33e936e
  laanwj:
    ACK 2ef33e936e

Tree-SHA512: 72d27ecba243089bd49c11e921855fba626a1e09ae9b17508254a3bbec4bec341ed6c3d5a4eabc2d37f20bafb8a47ecc7d125e0dda956512a9525ad83273ffd6
2022-09-09 10:07:39 +02:00
Kristaps Kaupe
ce42570266
doc: comment "add only reachable addresses to addrman" 2022-09-09 01:39:52 +03:00
w0xlt
b8b59ff9fe gui: update the screen after loading wallet 2022-09-07 23:26:35 -03:00
fanquake
37095c7dc4
Merge bitcoin/bitcoin#25678: p2p: skip querying dns seeds if -onlynet disables IPv4 and IPv6
385f5a4c3f p2p: Don't query DNS seeds when both IPv4 and IPv6 are unreachable (Martin Zumsande)
91f0a7fbb7 p2p: add only reachable addresses to addrman (Martin Zumsande)

Pull request description:

  Currently, `-onlynet` does not work well in connection with initial peer discovery, because DNS seeds only resolve to IPv6 and IPv4 adresses:
  With `-onlynet=i2p`, we would load clearnet addresses from DNS seeds into addrman, be content our addrman isn't empty so we don't try to query hardcoded seeds (although these exist for i2p!), and never attempt to make an automatic outbound connection.
  With `-onlynet=onion` and `-proxy` set, we wouldn't load addresses via DNS, but will make AddrFetch connections (through a tor exit node) to a random clearnet peer the DNS seed resolves to (see https://github.com/bitcoin/bitcoin/issues/6808#issuecomment-147652505), thus breaching the `-onlynet` preference of the user - this has been reported in the two issues listed below.

  This PR proposes two changes:
  1.) Don't load addresses that are unreachable (so that we wouldn't connect to them) into addrman. This is already the case for addresses received via p2p addr messages, this PR implements the same for addresses received from DNS seeds and fixed seeds. This means that in the case of `-onlynet=onion`, we wouldn't load fixed seed IPv4 addresses into addrman, only the onion ones.
  2.) Skip trying the DNS seeds if neither IPv4 nor IPv6 are reachable and move directly to adding the hardcoded seeds from networks we can connect to. This is done by soft-setting `-dnsseed` to 0 in this case, unless `-dnsseed=1` was explicitly specified, in which case we abort with an `InitError`.

  Fixes #6808
  Fixes #12344

ACKs for top commit:
  naumenkogs:
    utACK 385f5a4c3f
  vasild:
    ACK 385f5a4c3f

Tree-SHA512: 33a8c29faccb2d9b937b017dba4ef72c10e05e458ccf258f1aed3893bcc37c2e984ec8de998d2ecfa54282abbf44a132e97d98bbcc24a0dcf1871566016a9b91
2022-09-07 18:28:42 +01:00
MacroFake
fc44d1796e
Merge bitcoin/bitcoin#25983: Prevent data race for pathHandlers
4296dde287 Prevent data race for `pathHandlers` (Hennadii Stepanov)

Pull request description:

  Fixes bitcoin/bitcoin#19341.

ACKs for top commit:
  ryanofsky:
    Code review ACK 4296dde287. This should protect the vector. It also seems to make the http_request_cb callback single threaded, but that seems ok, since it is just adding work queue items not actually processing requests.

Tree-SHA512: 1c3183100bbc80d8e83543da090b8f4521921cf30d444e3e4c87102bf7a1e67ccc4dfea7e9990ac49741b2a5708f259f4eced9d4049c20ae4e531461532a6aef
2022-09-07 11:27:10 +02:00
Hennadii Stepanov
8ed2b72767
qt: Prevent wrong handling of %2 token by Transifex
Transifex must expect a `%2` token in the translated string, not a
`%2GB` one.
2022-09-07 10:53:48 +02:00
Hennadii Stepanov
5f28fc8160
qt: Cleanup translation comment 2022-09-07 10:09:57 +02:00
Andrew Chow
124e75a41e
Merge bitcoin/bitcoin#26010: RPC: fix sendall docs
5182940996 RPC: fix sendall docs (Anthony Towns)

Pull request description:

  Updates the documentation for the "inputs" entry in the "options"
  parameter of the sendall RPC to match the documentation for
  createrawtransaction.

ACKs for top commit:
  achow101:
    ACK 5182940996
  Xekyo:
    ACK 5182940996

Tree-SHA512: fe78e17b2f36190939b645d7f4653d025bbac110e4a7285b49e7f1da27adac8c4d03fd5b770e3a74351066b1ab87fde36fc796f42b03897e4e2ebef4b6b6081c
2022-09-06 18:00:57 -04:00
Martin Zumsande
385f5a4c3f p2p: Don't query DNS seeds when both IPv4 and IPv6 are unreachable
This happens, for example, if the user specified -onlynet=onion or
-onlynet=i2p. DNS seeds only resolve to IPv4 / IPv6 addresses,
making their answers useless to us, since we don't want to make
connections to these.
If, within the DNS seed thread, we'd instead do fallback AddrFetch
connections to one of the clearnet addresses the DNS seed resolves to,
we might get usable addresses from other networks
if lucky, but would be violating our -onlynet user preference
in doing so.

Therefore, in this case it is better to rely on fixed seeds for networks we
want to connect to.

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2022-09-06 15:16:35 -04:00
Martin Zumsande
91f0a7fbb7 p2p: add only reachable addresses to addrman
We will not make outgoing connection to peers that are unreachable
(e.g. because of -onlynet configuration).
Therefore, it makes no sense to add them to addrman in the first place.
While this is already the case for addresses received via p2p addr
messages, this commit does the same for addresses received
from fixed seeds.
2022-09-06 15:16:17 -04:00
MacroFake
447f50e4ae
Merge bitcoin/bitcoin#25946: Update chainparams for 24.0 release
767d825e27 Update chainparams for 24.0 release (Janna)

Pull request description:

  Update chain parameters for upcoming major release.
  See [doc/release-process.md](https://github.com/bitcoin/bitcoin/blob/master/doc/release-process.md) and #24418 for review instructions.

  fixes #25921

ACKs for top commit:
  Sjors:
    tACK 767d825e27
  achow101:
    utACK 767d825e27

Tree-SHA512: 153390203c76c981cc41629a27ec3e52fec089c7ce6edba3dd4d77c875c7d8afcae64be2bd9bc8af73f70c2dc0a08666f2986ac82c9fd536b0fded10fd8dec3d
2022-09-06 17:46:45 +02:00
MacroFake
fa4ba04c15
fuzz: Remove no-op call to get() 2022-09-06 14:38:19 +02:00
Vasil Dimov
2d0b4e4ff6
init: allow startup with -onlynet=onion -listenonion=1
It does not make sense to specify `-onlynet=onion` without providing a
Tor proxy (even if other `-onlynet=...` are given). This is checked
during startup. However, it was forgotten that a Tor proxy can also be
retrieved from "Tor control" to which we connect if `-listenonion=1`.

So, the full Tor proxy retrieval logic is:
1. get it from `-onion`
2. get it from `-proxy`
3. if `-listenonion=1`, then connect to "Tor control" and get the proxy
   from there (was forgotten before this change)

Fixes https://github.com/bitcoin/bitcoin/issues/24980
2022-09-05 17:52:08 +02:00
MacroFake
fa642286b8
fuzz: Avoid timeout in bitdeque fuzz target 2022-09-05 15:38:33 +02:00
Anthony Towns
5182940996 RPC: fix sendall docs
Updates the documentation for the "inputs" entry in the "options"
parameter of the sendall RPC to match the documentation for
createrawtransaction.
2022-09-05 23:23:23 +10:00
glozow
5291933fed
Merge bitcoin/bitcoin#25768: wallet: Properly rebroadcast unconfirmed transaction chains
3405f3eed5 test: Test that an unconfirmed not-in-mempool chain is rebroadcast (Andrew Chow)
10d91c5abe wallet: Deduplicate Resend and ReacceptWalletTransactions (Andrew Chow)

Pull request description:

  Currently `ResendWalletTransactions` (used for normal rebroadcasts) will attempt to rebroadcast all of the transactions in the wallet in the order they are stored in `mapWallet`. This ends up being random as `mapWallet` is a `std::unordered_map`. However `ReacceptWalletTransactions` (used for adding to the mempool on loading) first sorts the txs by wallet insertion order, then submits them. The result is that `ResendWalletTranactions` will fail to rebroadcast child transactions if their txids happen to be lexicographically less than their parent's txid. This PR resolves this issue by combining `ReacceptWalletTransactions` and `ResendWalletTransactions` into a new `ResubmitWalletTransactions` so that the iteration code and basic checks are shared.

  A test has also been added that checks that such transaction chains are rebroadcast correctly.

ACKs for top commit:
  naumenkogs:
    utACK 3405f3eed5
  1440000bytes:
    reACK 3405f3eed5
  furszy:
    Late code review ACK 3405f3ee
  stickies-v:
    ACK 3405f3eed5

Tree-SHA512: 1240d9690ecc2ae8d476286b79e2386f537a90c41dd2b8b8a5a9c2a917aa3af85d6aee019fbbb05e772985a2b197e2788305586d9d5dac78ccba1ee5aa31d77a
2022-09-05 13:54:36 +01:00
MacroFake
1111c7e3f1
univalue: Avoid std::string copies 2022-09-05 14:24:14 +02:00
fanquake
a7dbf74d72
test: remove Boost Test from libtest util
Context is the discussion here:
https://github.com/bitcoin/bitcoin/pull/25974/files#r961541457.
2022-09-05 07:59:34 +01:00
Hennadii Stepanov
4296dde287
Prevent data race for pathHandlers 2022-09-02 12:50:12 +01:00
MacroFake
ea67232cdb
Merge bitcoin/bitcoin#25962: net: Add CNodeOptions and increase constness
377e9ccda4 scripted-diff: net: rename permissionFlags to permission_flags (Anthony Towns)
0a7fc42897 net: make CNode::m_prefer_evict const (Anthony Towns)
d394156b99 net: make CNode::m_permissionFlags const (Anthony Towns)
9dccc3328e net: add CNodeOptions for optional CNode constructor params (Anthony Towns)

Pull request description:

  Adds CNodeOptions to make it easier to add optional parameters to the CNode constructor, and makes prefer_evict and m_permissionFlags actually const.

ACKs for top commit:
  naumenkogs:
    ACK 377e9ccda4
  jonatack:
    ACK 377e9ccda4 per `git range-diff 52dcb1d 2f3602b 377e9cc`
  vasild:
    ACK 377e9ccda4
  ryanofsky:
    Code review ACK 377e9ccda4. Looks good and feel free to ignore suggestions!

Tree-SHA512: 06fd6748770bad75ec8c966fdb73b7534c10bd61838f6f1b36b3f3d6a438e58f6a7d0edb011977e5c118ed7ea85325fac35e10dde520fef249f7a780cf500a85
2022-09-02 09:50:46 +02:00
Andrew Chow
7281fac2e0
Merge bitcoin/bitcoin#25614: Severity-based logging, step 2
9580480570 Update debug logging section in the developer notes (Jon Atack)
1abaa31aa3 Update -debug and -debugexclude help docs for severity level logging (Jon Atack)
45f9282162 Create BCLog::Level::Trace log severity level (Jon Atack)
2a8712db4f Unit test coverage for -loglevel configuration option (klementtan)
eb7bee5f84 Create -loglevel configuration option (klementtan)
98a1f9c687 Unit test coverage for log severity levels (klementtan)
9c7507bf76 Create BCLog::Logger::LogLevelsString() helper function (klementtan)
8fe3457dbb Update LogAcceptCategory() and unit tests with log severity levels (klementtan)
c2797cfc60 Add BCLog::Logger::SetLogLevel()/SetCategoryLogLevel() for string inputs (klementtan)
f6c0cc0350 Add BCLog::Logger::m_category_log_levels data member and getter/setter (Jon Atack)
2978b387bf Add BCLog::Logger::m_log_level data member and getter/setter (Jon Atack)
f1379aeca9 Simplify BCLog::Level enum class and LogLevelToStr() function (Jon Atack)

Pull request description:

  This is an updated version of https://github.com/bitcoin/bitcoin/pull/25287 and the next steps in parent PR #25203 implementing, with Klement Tan, user-configurable, per-category severity log levels based on an idea by John Newbery and refined in GitHub discussions by Wladimir Van der Laan and Marco Falke.

  - simplify the `BCLog::Level` enum class and the `LogLevelToStr()` function and add documentation
  - update the logging logic to filter logs by log level both globally and per-category
  - add a hidden `-loglevel` help-debug config option to allow testing setting the global or per-category severity level on startup for logging categories enabled with the `-debug` configuration option or the logging RPC (Klement Tan)
  - add a `trace` log severity level selectable by the user; the plan is for the current debug messages to become trace, LogPrint ones to become debug, and LogPrintf ones to become info, warning, or error

  ```
  $ ./src/bitcoind -help-debug | grep -A10 loglevel
    -loglevel=<level>|<category>:<level>
         Set the global or per-category severity level for logging categories
         enabled with the -debug configuration option or the logging RPC:
         info, debug, trace (default=info); warning and error levels are
         always logged. If <category>:<level> is supplied, the setting
         will override the global one and may be specified multiple times
         to set multiple category-specific levels. <category> can be:
         addrman, bench, blockstorage, cmpctblock, coindb, estimatefee,
         http, i2p, ipc, leveldb, libevent, lock, mempool, mempoolrej,
         net, proxy, prune, qt, rand, reindex, rpc, selectcoins, tor,
         util, validation, walletdb, zmq.
  ```

  See the individual commit messages for details.

ACKs for top commit:
  jonatack:
    One final push per `git range-diff a5d5569 ce3c4c9 9580480` (should be trivial to re-ACK) to ensure this pull changes no default behavior in any way for users or the tests/CI in order to be completely v24 compatible, to update the unit test setup in general, and to update the debug logging section in the developer notes.
  klementtan:
    reACK 9580480570
  1440000bytes:
    reACK 9580480570
  vasild:
    ACK 9580480570
  dunxen:
    reACK 9580480
  brunoerg:
    reACK 9580480570

Tree-SHA512: 476a638e0581f40b5d058a9992691722e8b546471ec85e07cbc990798d1197fbffbd02e1b3d081b4978404e07a428378cdc8e159c0004b81f58be7fb01b7cba0
2022-09-01 15:57:56 -04:00
Andrew Chow
7921026a24
Merge bitcoin/bitcoin#19602: wallet: Migrate legacy wallets to descriptor wallets
53e7ed075c doc: Release notes and other docs for migration (Andrew Chow)
9c44bfe244 Test migratewallet (Andrew Chow)
0b26e7cdf2 descriptors: addr() and raw() should return false for ToPrivateString (Andrew Chow)
31764c3f87 Add migratewallet RPC (Andrew Chow)
0bf7b38bff Implement MigrateLegacyToDescriptor (Andrew Chow)
e7b16f925a Implement MigrateToSQLite (Andrew Chow)
5b62f095e7 wallet: Refactor SetupDescSPKMs to take CExtKey (Andrew Chow)
22401f17e0 Implement LegacyScriptPubKeyMan::DeleteRecords (Andrew Chow)
35f428fae6 Implement LegacyScriptPubKeyMan::MigrateToDescriptor (Andrew Chow)
ea1ab390e4 scriptpubkeyman: Implement GetScriptPubKeys in Legacy (Andrew Chow)
e664af2976 Apply label to all scriptPubKeys of imported combo() (Andrew Chow)

Pull request description:

  This PR adds a new `migratewallet` RPC which migrates a legacy wallet to a descriptor wallet. Migrated wallets will need a new backup. If a wallet has watchonly stuff in it, a new watchonly descriptor wallet will be created containing those watchonly things. The related transactions, labels, and descriptors for those watchonly things will be removed from the original wallet. Migrated wallets will not have any of the legacy things be available for fetching from `getnewaddress` or `getrawchangeaddress`. Wallets that have private keys enabled will have newly generated descriptors. Wallets with private keys disabled will not have any active `ScriptPubKeyMan`s.

  For the basic HD wallet case of just generated keys, in addition to the standard descriptor wallet descriptors using the master key derived from the pre-existing hd seed, the migration will also create 3 descriptors for each HD chain in: a ranged combo external, a ranged combo internal, and a single key combo for the seed (the seed is a valid key that we can receive coins at!). The migrated wallet will then have newly generated descriptors as the active `ScriptPubKeyMan`s. This is equivalent to creating a new descriptor wallet and importing the 3 descriptors for each HD chain. For wallets containing non-HD keys, each key will have its own combo descriptor.

  There are also tests.

ACKs for top commit:
  Sjors:
    tACK 53e7ed075c
  w0xlt:
    reACK 53e7ed075c

Tree-SHA512: c0c003694ca2e17064922d08e8464278d314e970efb7df874b4fe04ec5d124c7206409ca701c65c099d17779ab2136ae63f1da2a9dba39b45f6d62cf93b5c60a
2022-09-01 15:43:30 -04:00
MacroFake
36e1b52511
Merge bitcoin/bitcoin#25951: log: Move validation option logging to LoadChainstate()
fa4c59d65b Move blockstorage option logging to LoadChainstate() (MacroFake)
fa3358b668 Move validation option logging to LoadChainstate() (MacroFake)

Pull request description:

  This would allow libbitcoinkernel users to see the options logged as well. Currently they would only be logged for bitcoind. Behavior change suggested in the refactoring pull https://github.com/bitcoin/bitcoin/pull/25704#discussion_r956166460

ACKs for top commit:
  ryanofsky:
    Code review ACK fa4c59d65b. Only change since last review is moving pruning logprints out of `AppInitParameterInteraction` as suggested
  jonatack:
    Review ACK  fa4c59d65b

Tree-SHA512: f27508ca06a78ef162f002d556cf830df374fe95fd4f10bf22c24b6b48276ce49f52f82ffedc43596c872ddcf08321ca03651495fd3abde16254cb8afab39d33
2022-09-01 19:49:11 +02:00
Andrew Chow
3118425ff9
Merge bitcoin/bitcoin#25931: rpc: sort listdescriptors result
50996241f2 rpc: sort listdescriptors result (Sjors Provoost)

Pull request description:

  This puts receive and change descriptors directly below each other.

  The change would be simpler if `UniValue` arrays were sortable.

ACKs for top commit:
  achow101:
    ACK 50996241f2
  S3RK:
    reACK 50996241f2
  furszy:
    utACK 50996241
  w0xlt:
    reACK 50996241f2

Tree-SHA512: 71246a48ba6f97c3e7c76ee32ff9e958227a14ca5a6eec638215dbfee57264d4e918ea5837f4d030eddc9c797c93df1791ddd55b5a499522ce2a35bcf380670b
2022-09-01 11:50:02 -04:00
MacroFake
fa4c59d65b
Move blockstorage option logging to LoadChainstate() 2022-09-01 17:07:45 +02:00
Anthony Towns
377e9ccda4 scripted-diff: net: rename permissionFlags to permission_flags
-BEGIN VERIFY SCRIPT-
sed -i 's/permissionFlags/permission_flags/g' $(git grep -l permissionFlags)
-END VERIFY SCRIPT-
2022-09-01 20:55:22 +10:00
Anthony Towns
0a7fc42897 net: make CNode::m_prefer_evict const 2022-09-01 20:54:35 +10:00
Anthony Towns
d394156b99 net: make CNode::m_permissionFlags const 2022-09-01 20:53:57 +10:00
Anthony Towns
9dccc3328e net: add CNodeOptions for optional CNode constructor params 2022-09-01 20:52:20 +10:00
Hennadii Stepanov
b2544d1ee3
qt: Update translation source file for string freeze 2022-09-01 10:32:05 +01:00
MacroFake
fa5c224d44
Merge bitcoin/bitcoin#25887: init: avoid unsetting service bits from nLocalServices
1b5bec78e9 init: avoid unsetting service bits from `nLocalServices` (Sebastian Falbesoner)

Pull request description:

  This PR is a late follow-up to the [review club session about the PR "Default to NODE_WITNESS in nLocalServices" ](https://bitcoincore.reviews/21090#l-90) (#21090):

  ```
  17:32 <lightlike> hmm, if we are in pruned mode, we first set NODE_NETWORK and then unset it later in init.cpp. that seems a bit strange.
  ...
  17:33 <jnewbery> lightlike: ah yes, you're right. That does seem a bit messy.
  ```

  Rather than setting the service bit `NODE_NETWORK` first and then unset it (if in `fPruneMode`), start with the bare minimum flags that we always serve and only add `NODE_NETWORK` if we are running as a non-pruned node. This seems to be a more logical approach than currently on master.

ACKs for top commit:
  naumenkogs:
    ACK 1b5bec78e9
  stickies-v:
    ACK 1b5bec78e9
  LarryRuane:
    ACK 1b5bec78e9

Tree-SHA512: 2e82d66c4298ffacff41d9e0458b74b83bc156a1fa49e3f3471e942878e5dd2b253b5597ee5ec1d9c8726b432751d05e40f0c580f3976a9e00a7d1f417921ab0
2022-09-01 10:37:00 +02:00
MacroFake
ccea0e11a2
Merge bitcoin/bitcoin#25959: doc: Fix link to MurmurHash3.cpp (moved from Google Code to Github)
2c05dc7811 Fix link to MurmurHash3.cpp from Austin Appleby (dontbyte)

Pull request description:

  Google Code repo doesn't exist anymore

ACKs for top commit:
  Zero-1729:
    crACK 2c05dc7811

Tree-SHA512: 3e095255757b536f382ffb63e4292413592246c2446d486acbb71c52e4a3ece519d7cfae941685d9e25fd62de5c783510b3d076cd990a3d391496dc3076a0385
2022-09-01 09:54:00 +02:00
MacroFake
f821fc9813
Merge bitcoin/bitcoin#25967: refactor: add LIFETIMEBOUND to blockfilter where needed
89576ccc57 refactor: add LIFETIMEBOUND to blockfilter where needed (stickies-v)

Pull request description:

  Noticed from https://github.com/bitcoin/bitcoin/pull/25637#issuecomment-1231860822 that [`BlockFilter::GetFilter()`](01e1627e25/src/blockfilter.h (L132)) returns a reference to a member variable. Added LIFETIMEBOUND to all blockfilter-related code to ensure that the return values do not have a lifetime that exceeds the lifetime of what it is bound to. See https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#lifetimebound or https://github.com/bitcoin/bitcoin/pull/25060 for a similar example.

  I used `grep -E '[a-zA-Z>0-9][&*] ([a-zA-Z]*)\((.*)\)' src/**/blockfilter*` to grep all possible occurrences (not all of them require LIFETIMEBOUND)

ACKs for top commit:
  brunoerg:
    crACK 89576ccc57

Tree-SHA512: 6fe61fc0c1ed9e446edce083d1b093e1a5e2ef8c39ff74125bb12a24e514d45711845809817fbd4a04d7a9c23c8b362203771c17b6d831d2560b1af268453019
2022-09-01 09:47:18 +02:00
fanquake
6ab84709fc
Merge bitcoin/bitcoin#25960: p2p: Headers-sync followups
94af3e43e2 Fix typo from PR25717 (Suhas Daftuar)
e5982ecdc4 Bypass headers anti-DoS checks for NoBan peers (Suhas Daftuar)
132ed7eaaa Move headerssync logging to BCLog::NET (Suhas Daftuar)

Pull request description:

  Remove BCLog::HEADERSSYNC and move all headerssync logging to BCLog::NET.

  Bypass headers anti-DoS checks for NoBan peers

  Also fix a typo that was introduced in PR25717.

ACKs for top commit:
  Sjors:
    tACK 94af3e43e2
  ajtowns:
    ACK 94af3e43e2
  sipa:
    ACK 94af3e43e2
  naumenkogs:
    ACK 94af3e43e2
  w0xlt:
    ACK 94af3e43e2

Tree-SHA512: 612d594eddace977359bcc8234b2093d273fd50662f4ac70cb90903d28fb831f6e1aecff51a4ef6c0bb0f6fb5d1aa7ff1eb8798fac5ac142783788f3080717dc
2022-09-01 07:45:42 +01:00
stickies-v
89576ccc57
refactor: add LIFETIMEBOUND to blockfilter where needed
Ensure that the return values do not have a lifetime that exceeds
the lifetime of what it is bound to.
See https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#lifetimebound
2022-08-31 16:51:32 +01:00
MacroFake
b936123110
Merge bitcoin/bitcoin#25963: CBlockLocator: performance-move-const-arg Clang tidy fixup
6b24dfe24d CBlockLocator: performance-move-const-arg Clang tidy fixups (Jon Atack)

Pull request description:

  Fix Clang-tidy CI errors on master.  See https://cirrus-ci.com/task/4806752200818688?logs=ci#L4696 for an example.

ACKs for top commit:
  MarcoFalke:
    review ACK 6b24dfe24d
  vasild:
    ACK 6b24dfe24d

Tree-SHA512: 7a67acf7b42da07b63fbb392236e9a7be8cf35c36e37ca980c4467fe8295c2eda8aef10f41a1e3036cd9ebece47fa957fc3256033f853bd6a97ce2ca42799a0a
2022-08-31 15:59:56 +02:00
Jon Atack
6b24dfe24d CBlockLocator: performance-move-const-arg Clang tidy fixups
Co-authored-by: "Pieter Wuille <pieter@wuille.net>"
Co-authored-by: "Vasil Dimov <vd@FreeBSD.org>"
Co-authored-by: "MarcoFalke <falke.marco@gmail.com>"
2022-08-31 15:10:26 +02:00
Janna
767d825e27 Update chainparams for 24.0 release 2022-08-31 15:31:34 +03:00
Sjors Provoost
50996241f2
rpc: sort listdescriptors result 2022-08-31 10:41:10 +02:00
fanquake
01e1627e25
Merge bitcoin/bitcoin#25872: Fix issues when calling std::move(const&)
fa875349e2 Fix iwyu (MacroFake)
faad673716 Fix issues when calling std::move(const&) (MacroFake)

Pull request description:

  Passing a symbol to `std::move` that is marked `const` is a no-op, which can be fixed in two ways:

  * Remove the `const`, or
  * Remove the `std::move`

ACKs for top commit:
  ryanofsky:
    Code review ACK fa875349e2. Looks good. Good for univalue to support c++11 move optimizations

Tree-SHA512: 3dc5cad55b93cfa311abedfb811f35fc1b7f30a1c68561f15942438916c7de25e179c364be11881e01f844f9c2ccd71a3be55967ad5abd2f35b10bb7a882edea
2022-08-31 08:38:24 +01:00
Suhas Daftuar
94af3e43e2 Fix typo from PR25717 2022-08-30 14:11:21 -04:00
Suhas Daftuar
e5982ecdc4 Bypass headers anti-DoS checks for NoBan peers 2022-08-30 14:11:21 -04:00
MacroFake
52dcb1d2a3
Merge bitcoin/bitcoin#25733: tidy: enable bugprone-use-after-move
f345dc3960 tidy: enable bugprone-use-after-move (fanquake)
94f2235f85 test: work around bugprone-use-after-move warnings in util tests (fanquake)

Pull request description:

  Would have caught #25640.

  Currently `// NOLINT`s around:
  ```bash
  test/util_tests.cpp:2513:34: error: 't2' used after it was moved [bugprone-use-after-move,-warnings-as-errors]
      BOOST_CHECK(v2[0].origin == &t2);
                                   ^
  test/util_tests.cpp:2511:15: note: move occurred here
      auto v2 = Vector(std::move(t2));
                ^
  test/util_tests.cpp:2519:34: error: 't2' used after it was moved [bugprone-use-after-move,-warnings-as-errors]
      BOOST_CHECK(v3[1].origin == &t2);
                                   ^
  test/util_tests.cpp:2516:15: note: move occurred here
      auto v3 = Vector(t1, std::move(t2));
                ^
  test/util_tests.cpp:2527:34: error: 't3' used after it was moved [bugprone-use-after-move,-warnings-as-errors]
      BOOST_CHECK(v4[2].origin == &t3);
                                   ^
  test/util_tests.cpp:2523:15: note: move occurred here
      auto v4 = Vector(std::move(v3[0]), v3[1], std::move(t3));
  ```

  See: https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/bugprone-use-after-move.html

ACKs for top commit:
  ryanofsky:
    Code review ACK f345dc3960. Only change since last review is switching to NOLINT directives

Tree-SHA512: afadecbaf1069653f4be5d6e66a5800ffd975c0b1a960057abc6367b616c181cd518897a874a8f3fd5e5e1f45fcc165f7a9a3171136cd4deee641214c4b765b8
2022-08-30 20:04:17 +02:00
Suhas Daftuar
132ed7eaaa Move headerssync logging to BCLog::NET 2022-08-30 12:09:04 -04:00
fanquake
e9035f867a
Merge bitcoin/bitcoin#25717: p2p: Implement anti-DoS headers sync
3add234546 ui: show header pre-synchronization progress (Pieter Wuille)
738421c50f Emit NotifyHeaderTip signals for pre-synchronization progress (Pieter Wuille)
376086fc5a Make validation interface capable of signalling header presync (Pieter Wuille)
93eae27031 Test large reorgs with headerssync logic (Suhas Daftuar)
355547334f Track headers presync progress and log it (Pieter Wuille)
03712dddfb Expose HeadersSyncState::m_current_height in getpeerinfo() (Suhas Daftuar)
150a5486db Test headers sync using minchainwork threshold (Suhas Daftuar)
0b6aa826b5 Add unit test for HeadersSyncState (Suhas Daftuar)
83c6a0c524 Reduce spurious messages during headers sync (Suhas Daftuar)
ed6cddd98e Require callers of AcceptBlockHeader() to perform anti-dos checks (Suhas Daftuar)
551a8d957c Utilize anti-DoS headers download strategy (Suhas Daftuar)
ed470940cd Add functions to construct locators without CChain (Pieter Wuille)
84852bb6bb Add bitdeque, an std::deque<bool> analogue that does bit packing. (Pieter Wuille)
1d4cfa4272 Add function to validate difficulty changes (Suhas Daftuar)

Pull request description:

  New nodes starting up for the first time lack protection against DoS from low-difficulty headers. While checkpoints serve as our protection against headers that fork from the main chain below the known checkpointed values, this protection only applies to nodes that have been able to download the honest chain to the checkpointed heights.

  We can protect all nodes from DoS from low-difficulty headers by adopting a different strategy: before we commit to storing a header in permanent storage, first verify that the header is part of a chain that has sufficiently high work (either `nMinimumChainWork`, or something comparable to our tip). This means that we will download headers from a given peer twice: once to verify the work on the chain, and a second time when permanently storing the headers.

  The p2p protocol doesn't provide an easy way for us to ensure that we receive the same headers during the second download of peer's headers chain. To ensure that a peer doesn't (say) give us the main chain in phase 1 to trick us into permanently storing an alternate, low-work chain in phase 2, we store commitments to the headers during our first download, which we validate in the second download.

  Some parameters must be chosen for commitment size/frequency in phase 1, and validation of commitments in phase 2. In this PR, those parameters are chosen to both (a) minimize the per-peer memory usage that an attacker could utilize, and (b) bound the expected amount of permanent memory that an attacker could get us to use to be well-below the memory growth that we'd get from the honest chain (where we expect 1 new block header every 10 minutes).

  After this PR, we should be able to remove checkpoints from our code, which is a nice philosophical change for us to make as well, as there has been confusion over the years about the role checkpoints play in Bitcoin's consensus algorithm.

  Thanks to Pieter Wuille for collaborating on this design.

ACKs for top commit:
  Sjors:
    re-tACK 3add234546
  mzumsande:
    re-ACK 3add234546
  sipa:
    re-ACK 3add234546
  glozow:
    ACK 3add234546

Tree-SHA512: e7789d65f62f72141b8899eb4a2fb3d0621278394d2d7adaa004675250118f89a4e4cb42777fe56649d744ec445ad95141e10f6def65f0a58b7b35b2e654a875
2022-08-30 15:37:59 +01:00
fanquake
f345dc3960
tidy: enable bugprone-use-after-move
Will error with:
```bash
coins.cpp:102:22: error: 'coin' used after it was moved [bugprone-use-after-move,-warnings-as-errors]
           (uint32_t)coin.nHeight,
                     ^
coins.cpp:96:21: note: move occurred here
    it->second.coin = std::move(coin);
```

until #25663 is merged.

See:
https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/bugprone-use-after-move.html
2022-08-30 15:19:53 +01:00
fanquake
94f2235f85
test: work around bugprone-use-after-move warnings in util tests
```bash
test/util_tests.cpp:2513:34: error: 't2' used after it was moved [bugprone-use-after-move,-warnings-as-errors]
    BOOST_CHECK(v2[0].origin == &t2);
                                 ^
test/util_tests.cpp:2511:15: note: move occurred here
    auto v2 = Vector(std::move(t2));
              ^
test/util_tests.cpp:2519:34: error: 't2' used after it was moved [bugprone-use-after-move,-warnings-as-errors]
    BOOST_CHECK(v3[1].origin == &t2);
                                 ^
test/util_tests.cpp:2516:15: note: move occurred here
    auto v3 = Vector(t1, std::move(t2));
              ^
test/util_tests.cpp:2527:34: error: 't3' used after it was moved [bugprone-use-after-move,-warnings-as-errors]
    BOOST_CHECK(v4[2].origin == &t3);
                                 ^
test/util_tests.cpp:2523:15: note: move occurred here
    auto v4 = Vector(std::move(v3[0]), v3[1], std::move(t3));
```
2022-08-30 15:19:49 +01:00
dontbyte
2c05dc7811
Fix link to MurmurHash3.cpp from Austin Appleby
Google Code repo doesn't exist anymore
2022-08-30 13:52:45 +02:00
Andrew Chow
0b26e7cdf2 descriptors: addr() and raw() should return false for ToPrivateString
They don't have any private data and they can't be nested so they
should return false for ToPrivateString.
2022-08-29 17:30:38 -04:00
Andrew Chow
31764c3f87 Add migratewallet RPC 2022-08-29 17:30:38 -04:00
Andrew Chow
0bf7b38bff Implement MigrateLegacyToDescriptor 2022-08-29 17:30:38 -04:00
Andrew Chow
e7b16f925a Implement MigrateToSQLite 2022-08-29 17:30:38 -04:00
Andrew Chow
10d91c5abe wallet: Deduplicate Resend and ReacceptWalletTransactions
Both of these functions do almost the exact same thing. They can be
deduplicated so that their behavior matches except for the filtering
aspect. As this function will now always be called on wallet loading,
nNextResend will also always be initialized, so
wallet_resendwallettransactions.py is updated to account for that.

This also resolves a bug where ResendWalletTransactions would fail to
rebroadcast txs in insertion order thereby potentially rebroadcasting a
child transaction before its parent and causing the child to not
actually get rebroadcast.

Also names the combined function to ResubmitWalletTransactions as the
function just submits the transactions to the mempool rather than doing
any sending by itself.
2022-08-29 12:38:06 -04:00
Anthony Towns
9816dc96b7 net: note CNode members that are treated as const
m_permissionFlags and m_prefer_evict are treated as const -- they're
only set immediately after construction before any other thread has
access to the object, and not changed again afterwards. As such they
don't need to be marked atomic or guarded by a mutex; though it would
probably be better to actually mark them as const...
2022-08-29 22:50:54 +10:00
Anthony Towns
ef26f2f421 net: mark CNode unique_ptr members as const
Dereferencing a unique_ptr is not necessarily thread safe. The reason
these are safe is because their values are set at construction and do
not change later; so mark them as const and set them via the initializer
list to guarantee that.
2022-08-29 22:50:54 +10:00
Anthony Towns
bbec32c9ad net: mark TransportSerializer/m_serializer as const
The (V1)TransportSerializer instance CNode::m_serializer is used from
multiple threads via PushMessage without protection by a mutex. This
is only thread safe because the class does not have any mutable state,
so document that by marking the methods and the object as "const".
2022-08-29 22:50:54 +10:00
Anthony Towns
06ebdc886f net/net_processing: add missing thread safety annotations 2022-08-29 22:50:51 +10:00
Pieter Wuille
3add234546 ui: show header pre-synchronization progress 2022-08-29 08:10:35 -04:00
Pieter Wuille
738421c50f Emit NotifyHeaderTip signals for pre-synchronization progress 2022-08-29 08:10:35 -04:00
Pieter Wuille
376086fc5a Make validation interface capable of signalling header presync
This makes a number of changes:
- Get rid of the verification_progress argument in the node interface
  NotifyHeaderTip (it was always 0.0).
- Instead of passing a CBlockIndex* in the UI interface's NotifyHeaderTip,
  send separate height, timestamp fields. This is becuase in headers presync,
  no actual CBlockIndex object is available.
- Add a bool presync argument to both of the above, to identify signals
  pertaining to the first headers sync phase.
2022-08-29 08:10:35 -04:00
Pieter Wuille
355547334f Track headers presync progress and log it 2022-08-29 08:10:35 -04:00
Suhas Daftuar
03712dddfb Expose HeadersSyncState::m_current_height in getpeerinfo() 2022-08-29 08:10:35 -04:00
Suhas Daftuar
0b6aa826b5 Add unit test for HeadersSyncState 2022-08-29 08:10:35 -04:00
Suhas Daftuar
83c6a0c524 Reduce spurious messages during headers sync
Delay sending SENDHEADERS (BIP 130) message until we know our peer's best
header's chain has more than nMinimumChainWork. This reduces inadvertent
headers messages received during initial headers sync due to block
announcements, which throw off our sync algorithm.
2022-08-29 08:10:35 -04:00
Suhas Daftuar
ed6cddd98e Require callers of AcceptBlockHeader() to perform anti-dos checks
In order to prevent memory DoS, we must ensure that we don't accept a new
header into memory until we've performed anti-DoS checks, such as verifying
that the header is part of a sufficiently high work chain. This commit adds a
new argument to AcceptBlockHeader() so that we can ensure that all call-sites
which might cause a new header to be accepted into memory have to grapple with
the question of whether the header is safe to accept, or needs further
validation.

This patch also fixes two places where low-difficulty-headers could have been
processed without such validation (processing an unrequested block from the
network, and processing a compact block).

Credit to Niklas Gögge for noticing this issue, and thanks to Sjors Provoost
for test code.
2022-08-29 08:10:35 -04:00
Suhas Daftuar
551a8d957c Utilize anti-DoS headers download strategy
Avoid permanently storing headers from a peer, unless the headers are part of a
chain with sufficiently high work. This prevents memory attacks using low-work
headers.

Designed and co-authored with Pieter Wuille.
2022-08-29 08:10:35 -04:00
MacroFake
fa3358b668
Move validation option logging to LoadChainstate() 2022-08-29 11:58:29 +02:00
Jon Atack
2ef33e936e contrib: update testnet torv3 hardcoded seeds
- remove unreachable seeds
- add reachable seeds having service bit 1
- update chainparamsseeds.h

Co-authored-by: "Stacie <staciewaleyko@gmail.com>"
2022-08-28 14:34:49 +02:00
Andrew Chow
e191fac4f3
Merge bitcoin/bitcoin#25922: wallet: trigger MaybeResendWalletTxs() every minute
5ef8c2c9fc test: fix typo for MaybeResendWalletTxs (stickies-v)
fbba4a1316 wallet: trigger MaybeResendWalletTxs() every minute (stickies-v)

Pull request description:

  ResendWalletTransactions() only executes every [12-36h (24h average)](1420547ec3/src/wallet/wallet.cpp (L1947)). Triggering it every second is excessive, once per minute should be plenty.

  The goal of this PR is to reduce the amount of (unnecessary) schedule executions by ~60x without meaningfully altering transaction rebroadcast logic/assumptions which would require more significant review.

ACKs for top commit:
  achow101:
    ACK 5ef8c2c9fc
  1440000bytes:
    ACK 5ef8c2c9fc

Tree-SHA512: 4a077e3579b289c11c347eaa0d3601ef2dbb9fee66ab918d56b4a0c2e08222560a0e6be295297a74831836e001a997ecc143adb0c132faaba96a669dac1cd9e6
2022-08-26 17:11:17 -04:00
Andrew Chow
80da4be57b
Merge bitcoin/bitcoin#25896: wallet: Log when Wallet::SetMinVersion sets a different minversion
835bd27e9a Wallet::SetMinVersion - Log the new minversion (Ali Sherief)

Pull request description:

  This change prints a single additional line in the debug.log when bitcoin-cli loads a wallet using `loadwallet` (*not* `createwallet`).

  When Bitcoin Core creates a wallet, it's `minversion` is set to `FEATURE_BASE`, which is 10500. However, once the wallet is unloaded using `unloadwallet` or through program termination, and subsequently loaded again, `loadwallet` updates the `minversion` in the wallet.dat file to `FEATURE_LATEST`, currently 169900.

  The current logging format prints the very old wallet version during `createwallet`, and then the actual version in calls to `loadwallet`. This has confused at least one person ([reference](https://bitcointalk.org/index.php?topic=5410650.0) - I was the one who asked there if there were plans to change that behavior, and was subsequently redirected here by achow), so it will be very helpful to users to explicitly specify in the logs what the walletdb is doing.

ACKs for top commit:
  achow101:
    ACK 835bd27e9a

Tree-SHA512: 967c8c617e06a84915ddb147378ec3c8b0343e45f43145ec78df9cbc0201867f49c8e11cd068c403eb5ec06e07d38c3c0d3864dad8edc5efbb134a3fb30be41f
2022-08-26 16:41:41 -04:00
Andrew Chow
eed2bd37ef
Merge bitcoin/bitcoin#25355: I2P: add support for transient addresses for outbound connections
59aa54f731 i2p: log "SAM session" instead of "session" (Vasil Dimov)
d7ec30b648 doc: add release notes about the I2P transient addresses (Vasil Dimov)
47c0d02f12 doc: document I2P transient addresses usage in doc/i2p.md (Vasil Dimov)
3914e472f5 test: add a test that -i2pacceptincoming=0 creates a transient session (Vasil Dimov)
ae1e97ce86 net: use transient I2P session for outbound if -i2pacceptincoming=0 (Vasil Dimov)
a1580a04f5 net: store an optional I2P session in CNode (Vasil Dimov)
2b781ad66e i2p: add support for creating transient sessions (Vasil Dimov)

Pull request description:

  Add support for generating a transient, one-time I2P address for ourselves when making I2P outbound connection and discard it once the connection is closed.

  Background
  ---
  In I2P connections, the host that receives the connection knows the I2P address of the connection initiator. This is unlike the Tor network where the recipient does not know who is connecting to them, not even the initiator's Tor address.

  Persistent vs transient I2P addresses
  ---
  Even if an I2P node is not accepting incoming connections, they are known to other nodes by their outgoing I2P address. This creates an opportunity to white-list given nodes or treat them differently based on their I2P address. However, this also creates an opportunity to fingerprint or analyze a given node because it always uses the same I2P address when it connects to other nodes. If this is undesirable, then a node operator can use the newly introduced `-i2ptransientout` to generate a transient (disposable), one-time I2P address for each new outgoing connection. That address is never going to be reused again, not even if reconnecting to the same peer later.

ACKs for top commit:
  mzumsande:
    ACK 59aa54f731 (verified via range-diff that just a typo / `unique_ptr` initialisation were fixed)
  achow101:
    re-ACK 59aa54f731
  jonatack:
    utACK 59aa54f731 reviewed range diff, rebased to master, debug build + relevant tests + review at each commit

Tree-SHA512: 2be9b9dd7502b2d44a75e095aaece61700766bff9af0a2846c29ca4e152b0a92bdfa30f61e8e32b6edb1225f74f1a78d19b7bf069f00b8f8173e69705414a93e
2022-08-26 16:33:58 -04:00
Andrew Chow
5b62f095e7 wallet: Refactor SetupDescSPKMs to take CExtKey
Refactors SetupDescSPKMs so that the DescSPKM loops are in their own
function. This allows us to call it later during migration with a key
that was already generated.
2022-08-26 13:14:51 -04:00
Andrew Chow
22401f17e0 Implement LegacyScriptPubKeyMan::DeleteRecords 2022-08-26 13:14:51 -04:00
Andrew Chow
bbbc26dcfc
Merge bitcoin/bitcoin#25924: scripted-diff: rpc: fix rescan RPC name (s/rescanwallet/rescanblockchain/)
e90a445d7e scripted-diff: rpc: fix rescan RPC name (s/rescanwallet/rescanblockchain/) (Sebastian Falbesoner)

Pull request description:

  There is no RPC call named `rescanwallet`, i.e. fix this by renaming to the actual RPC called `rescanblockchain`.

ACKs for top commit:
  achow101:
    ACK e90a445d7e
  aureleoules:
    ACK e90a445d7e.
  promag:
    ACK e90a445d7e

Tree-SHA512: abf1d1c18de32d87c29e4ff2b782dfb0e4a46dc2c2cc51ab616d12674a0f4a5d22214e00955663ae897cbb88f4f6ced913850f28ea3f5c1b3a54577a25fbf399
2022-08-25 17:12:08 -04:00
Andrew Chow
35f428fae6 Implement LegacyScriptPubKeyMan::MigrateToDescriptor 2022-08-25 16:25:53 -04:00
Andrew Chow
ea1ab390e4 scriptpubkeyman: Implement GetScriptPubKeys in Legacy 2022-08-25 16:25:53 -04:00
Andrew Chow
e664af2976 Apply label to all scriptPubKeys of imported combo() 2022-08-25 16:25:53 -04:00
Ali Sherief
835bd27e9a Wallet::SetMinVersion - Log the new minversion 2022-08-25 17:58:19 +00:00
stickies-v
fbba4a1316
wallet: trigger MaybeResendWalletTxs() every minute
ResendWalletTransactions() only executes every 12-36h (24h average).
Triggering it every second is excessive, once per minute should be
plenty.
2022-08-25 14:29:25 +01:00
MacroFake
d36bec9b3b
Merge bitcoin/bitcoin#25905: refactor: Move ChainstateManager options into m_options struct
7bc33a88f7 refactor: Move ChainstateManager options into m_options struct (Ryan Ofsky)

Pull request description:

  Move `ChainstateManager` options into `m_options` struct to simplify class initialization, organize class members, and to name external option variables differently than internal state variables.

  This change was originally in #25862, but it was suggested to split off in https://github.com/bitcoin/bitcoin/pull/25862#discussion_r951459817 so it could be merged earlier and reduce conflicts with other PRs.

ACKs for top commit:
  naumenkogs:
    ACK 7bc33a88f7

Tree-SHA512: 1c3c77be7db60222732221c087fd01cb802b84ac93333fccb38c8d16645f5f950c3362981021e7a3ae054f19fa7dd9e1cd15daaa101b61ca8853e42a1fd21474
2022-08-25 09:48:12 +02:00
Sebastian Falbesoner
e90a445d7e scripted-diff: rpc: fix rescan RPC name (s/rescanwallet/rescanblockchain/)
There is no RPC call named `rescanwallet`, i.e. fix this by renaming to
the actual RPC called `rescanblockchain`.

-BEGIN VERIFY SCRIPT-
sed -i s/rescanwallet/rescanblockchain/ $(git grep -l rescanwallet)
-END VERIFY SCRIPT-
2022-08-24 23:26:33 +02:00
MacroFake
1420547ec3
Merge bitcoin/bitcoin#25911: net: update hardcoded mainnet seeds for 24.x
9b6f5fafa9 net: update hardcoded mainnet seeds for 24.x (Jon Atack)
7fd9028017 contrib: make-seeds updates for 24.x (Jon Atack)
6075a0be3c net: update manual hardcoded mainnet seeds for 24.x (Jon Atack)

Pull request description:

  Update the hardcoded P2P network seeds for 24.x after updating the manual seeds and the generation script as necessary. Previous update was #24417.

  Can be tested by following the steps in `contrib/seeds/README.md`.

  Tool output:
  ```
  $ python3 makeseeds.py -a asmap-filled.dat < seeds_main.txt > nodes_main.txt
  Loading asmap database "asmap-filled.dat"…Done.
  Loading and parsing DNS seeds…Done.
    IPv4   IPv6  Onion Pass
  472019  73788      0 Initial
  472019  73788      0 Skip entries with invalid address
  472019  73788      0 After removing duplicates
    7766   2310      0 Enforce minimal number of blocks
    6534   1835      0 Require service bit 1
    2808    801      0 Require minimum uptime
    2748    781      0 Require a known and recent user agent
    2727    775      0 Filter out hosts with multiple bitcoin ports
     512    267      0 Look up ASNs and limit results per ASN and per net
  ```

ACKs for top commit:
  laanwj:
    LGTM ACK 9b6f5fafa9
  Emzy:
    ACK 9b6f5fa
  brunoerg:
    ACK 9b6f5fafa9

Tree-SHA512: eef994bbd60524cfd9e4b5b836ddbe615cd2a77466394cdbb70a0ebc30c7822d8605473424f6d4a1ba37313c59373cf10717977a5c07e6f839e5ff86464c8c55
2022-08-24 19:08:24 +02:00
fanquake
2d83a20113
Merge bitcoin/bitcoin#25863: test: remove unused norm_prv parameter in descriptor_tests.cpp.
57d1367fec test: remove unused `norm_prv` parameter (w0xlt)

Pull request description:

  This PR removes the unused `norm_prv` parameter in `src/test/descriptor_tests.cpp`.

ACKs for top commit:
  achow101:
    ACK 57d1367fec

Tree-SHA512: 5b16b6bea94db0b5f2c3675b6529312b50e120d4ec7633e4184dd4ba6fc04e086efb273b9e61f748c8a15cbdc243450b09fc58ec7343379f3151a3b9e7e37106
2022-08-24 16:24:52 +01:00
MacroFake
c89fabff3d
Merge bitcoin/bitcoin#25879: refactor: Make Join() util work with any container type
fa95315655 Use new Join() helper for ListBlockFilterTypes() (MacroFake)
fa1c716955 Make Join() util work with any container type (MacroFake)
faf8da3c8d Remove Join() helper only used in tests (MacroFake)

Pull request description:

  This allows to drop some code

ACKs for top commit:
  naumenkogs:
    ACK fa95315655
  stickies-v:
    ACK [fa95315](fa95315655)

Tree-SHA512: efd65b65722f46b221bd53140ff22bd8e45adc83617980233f28f695be3108a6ab01affd751d715134ffcb9762228ba8952e9467e590cff022c83e0f5404cb74
2022-08-24 11:30:44 +02:00
MacroFake
fa95315655
Use new Join() helper for ListBlockFilterTypes() 2022-08-24 10:15:32 +02:00
MacroFake
fa1c716955
Make Join() util work with any container type
Also, remove helper that is only used in tests.
2022-08-24 10:15:11 +02:00
Jon Atack
9b6f5fafa9 net: update hardcoded mainnet seeds for 24.x
following the steps in contrib/seeds/README.md
2022-08-24 00:04:00 +02:00
Pieter Wuille
ed470940cd Add functions to construct locators without CChain
This introduces an insignificant performance penalty, as it means locator
construction needs to use the skiplist-based CBlockIndex::GetAncestor()
function instead of the lookup-based CChain, but avoids the need for
callers to have access to a relevant CChain object.
2022-08-23 16:05:00 -04:00
Pieter Wuille
84852bb6bb Add bitdeque, an std::deque<bool> analogue that does bit packing. 2022-08-23 11:34:10 -04:00
Suhas Daftuar
1d4cfa4272 Add function to validate difficulty changes
The rule against difficulty adjustments changing by more than a factor of 4 can
be helpful for anti-DoS measures in contexts where we lack a full headers
chain, so expose this functionality separately and in the narrow case where we
only know the height, new value, and old value.

Includes fuzz test by Martin Zumsande.
2022-08-23 11:34:10 -04:00
Ryan Ofsky
7bc33a88f7 refactor: Move ChainstateManager options into m_options struct
Move ChainstateManager options into m_options struct to simplify class
initialization, organize class members, and to name external option variables
differently than internal state variables.

This change was originally in #25862, but it was suggested to split off in
https://github.com/bitcoin/bitcoin/pull/25862#discussion_r951459817 so it could
be merged earlier and reduce conflicts with other PRs.
2022-08-22 13:19:15 -04:00
Andrew Chow
2bd9aa5a44
Merge bitcoin/bitcoin#25647: wallet: return change from SelectionResult
4fef534428 wallet: use GetChange() when computing waste (S3RK)
87e0ef9031 wallet: use GetChange() in tx building (S3RK)
15e97a6886 wallet: add SelectionResult::GetChange (S3RK)
72cad28da0 wallet: calculate and store min_viable_change (S3RK)
e3210a7225 wallet: account for preselected inputs in target (S3RK)
f8e796348b wallet: add SelectionResult::Merge (S3RK)
06f558e4e2 wallet: accurate SelectionResult::m_target (S3RK)
c8cf08ea74 wallet: ensure m_min_change_target always covers change fee (S3RK)

Pull request description:

  Benefits:
  1. more accurate waste calculation for knapsack. Waste calculation is now consistent with tx building code. Before we always assumed change for knapsack even when the solution is changeless4.
  2. simpler tx building code. Only create change output when it's needed
  3. makes it easier to correctly account for fees for CPFP inputs (should be done in a follow up)

  In the first three commits we fix the code to accurately track selection target in `SelectionResult::m_target`
  Then we introduce new variable `min_change` that represents the minimum viable change amount
  Then we introduce `SelectionResult::GetChange()` which incapsulates dropping change for fee logic and uses correct values of `SelectionResult::m_target`
  Then we use `SelectionResult::GetChange()` in both tx building and waste calculation code

  This PR is a refactoring and shouldn't change the behaviour.
  There is only one known small change (arguably a bug fix). Before we dropped change output if it's smaller than `cost_of_change` after paying change fees. This is incorrect as `cost_of_change` already includes `change_fee`.

ACKs for top commit:
  achow101:
    ACK 4fef534428
  Xekyo:
    crACK 4fef534428
  furszy:
    Code review ACK 4fef5344
  w0xlt:
    ACK 4fef534428

Tree-SHA512: 31a7455d4129bc39a444da0f16ad478d690d4d9627b2b8fdb5605facc6488171926bf02f5d7d9a545b2b59efafcf5bb3d404005e4da15c7b44b3f7d441afb941
2022-08-22 12:42:36 -04:00
glozow
375ebadbf8
fixups for BIP125 doc cleanup
Grammar and readability fixups.
Clarifies "bip125-replaceable" helpstrings.
2022-08-22 14:59:58 +01:00
Vasil Dimov
9cbfe40d8a
net: remove useless call to IsReachable() from CConnman::Bind()
`CConnman::Bind()` is called without `BF_EXPLICIT` only when passed
either `0.0.0.0` or `::`. For those addresses `IsReachable()` is always
true (regardless of the `-onlynet=` setting!), meaning that the `if`
condition never evaluates to true.

`IsReachable()` is always true for the "any" IPv4 and IPv6 addresses
because `CNetAddr::GetNetwork()` returns `NET_UNROUTABLE` instead of
`NET_IPV4` or `NET_IPV6` and the network `NET_UNROUTABLE` is always
considered reachable.

It follows that `BF_EXPLICIT` is unnecessary, remove it too.
2022-08-22 14:16:49 +02:00
fanquake
c5f0cbefa3
Merge bitcoin/bitcoin#25775: docs: remove non-signaling mentions of BIP125
1dc03dda05 [doc] remove non-signaling mentions of BIP125 (glozow)
32024d40f0 scripted-diff: remove mention of BIP125 from non-signaling var names (glozow)

Pull request description:

  We have pretty thorough documentation of our RBF policy in doc/policy/mempool-replacements.md. It enumerates each rule with several sentences of rationale. Also, each rule pretty much has its own function (3 and 4 share one), with extensive comments. The doc states explicitly that our rules are similar but differ from BIP125, and contains a record of historical changes to RBF policy.

  We should not use "BIP125" as synonymous with our RBF policy because:
  - Our RBF policy is different from what is specified in BIP125, for example:
      - the BIP does not mention our rule about the replacement feerate being higher (our Rule 6)
      - the BIP uses minimum relay feerate for Rule 4, while we have used incremental relay feerate since #9380
      - the "inherited signaling" question (CVE-2021-31876). Call it discrepancy, ambiguous wording, doc misinterpretation, or implementation details, I would recommend users refer to doc/policy/mempool-replacements.md
      - the signaling policy is configurable, see #25353
  - Our RBF policy may change further
  - We have already marked BIP125 as only "partially implemented" in docs/bips.md since 1fd49eb498
  - See comments from people who are not me recently:
      - https://github.com/bitcoin/bitcoin/pull/25038#discussion_r909507429
      - https://github.com/bitcoin/bitcoin/pull/25575#issuecomment-1179519204

  This PR removes all non-signaling mentions of BIP125 (if people feel strongly, we can remove all mentions of BIP125 period). It may be useful to refer to the concept of "tx opts in to RBF if it has at least one nSequence less than (0xffffffff - 1)" as "BIP125 signaling" because:
  - It is succint.
  - It has already been widely marketed as BIP125 opt-in signaling.
  - Our API uses it when referring to signaling (e.g. getmempoolentry["bip125-replaceable"] and wallet error message "not BIP 125 replaceable"). Changing those is more invasive.
  - If/when we have other ways to signal in the future, we can disambiguate them this way. See #25038 which proposes another way of signaling, and where I pulled these commits from.

  Alternatives:
  - Changing our policy to match BIP125. This doesn't make sense as, for example, we would have to remove the requirement that a replacement tx has a higher feerate (Rule 6).
  - Changing BIP125 to match what we have. This doesn't make sense as it would be a significant change to a BIP years after it was finalized and already used as a spec to implement RBF in other places.
  - Document our policy as a new BIP and give it a number. This might make sense if we don't expect things to change a lot, and can be done as a next step.

ACKs for top commit:
  darosior:
    ACK 1dc03dda05
  ariard:
    ACK 1dc03dda
  t-bast:
    ACK 1dc03dda05

Tree-SHA512: a3adc2039ec5785892d230ec442e50f47f7062717392728152bbbe27ce1c564141f85253143f53cb44e1331cf47476d74f5d2f4b3cd873fc3433d7a0aa783e02
2022-08-22 10:35:26 +01:00
fanquake
607d5a46aa
Merge bitcoin/bitcoin#23202: wallet: allow psbtbumpfee to work with txs with external inputs
c3b099ace0 wallet, tests: Test bumpfee's max input weight calculation (Andrew Chow)
116a620ce7 Make DUMMY_CHECKER availble outside of script/sign.cpp (Andrew Chow)
ff638323d1 test, bumpfee: Check that psbtbumpfee can bump txs with external inputs (Andrew Chow)
1bc8106d4c bumpfee: be able to bump fee of a tx with external inputs (Andrew Chow)
31dd3dc9e5 bumpfee: Clear scriptSigs and scriptWitnesses before calculated max size (Andrew Chow)
a0c3afb898 bumpfee: extract weights of external inputs when bumping fee (Andrew Chow)
612f1e44fe bumpfee: Calculate fee by looking up UTXOs (Andrew Chow)

Pull request description:

  This PR allows `psbtbumpfee` to return a PSBT for transactions that contain external inputs. This does not work for bumping in the GUI nor `bumpfee` because these need private keys available to sign and send the transaction. But `psbtbumpfee` returns a psbt, so it is fine to not be able to sign.

  In order to correctly estimate the size of the inputs for coin selection, the fee bumper will use the size of the inputs of the transaction being bumped. Because the sizes of signatures are not guaranteed, for external inputs, the fee bumper will verify the scripts with a special SignatureChecker which will compute the weight of all of the signatures in that input, and compute their weights if those signatures were maximally sized. This allows the fee bumper to obtain a max size estimate for each external input.

  Builds on #23201 as it relies on the ability to pass weights in to coin selection.

  Closes #23189

ACKs for top commit:
  ishaanam:
    reACK c3b099ace0
  t-bast:
    Re-ran my tests agains c3b099ace0, ACK

Tree-SHA512: 40016ec52d351430977579cfa2694c7e6764f42c9ce09d3a6f1753b767f86053f296d9de988248df033be6d725d67badbf2a5ef82c8ace23c61487729b7691e5
2022-08-22 10:12:19 +01:00
fanquake
0f35f4ddf4
Merge bitcoin/bitcoin#25786: refactor: Make adjusted time type safe
eeee5ada23 Make adjusted time type safe (MacroFake)
fa3be799fe Add time helpers (MacroFake)

Pull request description:

  This makes follow-ups easier to review. Also, it makes sense by itself.

ACKs for top commit:
  ryanofsky:
    Code review ACK eeee5ada23. Confirmed type changes and equivalent code changes only.

Tree-SHA512: 51bf1ae5428552177286113babdd49e82459d6c710a07b6e80a0a045d373cf51045ee010461aba98e0151d8d71b9b3b5f8f73e302d46ba4558e0b55201f99e9f
2022-08-22 10:00:46 +01:00
w0xlt
57d1367fec test: remove unused norm_prv parameter 2022-08-21 18:26:11 -03:00
Sebastian Falbesoner
1b5bec78e9 init: avoid unsetting service bits from nLocalServices
Rather than setting the service bit `NODE_NETWORK` first and then unset
it, start out the bare minimum flags that every node serves and only add
`NODE_NETWORK` if we are running as a non-pruned node.
2022-08-20 22:36:27 +02:00
Sebastian Falbesoner
706c8e0969 refactor: use strprintf for creating unknown-service-flag string
No need to use a stringstream here.
2022-08-20 15:11:28 +02:00
Jon Atack
1abaa31aa3 Update -debug and -debugexclude help docs for severity level logging 2022-08-20 11:55:17 +02:00
Jon Atack
45f9282162 Create BCLog::Level::Trace log severity level
for verbose log messages for development or debugging only, as bitcoind may run
more slowly, that are more granular/frequent than the Debug log level, i.e. for
very high-frequency, low-level messages to be logged distinctly from
higher-level, less-frequent debug logging that could still be usable in production.

An example would be to log higher-level peer events (connection, disconnection,
misbehavior, eviction) as Debug, versus Trace for low-level, high-volume p2p
messages in the BCLog::NET category. This will enable the user to log only the
former without the latter, in order to focus on high-level peer management events.

With respect to the name, "trace" is suggested as the most granular level
in resources like the following:
- https://sematext.com/blog/logging-levels
- https://howtodoinjava.com/log4j2/logging-levels

Update the test framework and add test coverage.
2022-08-20 11:55:17 +02:00