Commit graph

43479 commits

Author SHA1 Message Date
Hennadii Stepanov
2bdaf52ed1
doc: Update NetBSD Build Guide
1. Update the documented NetBSD version.

2. Add the optional ZeroMQ package to align the guide with other *BSD
systems.

3. Update the Python version to meet the minimum requirement specified
in https://github.com/bitcoin/bitcoin/pull/30527.

4. Install `net/py-zmq` package to enable the `interface_zmq.py`
functional test.

5. Fix a formatting issue.
2024-12-31 10:14:02 +00:00
Ava Chow
228aba2c4d
Merge bitcoin/bitcoin#31555: descriptor: remove unreachable verification for pkh
Some checks failed
CI / test each commit (push) Has been cancelled
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Has been cancelled
CI / macOS 14 native, arm64, fuzz (push) Has been cancelled
CI / Win64 native, VS 2022 (push) Has been cancelled
CI / Win64 native fuzz, VS 2022 (push) Has been cancelled
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Has been cancelled
366ae00b77 descriptor: Assume `ParseScript` is not being called with a P2WPKH context (brunoerg)
e366408590 descriptor: remove unreachable verification for `pkh` (brunoerg)

Pull request description:

  This PR removes an unreachable verification in the `ParseScript` function. It returns an error if `pkh` is not being used at top level, sh, wsh or tr. However, any usage of `pkh` without these contexts will not reach this verification but other ones like "invalid keys" (e.g. `wpkh(pkh(L4gM1FBdyHNpkzsFh9ipnofLhpZRp2mwobpeULy1a6dBTvw8Ywtd))`).

ACKs for top commit:
  davidgumberg:
    crACK 366ae00b77
  achow101:
    ACK 366ae00b77
  tdb3:
    cr ACK 366ae00b77
  sipa:
    crACK 366ae00b77

Tree-SHA512: b954221a77eed623aeed5eb54f14e82c49540a151d3388831924caa7a784e48a2a975e418af1e13d491e4f8cded3b1797aa39e0e4e39e302a991105df09cdec0
2024-12-30 16:40:11 -05:00
Ava Chow
9b9752217f
Merge bitcoin/bitcoin#31570: test: descriptor: fix test for MaxSatisfactionWeight
b29d68f942 test: descriptor: fix test for `MaxSatisfactionWeight` (brunoerg)

Pull request description:

  To get the maximum size of a satisfaction for a descriptor with no max sig, the parameter `use_max_sig` should be false.

ACKs for top commit:
  fjahr:
    utACK b29d68f942
  achow101:
    ACK b29d68f942
  tdb3:
    re ACK b29d68f942
  furszy:
    utACK b29d68f942

Tree-SHA512: 8559718d126e60ce21a34183f74d227546108b43e3897e49622d6677ed9e7707caa962fd811d8787bd4dafc48a0e779ef11050d5990293faa2f91ded4aaa4f4b
2024-12-30 15:04:51 -05:00
Ava Chow
87c9ebd889
Merge bitcoin/bitcoin#31563: rpc: Extend scope of validation mutex in generateblock
fa63b8232f test: generateblocks called by multiple threads (MarcoFalke)
fa62c8b1f0 rpc: Extend scope of validation mutex in generateblock (MarcoFalke)

Pull request description:

  The mutex (required by TestBlockValidity) must be held after creating the block, until TestBlockValidity is called. Otherwise, it is possible that the chain advances in the meantime and leads to a crash in TestBlockValidity: `Assertion failed: pindexPrev && pindexPrev == chainstate.m_chain.Tip() (validation.cpp: TestBlockValidity: 4338)`

  Fixes #31562

ACKs for top commit:
  davidgumberg:
    reACK fa63b8232f
  achow101:
    ACK fa63b8232f
  ismaelsadeeq:
    re-ACK fa63b8232f
  mzumsande:
    utACK fa63b8232f

Tree-SHA512: 3dfda1192af52546ab11fbffe44af8713073763863f4a63fbcdbdf95b1c6cbeb003dc4b8b29e7ec67362238ad15e07d8f6855832a0c68dc5370254f8cbf9445c
2024-12-30 14:49:21 -05:00
Ava Chow
df5c643f92
Merge bitcoin/bitcoin#31556: validation: Send correct notification during snapshot completion
bc43ecaf6d test: add functional test for balance after snapshot completion (Martin Zumsande)
226d03dd61 validation: Send correct notification during snapshot completion (Martin Zumsande)

Pull request description:

  After AssumeUtxo background sync is completed in a `ActivateBestChain()` call, the `GetRole()` function called with `BlockConnected()` returns `ChainstateRole::NORMAL` instead of `ChainstateRole::BACKGROUND` for this chainstate.
  This would make the wallet (which ignores `BlockConnected` notifications for the background chainstate) process it, change `m_last_block_processed_height` to the (ancient) snapshot height, and display an incorrect balance.

  Fix this by caching the chainstate role before calling `ActivateBestChainStep()`.
  Also contains a test for this situation that fails on master.

  Fixes #31546

ACKs for top commit:
  fjahr:
    re-ACK bc43ecaf6d
  achow101:
    ACK bc43ecaf6d
  furszy:
    Code review ACK bc43ecaf6d
  TheCharlatan:
    lgtm ACK bc43ecaf6d

Tree-SHA512: c5db677cf3fbab3a33ec127ec6c27c8812299e8368fd3c986bc34d0e515c4eb256f6104479f27829eefc098197de3af75d64ddca636b6b612900a0e21243e4f2
2024-12-30 14:40:27 -05:00
Ava Chow
fa3de038f7
Merge bitcoin/bitcoin#31537: qa: Limit -maxconnections in tests
d9d5bc2e74 qa: Limit `-maxconnections` in tests (Hennadii Stepanov)

Pull request description:

  On systems such as NetBSD, the `bitcoind` typically prints the following warning:
  ```
  Warning: Reducing -maxconnections from 125 to 96, because of system limitations.
  ```

  This breaks the functional test framework (see https://github.com/bitcoin/bitcoin/issues/23968).

  This PR limits the `-maxconnections` to mitigate the issue and enable functional tests on NetBSD.

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

  Here is CI log from the [`bitcoin-core-nightly`](https://github.com/hebasto/bitcoin-core-nightly) repository: https://github.com/hebasto/bitcoin-core-nightly/actions/runs/12415868523/job/34663207030

ACKs for top commit:
  maflcko:
    re-ACK d9d5bc2e74
  achow101:
    ACK d9d5bc2e74
  mzumsande:
    Code Review ACK d9d5bc2e74
  tdb3:
    tested ACK d9d5bc2e74

Tree-SHA512: ad02adce98ce609176c9688289a0ca347932da5b6f259c6ab4e686914352f3d61f819adc150be80220f969200ee6a0c1c8737426525816fa0df58d688c51410c
2024-12-30 14:34:22 -05:00
Ava Chow
ba0cb7d5a5
Merge bitcoin/bitcoin#31468: test: Avoid intermittent error in assert_equal(pruneheight_new, 248)
fa0998f0a0 test: Avoid intermittent error in assert_equal(pruneheight_new, 248) (MarcoFalke)

Pull request description:

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

  The test uses the P2P network to sync blocks, which has no inherent guarantee that the blocks are sent and received in the right order, assuming the headers are received first.

  This can mean that the first block file is flushed with block at height 249 and block at height 248 is added to the second file. In the log it looks like: `Leaving block file 0: CBlockFileInfo(blocks=249, size=65319, heights=0...249, time=2011-02-02...2024-12-03) (onto 1) (height 248)`. The test assumes that the height of the last pruned block in the first file is 248, expecting it to look like: `Leaving block file 0: CBlockFileInfo(blocks=249, size=65319, heights=0...248, time=2011-02-02...2024-12-09) (onto 1) (height 249) `.

  Fix the issue by using a linear dumb sync.

ACKs for top commit:
  achow101:
    ACK fa0998f0a0
  mzumsande:
    Code Review ACK fa0998f0a0
  i-am-yuvi:
    Code Review ACK fa0998f0a0
  fjahr:
    Code review ACK fa0998f0a0

Tree-SHA512: 59cb4317be6cf9012c9bf7a3e9f5ba96b8b114b30bd2ac42af4fe742cd26a634d685b075f04a84bd782b2a43a342d75bb20a042bd82ad2831dbf844d39517ca2
2024-12-30 14:28:01 -05:00
Ava Chow
69e35f5c60
Merge bitcoin/bitcoin#31403: test: Call generate RPCs through test framework only
fa6e599cf9 test: Call generate through test framework only (MarcoFalke)

Pull request description:

  The generate RPCs are special in that they should only be called by the test framework itself. This way, they will call the sync function on the nodes, which can avoid intermittent test issues. Also, when the sync is disabled, it will happen explicitly by setting the `sync_fun`.

  Apply this rule here, so that all generate calls are written consistently.

ACKs for top commit:
  achow101:
    ACK fa6e599cf9
  rkrux:
    tACK fa6e599cf9
  hodlinator:
    ACK fa6e599cf9
  i-am-yuvi:
    Tested ACK fa6e599cf9

Tree-SHA512: 31079997f1e17031ecd577904457e0560388aa53cadb1bbda281865271e8e4cf244bc6bf315838a717bf9d6620c201093e30039aa0007bec3629f7ca56abfba3
2024-12-30 14:19:07 -05:00
Ava Chow
17db84dbb8
Merge bitcoin/bitcoin#31251: test: report detailed msg during utf8 response decoding error
a2c45ae548 test: report failure during utf8 response decoding (furszy)

Pull request description:

  Useful for debugging issues such https://github.com/bitcoin/bitcoin/pull/31241#issuecomment-2462816933.

  Prints the entire response content instead of printing only the position of the byte it can't be decoded.

  The diff between the error messages can be seen by running the `wallet_migration.py` functional test with the following patch applied:
  ```
  diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp
  --- a/src/wallet/rpc/wallet.cpp(revision d65918c5da52c7d5035b4151dee9ffb2e94d4761)
  +++ b/src/wallet/rpc/wallet.cpp(date 1731005254673)
  @@ -801,7 +801,7 @@
               }

               UniValue r{UniValue::VOBJ};
  -            r.pushKV("wallet_name", res->wallet_name);
  +            r.pushKV("wallet_name", "\xc3\x28");
               if (res->watchonly_wallet) {
                   r.pushKV("watchonly_name", res->watchonly_wallet->GetName());
               }
  ```

ACKs for top commit:
  achow101:
    ACK a2c45ae548
  theStack:
    re-ACK a2c45ae548
  rkrux:
    tACK a2c45ae548
  ismaelsadeeq:
    utACK a2c45ae548

Tree-SHA512: 6abb524b5a215c51ec881eea91ebe8174140a88ff3874c8c88676157edae7818801356586a904dbb21b45053183315a6d71dbf917d753611d8e413776b57c484
2024-12-30 14:12:57 -05:00
Ava Chow
e6f14241f6
Merge bitcoin/bitcoin#31540: refactor: std::span compat fixes
fa494a1d53 refactor: Specify const in std::span constructor, where needed (MarcoFalke)
faaf4800aa Allow std::span in stream serialization (MarcoFalke)
faa5391f77 refactor: test: Return std::span from StringBytes (MarcoFalke)
fa86223475 refactor: Avoid passing span iterators when data pointers are expected (MarcoFalke)
faae6fa5f6 refactor: Simplify SpanPopBack (MarcoFalke)
facc4f120b refactor: Replace fwd-decl with proper include (MarcoFalke)
fac3a782ea refactor: Avoid needless, unsafe c-style cast (MarcoFalke)

Pull request description:

  The `std::span` type is already used in some parts of the codebase, and in most contexts can implicitly convert to and from `Span`. However, the two types are not identical in behavior and trying to use one over the other can result in compile failures in some contexts.

  Fix all those issues by allowing either `Span` or `std::span` in any part of the codebase.

  All of the changes are also required for the scripted-diff to replace `Span` with `std::span` in https://github.com/bitcoin/bitcoin/pull/31519

ACKs for top commit:
  sipa:
    utACK fa494a1d53
  fjahr:
    Code review ACK fa494a1d53
  achow101:
    ACK fa494a1d53
  theuni:
    utACK fa494a1d53.
  adamandrews1:
    utACK fa494a1d53

Tree-SHA512: 9440941823e884ff5d7ac161f58b9a0704d8e803b4c91c400bdb5f58f898e4637d63ae627cfc7330e98a721fc38285a04641175aa18d991bd35f8b69ed1d74c4
2024-12-30 14:05:55 -05:00
Ava Chow
a137b0bd6b
Merge bitcoin/bitcoin#31215: rpc: increase the defaults for -rpcthreads and -rpcworkqueue
e56fc7ce6a rpc: increase the defaults for -rpcthreads and -rpcworkqueue (Vasil Dimov)

Pull request description:

  `rpcthreads` was introduced with a default of 4 in 2013 in 21eb5adadb

  `rpcworkqueue` was introduced with a default of 16 in 2015 in 40b556d374

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

  ---

  Just bump the ancient default values. There is no perfect default that would fit everybody. This could lead to https://bikeshed.com/

ACKs for top commit:
  achow101:
    ACK e56fc7ce6a
  andrewtoth:
    ACK e56fc7ce6a
  storopoli:
    ACK e56fc7ce6a
  tdb3:
    ACK e56fc7ce6a

Tree-SHA512: ba3ea7392fda57950daa6b4c4d38ecdef9eebe5e786824d25f8b5cea03e760ffff7f77f3acd8eb6c6178b1e92b282e02cabb940ed7222eec7f73efdb819eef06
2024-12-30 13:45:00 -05:00
Ava Chow
67bfe28995
Merge bitcoin/bitcoin#31531: rpc: Add signet_challenge field to getblockchaininfo and getmininginfo
ecaa786cc1 rpc: add signet_challenge field to getblockchaininfo and getmininginfo (Ash Manning)

Pull request description:

  Signet challenges are currently only available via `getblocktemplate` RPC.
  `getblockchaininfo` and `getmininginfo` both provide inadequate information to distinguish signets. Since these are the RPCs used to determine the current network, they should also provide the signet challenge for signets.

  Test coverage is included in `test/functional/feature_signet.py`.

ACKs for top commit:
  sipa:
    utACK ecaa786cc1
  achow101:
    ACK ecaa786cc1
  i-am-yuvi:
    Concept ACK ecaa786cc1
  Sjors:
    ACK ecaa786cc1
  zaidmstrr:
    Tested ACK [ecaa786](ecaa786cc1)

Tree-SHA512: 9ccf4ae634ee74353a2a895efb881fdc62ae703a134ccd219da2cd6080c7d38319e689054584722457a7cc79004bd6022292a3b0b90eaab9f7003564665e1ea4
2024-12-30 13:31:08 -05:00
Ava Chow
ad174c2817
Merge bitcoin/bitcoin#31497: Remove unused variable assignment
b9766c9977 Remove unused variable assignment (yancy)

Pull request description:

  The variable is conditionally assigned toward the end of the loop and not used after.  It's then set back to its default value at the beginning of the loop.

ACKs for top commit:
  theuni:
    utACK b9766c9977
  achow101:
    ACK b9766c9977
  hodlinator:
    crACK b9766c9977
  danielabrozzoni:
    code review ACK b9766c9977
  murchandamus:
    ACK b9766c9977

Tree-SHA512: 45e62b0dd561a473f5ae21bfa91db494940b752886669c85b63a83b68d2a157a301e9450082635e921f3dc812e6307f4ad1674806b74b3e7e0f9f4db543ad93d
2024-12-30 13:22:31 -05:00
brunoerg
b29d68f942 test: descriptor: fix test for MaxSatisfactionWeight
To get the maximum size of a satisfaction for a descriptor
without considering the max sig, the parameter `use_max_sig`
should be false.
2024-12-27 17:55:58 -03:00
Ryan Ofsky
9355578a77
Merge bitcoin/bitcoin#31534: coins: warn on shutdown for big UTXO set flushes
Some checks failed
CI / test each commit (push) Has been cancelled
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Has been cancelled
CI / macOS 14 native, arm64, fuzz (push) Has been cancelled
CI / Win64 native, VS 2022 (push) Has been cancelled
CI / Win64 native fuzz, VS 2022 (push) Has been cancelled
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Has been cancelled
5709718b83 coins: warn on shutdown for big UTXO set flushes (Lőrinc)

Pull request description:

  Split out of https://github.com/bitcoin/bitcoin/pull/30611#issuecomment-2549027130

  Setting a large `-dbcache` size postpones the index writes until the coins cache size exceeds the specified limit. This causes the final flush after manual termination to seemingly hang forever (e.g. tens of minutes for 20 GiB); Now that the `dbcache` upper cap has been lifted, this will become even more apparent, so a warning will be shown when large UTXO sets are flushed (currently >1 GiB), such as:
  > 2024-12-18T18:25:03Z Flushed fee estimates to fee_estimates.dat.
  > 2024-12-18T18:25:03Z [warning] Flushing large (1 GiB) UTXO set to disk, it may take several minutes
  > 2024-12-18T18:25:09Z Shutdown: done

  ---

  You can reproduce it by starting `bitcoind` with a large `-dbcache`:
  > mkdir demo  && cmake -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j$(nproc) && build/src/bitcoind -datadir=demo **-dbcache=10000**

  Waiting until the used memory is over 1 GiB
  > 2024-12-18T18:25:02Z UpdateTip: [...] progress=0.069009 cache=**1181.1MiB**(8827981txo)

  And cancelling the process from the terminal:
  > ^C2024-12-18T18:25:03Z tor: Thread interrupt
  > [...]
  > 2024-12-18T18:25:03Z **[warning] Flushing large (1 GiB) UTXO set to disk, it may take several minutes*

ACKs for top commit:
  sipa:
    utACK 5709718b83
  tdb3:
    re ACK 5709718b83
  1440000bytes:
    ACK 5709718b83
  danielabrozzoni:
    tACK 5709718b83

Tree-SHA512: 608cf797de788501ccb2986508c155f5660c5f6f7a414524bfcc2820cfa9ebe3da558d13f2317d1f121a82d49ffe1e711a1152c743c22dab9f9807363f4ed8d5
2024-12-27 09:54:11 -05:00
Ryan Ofsky
f95fb79372
Merge bitcoin/bitcoin#28521: net, net_processing: additional and consistent disconnect logging
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
06443b8f28 net: clarify if we ever sent or received from peer (Sjors Provoost)
1d01ad4d73 net: add LogIP() helper, use in net_processing (Sjors Provoost)
937ef9eb40 net_processing: use CNode::DisconnectMsg helper (Sjors Provoost)
ad224429f8 net: additional disconnection logging (Sjors Provoost)

Pull request description:

  While debugging unexpected disconnections, possibly related to #28331, I found some additional [net] logging to be useful.

  All cases where we disconnect now come with a log message that has the word `disconnecting`:

  * all calls to `CloseSocketDisconnect()` log `disconnecting peer=…`
  * wherever we set `pnode->fDisconnect = true;`
  * for all `InactivityCheck` cases (which in turn sets `fDisconnect`)
  * replaces "dropping" with "disconnecting" in `Network not active, dropping peer=…`

  A few exceptions are listed here: https://github.com/bitcoin/bitcoin/pull/28521#discussion_r1890824361

  I changed `CloseSocketDisconnect()` to no longer log `disconnecting`, and instead have all the call sites do so.

  This PR introduces two helper functions on `CNode`: `DisconnectMsg` and `LogIP`. The second and third commit use these helpers in `net_processing.cpp` so these disconnect messages are more consistent now (e.g. some didn't log the IP). No new messages are added there though.

  The `LogIP()` helper is rarely used outside of a disconnect event, but it's available for future use.

  Any `LogPrint` this PR touches is replaced with `LogDebug` (superseded by #30750), and every `LogPrintf ` with `LogInfo`.

ACKs for top commit:
  davidgumberg:
    reACK 06443b8f28
  vasild:
    ACK 06443b8f28
  danielabrozzoni:
    ACK 06443b8f28
  hodlinator:
    ACK 06443b8f28

Tree-SHA512: 525f4c11568616e1d48455a3fcab9e923da7432377fe9230468c15403d2e9b7ce712112df8fbd547cfec01dce0d1f26107cfc1b90f78cfc1fe13e08d57b08464
2024-12-27 09:09:29 -05:00
Martin Zumsande
bc43ecaf6d test: add functional test for balance after snapshot completion
Use a third node for this, which doesn't get restarted like the second
node.
This test would fail without the previous commit.
2024-12-26 12:11:28 -05:00
Martin Zumsande
226d03dd61 validation: Send correct notification during snapshot completion
If AssumeUtxo background sync is completed in this
ActivateBestChain() call, the GetRole() function
returns "normal" instead of "background" for this chainstate.
This would make the wallet (which ignores BlockConnected
notifcation for the background chainstate) process it, change
m_last_block_processed_height, and display an incorrect
balance.
2024-12-26 12:11:25 -05:00
MarcoFalke
fa63b8232f
test: generateblocks called by multiple threads
Co-Authored-By: David Gumberg <davidzgumberg@gmail.com>
2024-12-25 10:29:34 +01:00
MarcoFalke
fa62c8b1f0
rpc: Extend scope of validation mutex in generateblock
The mutex (required by TestBlockValidity) must be held after creating
the block, until TestBlockValidity is called. Otherwise, it is possible
that the chain advances in the meantime and leads to a crash in
TestBlockValidity:

 Assertion failed: pindexPrev && pindexPrev == chainstate.m_chain.Tip() (validation.cpp: TestBlockValidity: 4338)

The diff can be reviewed with the git options
--ignore-all-space --function-context
2024-12-24 15:51:56 +01:00
brunoerg
366ae00b77 descriptor: Assume ParseScript is not being called with a P2WPKH context 2024-12-24 11:01:47 -03:00
brunoerg
e366408590 descriptor: remove unreachable verification for pkh 2024-12-23 08:41:35 -03:00
Lőrinc
5709718b83 coins: warn on shutdown for big UTXO set flushes
Setting a large `-dbcache` size postpones the index writes until the coins cache size exceeds the specified limit.
This causes the final flush after manual termination to seemingly hang forever (e.g. tens of minutes for 20 GiB);
Now that the `dbcache` upper cap has been lifted, this will become even more apparent, so a warning will be shown when large UTXO sets are flushed (currently >1 GiB), such as:
> 2024-12-18T18:25:03Z Flushed fee estimates to fee_estimates.dat.
> 2024-12-18T18:25:03Z [warning] Flushing large (1 GiB) UTXO set to disk, it may take several minutes
> 2024-12-18T18:25:09Z Shutdown: done

Note that the related BCLog::BENCH units were also converted to `KiB` from `kB` to unify the bases.

Co-authored-by: Cory Fields <cory-nospam-@coryfields.com>
2024-12-22 14:08:58 +01:00
merge-script
fc7b214847
Merge bitcoin/bitcoin#31529: guix: latest 2.31 glibc
Some checks failed
CI / test each commit (push) Has been cancelled
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Has been cancelled
CI / macOS 14 native, arm64, fuzz (push) Has been cancelled
CI / Win64 native, VS 2022 (push) Has been cancelled
CI / Win64 native fuzz, VS 2022 (push) Has been cancelled
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Has been cancelled
b8710201fb guix: disable timezone tools & profiling in glibc (fanquake)
23b8a424fb guix: bump glibc 2.31 to 7b27c450c34563a28e634cccb399cd415e71ebfe (fanquake)

Pull request description:

  An additional commit has been backported to the 2.31 branch:
  https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/release/2.31/master.

  Pass `--disable-timezone-tools`: removes `var/profiles/x86_64-linux-gnu/sbin/zdump`.
  Pass `--disable-profile`: profiling is disabled by default, but make that explicit.

ACKs for top commit:
  theuni:
    utACK b8710201fb
  hebasto:
    ACK b8710201fb.

Tree-SHA512: 0d9a0e7451cc42384bbdd0b46c740c7aa964dc12e3f0376de586bf90e57799ebb04675892861cb38a53b5ca0e265061fa7111596cf1c94171303d0d048785ab4
2024-12-20 15:19:05 +00:00
merge-script
273440d5c9
Merge bitcoin/bitcoin#31535: doc: Install py3-zmq port on OpenBSD for interface_zmq.py
be1a2e5dfb doc: Install `py3-zmq` port on OpenBSD for `interface_zmq.py` (Hennadii Stepanov)

Pull request description:

  On OpenBSD, Python's `zmq` module is provided as a separate [port](https://www.ports.to/path/net/py-zmq,python3.html).

  This PR updates the OpenBSD Build Guide to include this port, enabling the `interface_zmq.py` functional test.

  Also updates the documented OpenBSD version.

ACKs for top commit:
  theStack:
    Tested ACK be1a2e5dfb

Tree-SHA512: 4d560385b94e8c7491aa19d2157d8a799617e08136601dc565a909d4c74e12582a1d273bc97ad7c2d0e57c5cf7377560ba02ef58c12f8991652322553740d2ba
2024-12-20 15:17:05 +00:00
merge-script
4cdf50c4ba
Merge bitcoin/bitcoin#31544: cmake: Remove unused BUILD_TESTING variable from "dev-mode" preset
e196190a28 cmake: Remove unused `BUILD_TESTING` variable from "dev-mode" preset (Hennadii Stepanov)

Pull request description:

  On the master branch @ bb57017b29:
  ```
  $ cmake -B build --preset dev-mode -DWITH_MULTIPROCESS=OFF
  <snip>
  -- Configuring done (12.0s)
  -- Generating done (0.1s)
  CMake Warning:
    Manually-specified variables were not used by the project:

      BUILD_TESTING

  -- Build files have been written to: /home/hebasto/git/bitcoin/build
  ```

  This PR resolves the issue.

  The removed `BUILD_TESTING` variable is a part of the [`CTest`](https://cmake.org/cmake/help/latest/module/CTest.html) module, which we do not include in the project.

ACKs for top commit:
  TheCharlatan:
    ACK e196190a28

Tree-SHA512: 8110a0f5bdcdd0844ce7dd75160a61d8b3aff95e12da1ec4d55c56c82da41145736da0fad072adeb97551c99e46683a3493435c3bac7d8e4e62ea6086f60fb7a
2024-12-20 15:15:10 +00:00
Ash Manning
ecaa786cc1 rpc: add signet_challenge field to getblockchaininfo and getmininginfo 2024-12-20 17:57:15 +08:00
Hennadii Stepanov
e196190a28
cmake: Remove unused BUILD_TESTING variable from "dev-mode" preset 2024-12-19 22:25:11 +00:00
Ryan Ofsky
bb57017b29
Merge bitcoin/bitcoin#31521: fuzz: Fix misplaced SeedRand::ZEROS
Some checks are pending
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
fadd568931 fuzz: Fix misplaced SeedRand::ZEROS (MarcoFalke)

Pull request description:

  After commit fae63bf130 this must be placed even before test_setup. This is nice, because it makes the usage consistently appear in the first line.

  The change is moving a `SeedRandomForTest(SeedRand::ZEROS)` to happen earlier. This is fine, because it will either have no effect, or make the code more deterministic, because after commit fae63bf, no other re-seeding other than `ZEROS` can happen in fuzz tests.

ACKs for top commit:
  marcofleon:
    Re ACK fadd568931
  brunoerg:
    code review ACK fadd568931
  hodlinator:
    ACK fadd568931

Tree-SHA512: 54eadf19a1e850157a280fb252ece8797f37a9a50d3b0a01aa2c267bacbe8ef4ddea6cf3faadcbaa4ab9f53148edf08e3cee5dfb3eae928db582adf8373a5206
2024-12-19 10:23:27 -05:00
Ryan Ofsky
5bbbc0d0ee
Merge bitcoin/bitcoin#31325: Make m_tip_block std::optional
81cea5d4ee Ensure m_tip_block is never ZERO (Sjors Provoost)
e058544d0e Make m_tip_block an std::optional (Sjors Provoost)

Pull request description:

  Suggested in https://github.com/bitcoin/bitcoin/pull/31297#discussion_r1844244309

ACKs for top commit:
  fjahr:
    re-ACK 81cea5d4ee
  tdb3:
    code review re ACK 81cea5d4ee
  l0rinc:
    ACK 81cea5d4ee

Tree-SHA512: 31a75ba29e3d567bab32e4e7925a419d9d7a4d2d85ed1c1012116d8d22adc14d31d5b4ce5f6c499c994188dcd26a01cced05be74f94c892fc90ae17a6783a472
2024-12-19 10:05:31 -05:00
Hennadii Stepanov
d9d5bc2e74
qa: Limit -maxconnections in tests
On systems such as NetBSD, this change enables the execution of
functional tests.
2024-12-19 15:04:22 +00:00
MarcoFalke
fa494a1d53
refactor: Specify const in std::span constructor, where needed
The std::span constructor requires std::ranges::borrowed_range, which
tries to protect against dangling references.

One way to disable the check is to specify the std::span's element type
as const in the constructor call.

Otherwise, a compile error will look like:

 include/c++/span: note: candidate constructor not viable: no known conversion from 'std::vector<unsigned char>' to 'const span<unsigned char>' for 1st argument
      |       span(const span&) noexcept = default;
      |       ^    ~~~~~~~~~~~
 ...
 include/c++/span: note: candidate template ignored: constraints not satisfied [with _Range = std::vector<unsigned char>]
      |         span(_Range&& __range)
      |         ^
 include/c++/span: note: because 'std::vector<unsigned char>' does not satisfy 'borrowed_range'
      |           && (ranges::borrowed_range<_Range> || is_const_v<element_type>)
      |               ^
 include/c++/bits/ranges_base.h: note: because 'std::vector<unsigned char>' does not satisfy '__maybe_borrowed_range'
      |       = range<_Tp> && __detail::__maybe_borrowed_range<_Tp>;
      |                       ^
 include/c++/bits/ranges_base.h: note: because 'is_lvalue_reference_v<std::vector<unsigned char> >' evaluated to false
      |         = is_lvalue_reference_v<_Tp>
      |           ^
 include/c++/bits/ranges_base.h: note: and 'enable_borrowed_range<remove_cvref_t<vector<unsigned char, allocator<unsigned char> > > >' evaluated to false
      |           || enable_borrowed_range<remove_cvref_t<_Tp>>;
      |              ^
 include/c++/span: note: and 'is_const_v<element_type>' evaluated to false
      |           && (ranges::borrowed_range<_Range> || is_const_v<element_type>)
      |                                                 ^
2024-12-19 14:41:23 +01:00
MarcoFalke
faaf4800aa
Allow std::span in stream serialization
Future code can now use std::span in stream serialization, similar to
the existing serialization helpers for std::array or Span.
2024-12-19 14:41:21 +01:00
MarcoFalke
faa5391f77
refactor: test: Return std::span from StringBytes
This is possible and safe, because std::span can implicitly convert into
Span, if needed.

Changing this function is required, because std::span requires the
extent template parameter to be specified as well.

Instead of explicilty specifying them, just let the compiler derive the
template parameters correctly.

Otherwise, there would be a compile error later on:

 src/wallet/test/db_tests.cpp:39:37: error: no matching function for call to ‘as_bytes<const char>(<brace-enclosed initializer list>)’
 ...
 /usr/include/c++/11/span:420:5: note: candidate: ...
       |     as_bytes(span<_Type, _Extent> __sp) noexcept
       |     ^~~~~~~~
 /usr/include/c++/11/span:420:5: note:   template argument deduction/substitution failed:
 src/wallet/test/db_tests.cpp:39:37: note:   couldn’t deduce template parameter ‘_Extent’
       |     return std::as_bytes<const char>({str.data(), str.size()});
       |            ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
2024-12-19 14:40:32 +01:00
MarcoFalke
fa86223475
refactor: Avoid passing span iterators when data pointers are expected
For Span, iterators are just raw data pointers. However, for std::span
they are not.

This change makes it explicit where data pointers are expected.

Otherwise, there could be a compile error later on:

  No known conversion from 'iterator' (aka '__normal_iterator<const std::byte *, std::span<const std::byte, 18446744073709551615>>') to 'std::byte *'.
2024-12-19 14:39:55 +01:00
MarcoFalke
faae6fa5f6
refactor: Simplify SpanPopBack
Use the equivalent back() and first() member functions.
2024-12-19 13:46:52 +01:00
MarcoFalke
facc4f120b
refactor: Replace fwd-decl with proper include
This is fine, because the span.h include is lightweight and a proper
include will be needed anyway when switching to std::span.
2024-12-19 13:46:43 +01:00
MarcoFalke
fac3a782ea
refactor: Avoid needless, unsafe c-style cast 2024-12-19 13:46:31 +01:00
Ryan Ofsky
c1252b14d7
Merge bitcoin/bitcoin#31520: #31318 followups
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Win64 native, VS 2022 (push) Waiting to run
CI / Win64 native fuzz, VS 2022 (push) Waiting to run
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run
4f06ae05ed refactor: fix typo in node/types.h (Sjors Provoost)
366fbf152c test: drop extraneous bracket in mining util (Sjors Provoost)

Pull request description:

  #31318 followups

  Drops an extraneous bracket and fixes a typo.

ACKs for top commit:
  maflcko:
    lgtm ACK 4f06ae05ed
  vasild:
    ACK 4f06ae05ed
  ryanofsky:
    Code review ACK 4f06ae05ed

Tree-SHA512: e168bab124f1e62f6666a21349ee4ac8ac11aadeb04813513e89f6c8f8479a67bcf3490460fd49c8d7f9b7264a32e7ea95ac727dfe4597a59b934017ec9fe44e
2024-12-18 15:41:28 -05:00
Hennadii Stepanov
be1a2e5dfb
doc: Install py3-zmq port on OpenBSD for interface_zmq.py
Also updates the documented OpenBSD version.
2024-12-18 19:48:03 +00:00
Ryan Ofsky
fa0c473d4c
Merge bitcoin/bitcoin#31196: Prune mining interface
c991cea1a0 Remove processNewBlock() from mining interface (Sjors Provoost)
9a47852d88 Remove getTransactionsUpdated() from mining interface (Sjors Provoost)
bfc4e029d4 Remove testBlockValidity() from mining interface (Sjors Provoost)

Pull request description:

  There are three methods in the mining interface that can be dropped. The Template Provider doesn't need them and other application should probably not use them either.

  1. `processNewBlock()` was added in 7b4d3249ce, but became unnecessary with the introduction of interfaces::BlockTemplate::submitSolution in 7b4d3249ce.

  Dropping it was suggested in https://github.com/bitcoin/bitcoin/pull/30200#issuecomment-2404460342

  2. `getTransactionsUpdated()`: this is used in the implementation of #31003 `waitFeesChanged`. It's not very useful generically because the mempool updates very frequently.

  3. `testBlockValidity()`: it might be useful for mining application to have a way to check the validity of a block template they modified, but the Stratum v2 Template Provider doesn't do that, and this method is a bit brittle (e.g. the block needs to build on the tip).

ACKs for top commit:
  TheCharlatan:
    Re-ACK c991cea1a0
  ryanofsky:
    Code review ACK c991cea1a0. Since last review, just rebased to avoid conflicts in surrounding code, and edited a commit message
  tdb3:
    code review ACK c991cea1a0

Tree-SHA512: 2138e54f920b26e01c068b24498c6a210c5c4358138dce0702ab58185d9ae148a18f04c97ac9f043646d40f8031618d80a718a176b1ce4779c237de6fb9c4a67
2024-12-18 14:44:14 -05:00
Ryan Ofsky
ea53568a06
Merge bitcoin/bitcoin#31393: refactor: Move GuessVerificationProgress into ChainstateManager
facb4d010c refactor: Move GuessVerificationProgress into ChainstateManager (MarcoFalke)

Pull request description:

  Currently the function is standalone, which means any passed-in data like `TxData` or the block pointer needs to be taken from the `ChainstateManager` and passed in. This is currently verbose and may become even more verbose if the function is reworked in the future. As the function can not be called without a `ChainstateManager` in production code anyway, make it a member function on the class.

ACKs for top commit:
  ryanofsky:
    Code review ACK facb4d010c. Nice cleanup, that should make this code less awkward to work with
  TheCharlatan:
    ACK facb4d010c
  danielabrozzoni:
    reACK facb4d010c

Tree-SHA512: b17977e12cd7c6e308c47e6a1aa920acecd4442696e46d1f30bd7c201e9898ca2d581ff0bf2cc9f7334e146c1b0c50925adb849c8c17f65dcdf6877be1c5f776
2024-12-18 13:58:10 -05:00
fanquake
b8710201fb
guix: disable timezone tools & profiling in glibc
Removes `var/profiles/x86_64-linux-gnu/sbin/zdump`.

Profiling is disabled by default, but make that explicit.
2024-12-18 13:30:24 +00:00
fanquake
23b8a424fb
guix: bump glibc 2.31 to 7b27c450c34563a28e634cccb399cd415e71ebfe
An additional commit has been backported to the 2.31 branch:
https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/release/2.31/master.
2024-12-18 12:16:42 +00:00
MarcoFalke
fadd568931
fuzz: Fix misplaced SeedRand::ZEROS
After commit fae63bf130 this must be
placed even before test_setup.
2024-12-18 12:10:58 +01:00
Sjors Provoost
4f06ae05ed
refactor: fix typo in node/types.h 2024-12-18 14:55:35 +07:00
Sjors Provoost
366fbf152c
test: drop extraneous bracket in mining util 2024-12-18 14:55:19 +07:00
Sjors Provoost
c991cea1a0
Remove processNewBlock() from mining interface
processNewBlock was added in 7b4d3249ce, but became unnecessary with the introduction of interfaces::BlockTemplate::submitSolution in 7b4d3249ce.

getTransactionsUpdated() is only needed by the implementation of waitFeesChanged() (not yet part of the interface).
2024-12-18 09:20:26 +07:00
Sjors Provoost
9a47852d88
Remove getTransactionsUpdated() from mining interface
It's unnecessary to expose it via this interface.
2024-12-18 09:19:12 +07:00
Sjors Provoost
bfc4e029d4
Remove testBlockValidity() from mining interface
It's very low level and not used by the proposed Template Provider.

This method was introduced in d8a3496b5a
and a74b0f93ef.
2024-12-18 09:18:21 +07:00