44111 Commits

Author SHA1 Message Date
Sjors Provoost
2ffea09820
build: disable bitcoin-node if daemon is not built
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2025-02-10 15:01:05 +01:00
Ryan Ofsky
f8d3e0edf4
Merge bitcoin/bitcoin#30205: test: add mocked Sock that can read/write custom data and/or CNetMessages
b448b014947093cd217dbde47c8fb9e6c2bc8ba3 test: add a mocked Sock that allows inspecting what has been Send() to it (Vasil Dimov)
f1864148c4a091afd63be75bc1ff14ae93383523 test: put the generic parts from StaticContentsSock into a separate class (Vasil Dimov)
4b58d55878db55372d1b09de49c6caf363fe3c06 test: move the implementation of StaticContentsSock to .cpp (Vasil Dimov)

Pull request description:

  Put the generic parts from `StaticContentsSock` into a separate class `ZeroSock` so that they can be reused in other mocked `Sock` implementations.

  Add a new `DynSock` whose `Recv()` and `Send()` methods can be controlled after the object is created. To achieve that, the caller/creator of `DynSock` provides to its constructor two pipes (FIFOs) - recv-pipe and send-pipe. Whatever data is written to recv-pipe is later received by `DynSock::Recv()` method and whatever data is written to the socket using `DynSock::Send()` can later be found in the send-pipe. For convenience there are also two methods to send and receive `CNetMessage`s.

  ---

  This is used in https://github.com/bitcoin/bitcoin/pull/26812 (first two commits from that PR).
  Extracting as a separate PR suggested here: https://github.com/bitcoin/bitcoin/pull/30043#discussion_r1619152037.

ACKs for top commit:
  Sjors:
    re-ACK b448b014947093cd217dbde47c8fb9e6c2bc8ba3
  jonatack:
    re-ACK b448b014947093cd217dbde47c8fb9e6c2bc8ba3
  pinheadmz:
    ACK b448b014947093cd217dbde47c8fb9e6c2bc8ba3

Tree-SHA512: 4a36f038192ec4ef63366cbe1a38ae70e7e015630c9f7c44926b756b20ab8c08138acae41801f23b30f6629c7059c1f81e001806e86584ff1bf1fa5b44d9caec
2025-02-10 08:47:19 -05:00
glozow
6b165f5906
Merge bitcoin/bitcoin#31384: mining: bugfix: Fix duplicate coinbase tx weight reservation
386eecff5f14d508688e6e7374b67cb54aaa7249 doc: add release notes (ismaelsadeeq)
3eaa0a3b663782bb1bd874ea881b21649f1db767 miner: init: add `-blockreservedweight` startup option (ismaelsadeeq)
777434a2cd14841e35ce39d7a6f51131e6a41de2 doc: rpc: improve `getmininginfo` help text (ismaelsadeeq)
c8acd4032d5a7617764857b51777c076fd7ef13d init: fail to start when `-blockmaxweight` exceeds `MAX_BLOCK_WEIGHT` (ismaelsadeeq)
5bb31633cc9155ed58ad97fc04b47b3d317a3ec2 test: add `-blockmaxweight` startup option functional test (ismaelsadeeq)
2c7d90a6d67a159332d109aab278632d64078f0b miner: bugfix: fix duplicate weight reservation in block assembler (ismaelsadeeq)

Pull request description:

  * This PR attempts to fix the duplicate coinbase weight reservation issue we currently have.
  * Fixes #21950

  We reserve 4000 weight units for coinbase transaction in `DEFAULT_BLOCK_MAX_WEIGHT`

  7590e93bc7/src/policy/policy.h (L23)

  And also reserve additional `4000` weight units in the default `BlockCreationOptions` struct.

  7590e93bc7/src/node/types.h (L36-L40)

  **Motivation**

  - This issue was first noticed during a review here https://github.com/bitcoin/bitcoin/pull/11100#discussion_r136157411)
  - It was later reported in issue #21950.
  - I also came across the bug while writing a test for building the block template. I could not create a block template above `3,992,000` in the block assembler, and this was not documented anywhere. It took me a while to realize that we were reserving space for the coinbase transaction weight twice.

  ---
  This PR fixes this by consolidating the reservation to be in a single location in the codebase.

  This PR then adds a new startup option `-blockreservedweight` whose default is `8000` that can be used to lower or increase the block reserved weight for block header, txs count, coinbase tx.

ACKs for top commit:
  Sjors:
    ACK 386eecff5f14d508688e6e7374b67cb54aaa7249
  fjahr:
    Code review ACK 386eecff5f14d508688e6e7374b67cb54aaa7249
  glozow:
    utACK 386eecff5f14d508688e6e7374b67cb54aaa7249, nonblocking nits. I do think the release notes should be clarified more
  pinheadmz:
    ACK 386eecff5f14d508688e6e7374b67cb54aaa7249

Tree-SHA512: f27efa1da57947b7f4d42b9322b83d13afe73dd749dd9cac49360002824dd41c99a876a610554ac2d67bad7485020b9dcc423a8e6748fc79d6a10de6d4357d4c
2025-02-10 08:26:01 -05:00
merge-script
6a46be75c4
Merge bitcoin/bitcoin#31793: ci: Use clang-20 for sanitizer tasks
fa5a02bcfa2f3769859332fddb8954d6217de7fc ci: Use clang-20 for sanitizer tasks (MarcoFalke)

Pull request description:

  A new clang version generally comes with bugfixes, new (sanitizer) features, and deprecations.

  Upgrade the sanitizer tasks to use the new version.

  This was also suggested in https://github.com/bitcoin/bitcoin/pull/31691#issuecomment-2602517116

ACKs for top commit:
  fanquake:
    ACK fa5a02bcfa2f3769859332fddb8954d6217de7fc - tested 20 in some other infra, we just needed to fix the same deprecation warnings we'd seen, in cryptofuzz: 09ca550c3e.

Tree-SHA512: 6114d790b5d7145eb5f019e02da6c2c833342707ad67fb9f9c09506001afbef0c9b9beee7e51321f17f12ea692509d6428e6072ad105dba51e4d54cd057621cd
2025-02-10 11:40:17 +01:00
fanquake
76c090145e
guix: remove test-security/symbol-check scripts
These scripts are becoming more of nuisance, than a value-add;
particularly since we've been building releases using Guix. Adding new
(release bin) tests can be harder, because it requires constructing a
failing test, which is becoming less easy e.g trying to disable a
feature or protection that has been built into the compiler/toolchain by
default.

In the pre-Guix days, these were valuable to sanity-check the environment,
because we were pulling that pre-built from Ubuntu, with little control.
At this point, it's less clear what these scripts are (sanity) checking.

Note that these also weren't completely ported to CMake (#31698), see
also #31715 which contains other fixes that would be needed for these
test-tests, to accomodate future changes.
2025-02-10 11:12:33 +01:00
merge-script
329b60f595
Merge bitcoin/bitcoin#31810: TxOrphanage: account for size of orphans and count announcements
e107bf78f9d722fcdeb5c1fba5a784dd7747e12f [fuzz] TxOrphanage::SanityCheck accounting (glozow)
22dccea553253a83c50b2509b881d1c3ae925bdc [fuzz] txorphan byte accounting (glozow)
982ce10178163e07cb009d5fa1bccc0d5b7abece add orphanage byte accounting to TxDownloadManagerImpl::CheckIsEmpty() (glozow)
c289217c01465ab7fc0b0a5e36c514836146ce0e [txorphanage] track the total number of announcements (glozow)
e5ea7daee01e0313d47625b482b3e37bd977a3e7 [txorphanage] add per-peer weight accounting (glozow)
672c69c688f216d70f334498a5fe9b051dc3c652 [refactor] change per-peer workset to info map within orphanage (glozow)
59cd0f0e091f78cd4248c9c4ac6074740dde2a25 [txorphanage] account for weight of orphans (glozow)

Pull request description:

  Part of orphan resolution project, see #27463.

  Definitions:
  - **Announcement** is a unique pair (wtxid, nodeid). We can have multiple announcers for the same orphan since #31397.
  - **Size** is the weight of an orphan. I'm calling it "size" and "bytes" because I think we can refine it in the future to be memusage or be otherwise more representative of the orphan's actual cost on our memory. However, I am open to naming changes.

  This is part 1/2 of a project to also add limits on orphan size and count. However, this PR **does not change behavior**, just adds internal counters/tracking and a fuzzer. I will also open a second PR that adds behavior changes, which requires updating a lot of our tests and careful thinking about DoS.

ACKs for top commit:
  instagibbs:
    reACK e107bf78f9
  marcofleon:
    reACK e107bf78f9d722fcdeb5c1fba5a784dd7747e12f
  sipa:
    utACK e107bf78f9d722fcdeb5c1fba5a784dd7747e12f

Tree-SHA512: 855d725d5eb521d131e36dacc51990725e3ca7881beb13364d5ba72ab2202bbfd14ab83864b13b1b945a4ec5e17890458d0112270b891a41b1e27324a8545d72
2025-02-10 11:06:26 +01:00
merge-script
bc3f59ca53
Merge bitcoin/bitcoin#31820: build: consistently use CLIENT_NAME in libbitcoinkernel.pc.in
f5b9a2f68c95182b139e8a3447b4b5888ecb4f9f build: use CLIENT_NAME in libbitcoinkernel.pc.in (fanquake)

Pull request description:

  Follows up from when the `pc.in` was added.

ACKs for top commit:
  davidgumberg:
    utACK f5b9a2f68c
  stickies-v:
    ACK f5b9a2f68c95182b139e8a3447b4b5888ecb4f9f
  theuni:
    utACK f5b9a2f68c95182b139e8a3447b4b5888ecb4f9f
  hebasto:
    ACK f5b9a2f68c95182b139e8a3447b4b5888ecb4f9f.

Tree-SHA512: 7c32db919aa226f9894ed21baa3f794d1181d43d36ae56ba2d187e1a9bafd89feadc6209ab5b5a1b90d8a3de54fb910736397b1061ef48b232b59792ee250d55
2025-02-10 11:00:46 +01:00
Hennadii Stepanov
dead908654
cmake: Improve compatibility with Python version managers 2025-02-08 06:49:05 +00:00
glozow
e107bf78f9 [fuzz] TxOrphanage::SanityCheck accounting 2025-02-07 13:55:57 -05:00
glozow
fb0ada982a
Merge bitcoin/bitcoin#31811: test: test_inv_block, use mocktime instead of waiting
2706c5b7c8eee7ffd8c3b23a8012f346165ddb93 test: test_inv_block, use mocktime instead of waiting (Greg Sanders)

Pull request description:

  Performance issue reported in https://github.com/bitcoin/bitcoin/pull/31437#issuecomment-2640221382

  It seems that code as-is waits for wall-clock time to pass to synchronize mempools. Locally, sometimes the subtest takes a couple seconds, sometimes it takes an additional minute.

  Just use mocktime?

ACKs for top commit:
  sr-gi:
    tACK [2706c5b](2706c5b7c8)
  rishkwal:
    tACK 2706c5b
  Prabhat1308:
    tACK [2706c5b](2706c5b7c8)

Tree-SHA512: 561fe3d67282c67e1ed7dd5eeb137964c083d498534ea5f749f3d782e73a3f47d23faee6cca39866eaba770fda7b7d60a9f740f16bdb451d6a5e9105417cb158
2025-02-07 11:30:05 -05:00
fanquake
f5b9a2f68c
build: use CLIENT_NAME in libbitcoinkernel.pc.in 2025-02-07 16:11:48 +00:00
fanquake
ea687d2029
doc: swap CPPFLAGS for APPEND_CPPFLAGS
APPEND_CPPFLAGS will be understood by our CMake, whereas CPPFLAGS will
not.
2025-02-07 16:08:10 +00:00
merge-script
81eb6cc2c6
Merge bitcoin/bitcoin#31800: depends: Avoid using the -ffile-prefix-map compiler option
407062f2ac93624f350e9e8a4f641c882a2aaf2f depends: Avoid using the `-ffile-prefix-map` compiler option (Hennadii Stepanov)

Pull request description:

  This PR is similar to https://github.com/bitcoin/bitcoin/pull/31337 and applies analogous changes to all dependency packages.

  The issue was [recently noticed](https://github.com/bitcoin/bitcoin/pull/31661#discussion_r1923896475) when `-ffile-prefix-map` was added to the `libevent` package, which is built in OSS-Fuzz.

  This PR replaces `-ffile-prefix-map` in all packages for consistency.

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

ACKs for top commit:
  davidgumberg:
    Tested ACK 407062f2ac.
  theuni:
    utACK 407062f2ac93624f350e9e8a4f641c882a2aaf2f

Tree-SHA512: c501519c2397b7f11cdab13c0cd4b98a73b305817dba6ff61efc1c80c3cb44134bbd7f55eaecc1dab97f817ce44b28b6c81ccef74ea2d62c93ac43130be4efaf
2025-02-07 11:09:54 +00:00
merge-script
2f98d1e06e
Merge bitcoin/bitcoin#31814: ci: Bump fuzz task timeout
faca7ac13215fd88b420feea8f06d7404f8fd067 ci: Bump fuzz task timeout (MarcoFalke)

Pull request description:

  The fuzz task seems to be the most CPU intense task (going through GB of data through all fuzz inputs for all fuzz targets).

  Normally, the task takes 44 minutes (example https://cirrus-ci.com/task/5077976091459584), but under higher load, it may take longer (https://cirrus-ci.com/task/5966231095738368).

  I tried to move it to GHA to see how it compares, but it will be even slower there: https://github.com/maflcko/bitcoin-core-with-ci/actions/runs/13182526514/job/36796629409.

  The CI machines were recently updated to increase the CI performance, so in theory they could be updated again, but this can take some time and seems like the wrong fix anyway, because it will just hide the problem:

  Ideally fuzzing is fast and when evaluating a fuzz input takes more than 10 seconds, it feels more like a slow unit test loop. So ideally fuzz timeouts should be fixed (https://github.com/bitcoin/bitcoin/issues/31066, https://github.com/bitcoin/bitcoin/issues/30498, ...). However, this can also take time.

  So temporarily bump the fuzz timeout for now.

ACKs for top commit:
  dergoegge:
    ACK faca7ac13215fd88b420feea8f06d7404f8fd067

Tree-SHA512: cfb06d14712d94be6b28a17eee821dcc762453e8efbd9376200f8a0e784a55c2140e45ac48bee9b71ef6e85ae7345155dddc1239cbf0cd4bc02583848fe46308
2025-02-07 09:47:00 +00:00
Daniel Pfeifer
9cf746d663
cmake: add optional source files to crc32c directly 2025-02-07 09:11:45 +01:00
Daniel Pfeifer
9c7823c5b5
cmake: add optional source files to bitcoin_crypto directly
fixes: #31268
2025-02-07 09:11:27 +01:00
MarcoFalke
faca7ac132
ci: Bump fuzz task timeout 2025-02-06 22:21:48 +01:00
glozow
22dccea553 [fuzz] txorphan byte accounting
Co-authored-by: Greg Sanders <gsanders87@gmail.com>
2025-02-06 15:45:30 -05:00
glozow
982ce10178 add orphanage byte accounting to TxDownloadManagerImpl::CheckIsEmpty() 2025-02-06 15:45:30 -05:00
glozow
c289217c01 [txorphanage] track the total number of announcements 2025-02-06 15:45:30 -05:00
glozow
e5ea7daee0 [txorphanage] add per-peer weight accounting 2025-02-06 15:45:30 -05:00
glozow
672c69c688 [refactor] change per-peer workset to info map within orphanage
No change for now, moving from map of NodeId->workset to
NodeId->PeerOrphanInfo struct that holds the workset.

In future commits, we will start tracking more things per-peer in the
orphanage.
2025-02-06 15:29:48 -05:00
glozow
59cd0f0e09 [txorphanage] account for weight of orphans 2025-02-06 15:29:46 -05:00
Hennadii Stepanov
f93d6cb0ca
Merge bitcoin/bitcoin#31809: Prepare "Open Transifex translations for v29.0" release step
2f27c910869e301b7e7669e81a0878da64e49957 qt: Update the `src/qt/locale/bitcoin_en.xlf` translation source file (Hennadii Stepanov)
864386a7444fb5cf16613956ce8bf335f51b67d5 cmake: Ensure generated sources are up to date for `translate` target (Hennadii Stepanov)
2b51dd384b4a2655ee066e8bccd254270d0f5f6c Update Transifex slug for 29.x (Hennadii Stepanov)

Pull request description:

  This PR follows our [Release Process](864386a744/doc/release-process.md).

  It is required to open Transifex translations for v29.0, as scheduled in https://github.com/bitcoin/bitcoin/issues/31029.

  The previous similar PR: https://github.com/bitcoin/bitcoin/pull/30548.

  **Notes for reviewers:**

  1. This is the first release process conducted after migrating the build system to CMake. This revealed a bug, which is fixed in the second commit

  2. To reproduce the diff in the third commit, follow these steps:
  ```
  gmake -C depends -j $(nproc) MULTIPROCESS=1
  cmake --preset dev-mode --toolchain depends/$(./depends/config.guess)/toolchain.cmake
  cmake --build build_dev_mode --target translate
  ```

ACKs for top commit:
  stickies-v:
    ACK 2f27c910869e301b7e7669e81a0878da64e49957

Tree-SHA512: 325ce2418f218b82cc3b0a6c727473963455680cdf6383a85768613ed9e485974b2e52bd5b2e7a7472ad8ebe40bccb2884764d7f9e83dc10a587cd7892e0028b
2025-02-06 20:21:42 +00:00
Cory Fields
f605f7a9c2 build: refactor: set debug definitions in main CMakeLists
No functional change. This is a simple move required the next commit.
2025-02-06 20:21:37 +00:00
Greg Sanders
2706c5b7c8 test: test_inv_block, use mocktime instead of waiting 2025-02-06 11:36:40 -05:00
Sergi Delgado Segura
0a02e7fdea test: deduplicates p2p_tx_download constants
Some of the networking constants defined in p2p_tx_download.py are more generally
defined in p2p.py

Also, rename the remaining ones to match ones defined in txdownloadman
2025-02-06 10:45:40 -05:00
Hennadii Stepanov
2f27c91086
qt: Update the src/qt/locale/bitcoin_en.xlf translation source file
Steps to reproduce the diff:
```
$ gmake -C depends -j $(nproc) MULTIPROCESS=1
$ cmake --preset dev-mode --toolchain depends/$(./depends/config.guess)/toolchain.cmake
$ cmake --build build_dev_mode --target translate
```
2025-02-06 10:30:30 +00:00
Hennadii Stepanov
864386a744
cmake: Ensure generated sources are up to date for translate target
Some sources might be generated, and while they likely do not contain
any translatable strings, this change generalizes the approach to
include generated sources in the translation process as well.
2025-02-06 10:24:45 +00:00
merge-script
d6c229d8bd
Merge bitcoin/bitcoin#31804: ci: Remove no longer needed -Wno-error=documentation
f1d7a6dfa1411ccf741fbf7351ea4f229dd1e63e ci: Remove no longer needed '-Wno-error=documentation' (Hennadii Stepanov)

Pull request description:

  Picked from https://github.com/bitcoin/bitcoin/pull/31726.

ACKs for top commit:
  maflcko:
    lgtm ACK f1d7a6dfa1411ccf741fbf7351ea4f229dd1e63e

Tree-SHA512: 2c4b197da1a60662922341062f9c1fe43b0e35a50194f4757057a48d7538f2f68540ed56508193a5c6a81e3f7dfbca78b15e3c101aae08d8ccd1fc5df0535932
2025-02-06 10:00:03 +00:00
Hennadii Stepanov
2b51dd384b
Update Transifex slug for 29.x
Update the Transifex slug to match the new resource created for the
upcoming 29.x branch.
2025-02-06 09:38:49 +00:00
glozow
82ba505134
Merge bitcoin/bitcoin#31759: test: fixes p2p_ibd_txrelay wait time
1973a9e4f1dfba57051135d6e1bca80979de3879 test: fixes p2p_ibd_txrelay wait time (Sergi Delgado Segura)

Pull request description:

  `p2p_ibd_txrelay` expects no GETDATA to have been received by a peer after announcing a transaction. The reason is that the node is doing IBD, so transaction requests are not replied to. However, the way this is checked is wrong, and the check will pass even if the node **was not** in IBD.

  This is due to the mocktime not being properly initialized, so the check is always performed earlier than it should, making it impossible for the request to be there.

  This can be checked by modifying the test so the peer **is not doing IBD**, and checking how the test succeeds on that assert (even though it fails later on, given the nature of the test):

  ```diff
  index 882f5b5c13..3a69ae5860 100755
  --- a/test/functional/p2p_ibd_txrelay.py
  +++ b/test/functional/p2p_ibd_txrelay.py
  @@ -34,7 +34,7 @@ NORMAL_FEE_FILTER = Decimal(100) / COIN

   class P2PIBDTxRelayTest(BitcoinTestFramework):
       def set_test_params(self):
  -        self.setup_clean_chain = True
  +        # self.setup_clean_chain = True
           self.num_nodes = 2
           self.extra_args = [
               ["-minrelaytxfee={}".format(NORMAL_FEE_FILTER)],
  @@ -43,9 +43,11 @@ class P2PIBDTxRelayTest(BitcoinTestFramework):

       def run_test(self):
           self.log.info("Check that nodes set minfilter to MAX_MONEY while still in IBD")
  -        for node in self.nodes:
  -            assert node.getblockchaininfo()['initialblockdownload']
  -            self.wait_until(lambda: all(peer['minfeefilter'] == MAX_FEE_FILTER for peer in node.getpeerinfo()))
  +        # for node in self.nodes:
  +        #     assert node.getblockchaininfo()['initialblockdownload']
  +        #     self.wait_until(lambda: all(peer['minfeefilter'] == MAX_FEE_FILTER for peer in node.getpeerinfo()))
  ```

ACKs for top commit:
  i-am-yuvi:
    ACK 1973a9e4f1dfba57051135d6e1bca80979de3879
  glozow:
    ACK 1973a9e4f1dfba57051135d6e1bca80979de3879

Tree-SHA512: c4b3afe9927c5480671ebf5c1f6ee5fc7e3aeefeb13c210fa83587a6c126e1a8e40ad8e46587537d0f4bf06a36bbf2310ca065d685d4d9286e5a446b8d5b2235
2025-02-06 00:57:29 -05:00
glozow
ae9eaa063b
Merge bitcoin/bitcoin#31760: test: make sure we are on sync with a peer before checking if they have sent a message
3f4b104b1b7e1b87c0be8e395e02b6ae3c5d7b08 test: make sure we are on sync with a peer before checking if they have sent a message (Sergi Delgado Segura)

Pull request description:

  p2p_orphan_handling checks whether a message has not been requested slightly too soon, making the check always succeed. This passes unnoticed since the expected result is for the message to not have been received, but it will make the test not catch a relevant change that should make it fail.

  An easy way to check this is the case is to modify one of the test cases to force a request within the expected time, and check how the request is not seen. After the change, the test would crash as expected:

  ```diff
  index 963d92485c..30ab5f2035 100755
  --- a/test/functional/p2p_orphan_handling.py
  +++ b/test/functional/p2p_orphan_handling.py
  @@ -186,9 +185,12 @@ class OrphanHandlingTest(BitcoinTestFramework):
           parent_inv = CInv(t=MSG_WTX, h=int(tx_parent_arrives["tx"].getwtxid(), 16))
           assert_equal(len(peer_spy.get_invs()), 0)
           peer_spy.assert_no_immediate_response(msg_getdata([parent_inv]))
  +        txid = 0xdeadbeef
  +        peer_spy.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=txid)]))

           # Request would be scheduled with this delay because it is not a preferred relay peer.
           self.nodes[0].bumpmocktime(NONPREF_PEER_TX_DELAY)
  +        peer_spy.assert_never_requested(int(txid))
           peer_spy.assert_never_requested(int(tx_parent_arrives["txid"], 16))
           peer_spy.assert_never_requested(int(tx_parent_doesnt_arrive["txid"], 16))
           # Request would be scheduled with this delay because it is by txid.
  ```

  It is worth noting that this is not seen in the cases where the message is expected to be received, because in such cases `assert_never_requested` is always after a `wait_....` method, which is already waiting for the node to sync on their end.

ACKs for top commit:
  i-am-yuvi:
    ACK 3f4b104b1b7e1b87c0be8e395e02b6ae3c5d7b08
  instagibbs:
    ACK 3f4b104b1b7e1b87c0be8e395e02b6ae3c5d7b08
  glozow:
    ACK 3f4b104b1b7e1b87c0be8e395e02b6ae3c5d7b08

Tree-SHA512: 321a6605d630bed2217b6374e999dbb84da14138263dd8adf65fe3a6cd7981a50c873beced9cf05cb6d747a912e91017c58e7d4323d25449c87d83095ff4cba9
2025-02-06 00:02:00 -05:00
Hennadii Stepanov
f1d7a6dfa1
ci: Remove no longer needed '-Wno-error=documentation' 2025-02-05 17:24:36 +00:00
merge-script
a43f08c4ae
Merge bitcoin/bitcoin#25832: tracing: network connection tracepoints
e3622a969293feea75cfadc8f7c6083edcd6d8de tracing: document that peer addrs can be >68 chars (0xb10c)
b19b526758f055733e1c21809cf975169fdd39b0 tracing: log_p2p_connections.bt example (0xb10c)
caa5486574baf805b36c8abc873554aee4ba82b7 tracing: connection closed tracepoint (0xb10c)
b2ad6ede95ea66e8677b31d614e183953966db54 tracing: add misbehaving conn tracepoint (0xb10c)
68c1ef4f19bc4ebe0ca1af95ac378732c4fe6d22 tracing: add inbound connection eviction tracepoint (0xb10c)
4d61d52f4387622701cdad4bb0fb115127021106 tracing: add outbound connection tracepoint (0xb10c)
85b2603eec634257cd3b398900dbb92251db71e6 tracing: add inbound connection tracepoint (0xb10c)

Pull request description:

  This adds five new tracepoints with documentation and tests for network connections:

  - established connections with `net:inbound_connection` and `net:outbound_connection`
  - closed connections (both closed by us or by the peer) with `net:closed_connnection`
  - inbound connections that we choose to evict with `net:evicted_inbound_connection`
  - connections that are misbehaving and punished with `net:misbehaving_connection`

  I've been using these tracepoints for a few months now to monitor connection lifetimes, re-connection frequency by IP and netgroup, misbehavior, peer discouragement, and eviction and more. Together with the two existing P2P message tracepoints they allow for a good overview of local P2P network activity. Also sort-of addresses https://github.com/bitcoin/bitcoin/pull/22006#discussion_r636775863.

  I've been back and forth on which arguments to include. For example, `net:evicted_connection` could also include some of the eviction metrics like e.g. `last_block_time`, `min_ping_time`, ... but I've left them out for now. If wanted, this can be added here or in a follow-up. I've tried to minimize a potential performance impact by measuring executed instructions with `gdb` where possible (method described [here](https://github.com/bitcoin/bitcoin/pull/23724#issuecomment-996919963)). I don't think a few hundred extra instructions are too crucial, as connection opens/closes aren't too frequent (compared to e.g. P2P messages).   Note: e.g. `CreateNodeFromAcceptedSocket()` usually executes between 80k and 90k instructions for each new inbound connection.

  | tracepoint                 | instructions                                           |
  |----------------------------|--------------------------------------------------------|
  | net:inbound_connection     | 390 ins                                                |
  | net:outbound_connection    | between 700 and 1000 ins                                     |
  | net:closed_connnection     | 473 ins                                                |
  | net:evicted_inbound_connection     | not measured; likely similar to net:closed_connnection |
  | net:misbehaving_connection | not measured                                           |

  Also added a bpftrace (tested with v0.14.1) `log_p2p_connections.bt` example script that produces output similar to:
  ```
  Attaching 6 probes...
  Logging opened, closed, misbehaving, and evicted P2P connections
  OUTBOUND conn to 127.0.0.1:15287: id=0, type=block-relay-only, network=0, total_out=1
  INBOUND conn from 127.0.0.1:45324: id=1, type=inbound, network=0, total_in=1
  MISBEHAVING conn id=1, message='getdata message size = 50001'
  CLOSED conn to 127.0.0.1:15287: id=0, type=block-relay-only, network=0, established=1231006505
  EVICTED conn to 127.0.0.1:45324: id=1, type=inbound, network=0, established=1612312312
  ```

ACKs for top commit:
  laanwj:
    re-ACK e3622a969293feea75cfadc8f7c6083edcd6d8de
  vasild:
    ACK e3622a969293feea75cfadc8f7c6083edcd6d8de
  sipa:
    utACK e3622a969293feea75cfadc8f7c6083edcd6d8de

Tree-SHA512: 1032dcac6fe0ced981715606f82c2db47016407d3accb8f216c978f010da9bc20453e24a167dcc95287f4783b48562ffb90f645bf230990e3df1b9b9a6d4e5d0
2025-02-05 15:30:52 +00:00
Hennadii Stepanov
407062f2ac
depends: Avoid using the -ffile-prefix-map compiler option
The `-ffile-prefix-map` compiler option implicitly enables
`-fprofile-prefix-map` in GCC or `-fcoverage-prefix-map` in Clang, which
can cause issues with coverage builds.

This change ensures that only the options necessary for build
reproducibility are applied.
2025-02-05 14:36:48 +00:00
merge-script
b9c241804c
Merge bitcoin/bitcoin#30226: test: add validation for gettxout RPC response
723440c5b8eb3a815c80bfb37ad195b5448b25ed test framework, wallet: rename get_scriptPubKey method to get_output_script (Alfonso Roman Zubeldia)
fa0232a3e07ad6d11b4d4aaec93e9531ac3274f3 test: add validation for gettxout RPC response (Alfonso Roman Zubeldia)

Pull request description:

  Added a new test in `test/functional/rpc_blockchain.py` to validate the gettxout RPC response. This new test ensures all response elements are verified, including `bestblock`, `confirmations`, `value`, `coinbase`, and `scriptPubKey` details.

  Also renamed the method `get_scriptPubKey` from `test/functional/test_framework/wallet.py` to the modern name `get_output_script` as suggested by maflcko (https://github.com/bitcoin/bitcoin/pull/30226#discussion_r1925491846)

ACKs for top commit:
  fjahr:
    reACK 723440c5b8eb3a815c80bfb37ad195b5448b25ed
  maflcko:
    lgtm ACK 723440c5b8eb3a815c80bfb37ad195b5448b25ed
  brunoerg:
    code review ACK 723440c5b8eb3a815c80bfb37ad195b5448b25ed

Tree-SHA512: 3384578909d2e7548cef302c5b8a9fed5b82dfc942892503ad4a05e73f5cceafad1eab3af9a27e54aef3db7631f8935298d6b882c70d2f02a9a75b8e3c209b6c
2025-02-05 13:30:51 +00:00
merge-script
1334ca6c07
Merge bitcoin/bitcoin#31437: func test: Expand tx download preference tests
846a1387280fa584f70ccb1f5d0198339b065528 func test: Expand tx download preference tests (Greg Sanders)

Pull request description:

  1. Check that outbound nodes are treated the same as whitelisted connections for
  the purposes of `getdata` delays

  2. Add test case that demonstrates download retries are preferentially
  given to outbound (preferred) connections
  even when multiple announcements are
  considered ready.

  `NUM_INBOUND` is a magic number large enough that it should fail over 90% of the time
  if the underlying outbound->preferred->PriorityComputer logic was broken. Bumping this
  to 100 peers cost another 14 seconds locally for the sub-test, so I made it pretty small.

ACKs for top commit:
  i-am-yuvi:
    tACK 846a1387280fa584f70ccb1f5d0198339b065528 good catch
  maflcko:
    ACK 846a1387280fa584f70ccb1f5d0198339b065528 🍕
  marcofleon:
    lgtm ACK 846a1387280fa584f70ccb1f5d0198339b065528

Tree-SHA512: 337aa4dc33b5c0abeb4fe7e4cd5e389f7f53ae25dd991ba26615c16999872542391993020122fd255af4c7163f76c1d1feb2f2d6114f12a364c0360d4d52b8c3
2025-02-05 13:21:58 +00:00
merge-script
33932d30e3
Merge bitcoin/bitcoin#31784: test: added additional coverage to waitforblock and waitforblockheight rpc's
7e0db87d4fff996c086f6e86b62338c98ef30c55 test: added additional coverage to waitforblock and waitforblockheight rpc's (kevkevinpal)

Pull request description:

  Similar to https://github.com/bitcoin/bitcoin/pull/31746

  This adds test coverage to the `waitforblock` and `waitforblockheight` rpc's by adding a test to assert we get an rpc error if we include a negative timeout

ACKs for top commit:
  Sjors:
    utACK 7e0db87d4fff996c086f6e86b62338c98ef30c55
  Prabhat1308:
    ACK [7e0db87](7e0db87d4f)
  brunoerg:
    code review ACK 7e0db87d4fff996c086f6e86b62338c98ef30c55
  BrandonOdiwuor:
    Code Review ACK 7e0db87d4fff996c086f6e86b62338c98ef30c55

Tree-SHA512: c3b1b3a525e91e0092b783d73d2401126e3b8792a394be00374258f20cf3d619498e6625d3aad5e5ced29509c5eac828ee03c4ee66ba405b91e89be7e8b07311
2025-02-05 10:38:00 +00:00
merge-script
2aa7be1744
Merge bitcoin/bitcoin#31358: depends: Avoid hardcoding host_prefix in toolchain file
d9c8aacce38ab593ea9277976eb64ccadd7d062f depends, refactor: Avoid hardcoding `host_prefix` in toolchain file (Hennadii Stepanov)

Pull request description:

  This PR allows the entire `depends/<host_prefix>` directory to be relocatable.

  Only `libevent` package configuration files are non-relocatable for the version `2.1.12-stable` we use now. However, this issue has been fixed upstream in 1f1593ff27 and friends.

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

ACKs for top commit:
  theuni:
    Neat. utACK d9c8aacce38ab593ea9277976eb64ccadd7d062f
  ryanofsky:
    Code review ACK d9c8aacce38ab593ea9277976eb64ccadd7d062f

Tree-SHA512: c4c340722e63fc1da36fba2b15f025a6e1d477da1991194d678f546f2f3ea9454e2f0ff054aae6ae6c332a0781a597c3ce63b9018b46b8c258033f0d19efbef3
2025-02-05 10:35:25 +00:00
ismaelsadeeq
386eecff5f
doc: add release notes 2025-02-04 11:57:56 -05:00
ismaelsadeeq
3eaa0a3b66
miner: init: add -blockreservedweight startup option
- Prevent setting the value of `-blockreservedweight` below
  a safety value of 2000.
2025-02-04 11:53:11 -05:00
ismaelsadeeq
777434a2cd
doc: rpc: improve getmininginfo help text
- The reserved weight of the coinbase transaction is an estimate and
  may not reflect the exact value; it can be lower.

- It should be clear that `currentblockweight` includes the reserved coinbase transaction weight.
  whereas `currentblocktx` does not account for the coinbase transaction count.

- Also clarify `m_last_block_num_txs` and `m_last_block_weight`
2025-02-04 11:53:11 -05:00
ismaelsadeeq
c8acd4032d
init: fail to start when -blockmaxweight exceeds MAX_BLOCK_WEIGHT 2025-02-04 11:53:11 -05:00
ismaelsadeeq
5bb31633cc
test: add -blockmaxweight startup option functional test 2025-02-04 11:53:11 -05:00
ismaelsadeeq
2c7d90a6d6
miner: bugfix: fix duplicate weight reservation in block assembler
- This commit renamed coinbase_max_additional_weight to block_reserved_weight.

- Also clarify that the reservation is for block header, transaction count
  and coinbase transaction.
2025-02-04 11:53:03 -05:00
MarcoFalke
fa5a02bcfa
ci: Use clang-20 for sanitizer tasks 2025-02-04 17:05:17 +01:00
furszy
474139aa9b
wallet: abandon inactive coinbase tx and their descendants during startup 2025-02-04 10:55:19 -05:00
brunoerg
bb0879ddab test: check scanning field from getwalletinfo
During a rescan, check that `getwalletinfo` returns
properly information (the scanning field) about it.
2025-02-04 10:48:20 -03:00
merge-script
94ca99ac51
Merge bitcoin/bitcoin#31666: multi-peer orphan resolution followups
7426afbe62414fa575f91b4f8d3ea63bcc653e8b [p2p] assign just 1 random announcer in AddChildrenToWorkSet (glozow)
4c1fa6b28c292dcaf11d605e0e8c2bbf59cc4de4 test fix: make peer who sends MSG_TX announcement non-wtxidrelay (glozow)
2da46b88f09ff3c58c94bd258273c04d16c8b649 pass P2PTxInvStore init args to P2PInterface init (glozow)
e3bd51e4b52069d1db5c478aaec00666fc8f4101 [doc] how unique_parents can be empty (glozow)
32eb6dc758a90b6c154d1e3e503f0d4840c44b02 [refactor] assign local variable for wtxid (glozow)
18820ccf6b2163b42ee1256d33cc3d14d268b682 multi-announcer orphan handling test fixups (glozow)
c4cc61db98ff1f0a5943fc7469adf9d9df6fddcd [fuzz] GetCandidatePeers (glozow)
7704139cf0dbddf322eac2af9be0c3f2838bc285 [refactor] make GetCandidatePeers take uint256 and in-out vector (glozow)
6e4d392a7536d9c5e1afc60196ee82195dbfec35 [refactor] rename to OrphanResolutionCandidate to MaybeAdd* (glozow)
57221ad97971d399a90d509c5e7b64227f6b2b5e [refactor] move parent inv-adding to OrphanResolutionCandidate (glozow)

Pull request description:

  Followup to #31397.

  Addressing (in order):
  https://github.com/bitcoin/bitcoin/pull/31397#discussion_r1906077380
  https://github.com/bitcoin/bitcoin/pull/31397#discussion_r1881060842
  https://github.com/bitcoin/bitcoin/pull/31397#discussion_r1905994963
  https://github.com/bitcoin/bitcoin/pull/31397#discussion_r1905999581
  https://github.com/bitcoin/bitcoin/pull/31397#discussion_r1906001592
  https://github.com/bitcoin/bitcoin/pull/31397#discussion_r1905989913
  https://github.com/bitcoin/bitcoin/pull/31397#discussion_r1905920861
  https://github.com/bitcoin/bitcoin/pull/31658#pullrequestreview-2551617694
  https://github.com/bitcoin/bitcoin/pull/31397#discussion_r1917559601

ACKs for top commit:
  instagibbs:
    reACK 7426afbe62414fa575f91b4f8d3ea63bcc653e8b
  marcofleon:
    reACK 7426afbe62414fa575f91b4f8d3ea63bcc653e8b
  mzumsande:
    Code Review ACK 7426afbe62414fa575f91b4f8d3ea63bcc653e8b
  dergoegge:
    Code review ACK 7426afbe62414fa575f91b4f8d3ea63bcc653e8b

Tree-SHA512: bca8f576873fdaa20b758e1ee9708ce94e618ff14726864b29b50f0f9a4db58136a286d2b654af569b09433a028901fe6bcdda68dcbfea71e2d1271934725503
2025-02-04 10:10:29 +00:00