0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-21 12:22:50 -05:00
Commit graph

43929 commits

Author SHA1 Message Date
Ava Chow
43e71f7498
Merge bitcoin/bitcoin#27432: contrib: add tool to convert compact-serialized UTXO set to SQLite database
4080b66cbe test: add test for utxo-to-sqlite conversion script (Sebastian Falbesoner)
ec99ed7380 contrib: add tool to convert compact-serialized UTXO set to SQLite database (Sebastian Falbesoner)

Pull request description:

  ## Problem description

  There is demand from users to get the UTXO set in form of a SQLite database (#24628). Bitcoin Core currently only supports dumping the UTXO set in a binary _compact-serialized_ format, which was crafted specifically for AssumeUTXO snapshots (see PR #16899), with the primary goal of being as compact as possible. Previous PRs tried to extend the `dumptxoutset` RPC with new formats, either in human-readable form (e.g. #18689, #24202), or most recently, directly as SQLite database (#24952). Both are not optimal: due to the huge size of the ever-growing UTXO set with already more than 80 million entries on mainnet, human-readable formats are practically useless, and very likely one of the first steps would be to put them in some form of database anyway. Directly adding SQLite3 dumping support on the other hand introduces an additional dependency to the non-wallet part of bitcoind and the risk of increased maintenance burden (see e.g. https://github.com/bitcoin/bitcoin/pull/24952#issuecomment-1163551060, https://github.com/bitcoin/bitcoin/issues/24628#issuecomment-1108469715).

  ## Proposed solution

  This PR follows the "external tooling" route by adding a simple Python script for achieving the same goal in a two-step process (first create compact-serialized UTXO set via `dumptxoutset`, then convert it to SQLite via the new script). Executive summary:
  - single file, no extra dependencies (sqlite3 is included in Python's standard library [1])
  - ~150 LOC, mostly deserialization/decompression routines ported from the Core codebase and (probably the most difficult part) a little elliptic curve / finite field math to decompress pubkeys (essentialy solving the secp256k1 curve equation y^2 = x^3 + 7 for y given x, respecting the proper polarity as indicated by the compression tag)
  - creates a database with only one table `utxos` with the following schema:
    ```(txid TEXT, vout INT, value INT, coinbase INT, height INT, scriptpubkey TEXT)```
  - the resulting file has roughly 2x the size of the compact-serialized UTXO set (this is mostly due to encoding txids and scriptpubkeys as hex-strings rather than bytes)

  [1] note that there are some rare cases of operating systems like FreeBSD though, where the sqlite3 module has to installed explicitly (see #26819)

  A functional test is also added that creates UTXO set entries with various output script types (standard and also non-standard, for e.g. large scripts) and verifies that the UTXO sets of both formats match by comparing corresponding MuHashes. One MuHash is supplied by the bitcoind instance via `gettxoutsetinfo muhash`, the other is calculated in the test by reading back the created SQLite database entries and hashing them with the test framework's `MuHash3072` module.

  ## Manual test instructions
  I'd suggest to do manual tests also by comparing MuHashes. For that, I've written a go tool some time ago which would calculate the MuHash of a sqlite database in the created format (I've tried to do a similar tool in Python, but it's painfully slow).
  ```
  $ [run bitcoind instance with -coinstatsindex]
  $ ./src/bitcoin-cli dumptxoutset ~/utxos.dat
  $ ./src/bitcoin-cli gettxoutsetinfo muhash <block height returned in previous call>
  (outputs MuHash calculated from node)

  $ ./contrib/utxo-tools/utxo_to_sqlite.py ~/utxos.dat ~/utxos.sqlite
  $ git clone https://github.com/theStack/utxo_dump_tools
  $ cd utxo_dump_tools/calc_utxo_hash
  $ go run calc_utxo_hash.go ~/utxos.sqlite
  (outputs MuHash calculated from the SQLite UTXO set)

  => verify that both MuHashes are equal
  ```
  For a demonstration what can be done with the resulting database, see https://github.com/bitcoin/bitcoin/pull/24952#pullrequestreview-956290477 for some example queries. Thanks go to LarryRuane who gave me to the idea of rewriting this script in Python and adding it to `contrib`.

ACKs for top commit:
  ajtowns:
    ACK 4080b66cbe - light review
  achow101:
    ACK 4080b66cbe
  romanz:
    tACK 4080b66cbe on signet (using [calc_utxo_hash](8981aa3e85/calc_utxo_hash/calc_utxo_hash.go)):
  tdb3:
    ACK 4080b66cbe

Tree-SHA512: be8aa0369a28c8421a3ccdf1402e106563dd07c082269707311ca584d1c4c8c7b97d48c4fcd344696a36e7ab8cdb64a1d0ef9a192a15cff6d470baf21e46ee7b
2025-02-14 15:22:10 -08:00
Ava Chow
e53310c47a
Merge bitcoin/bitcoin#30529: Fix -norpcwhitelist, -norpcallowip, and similar corner case behavior
a85e8c0e61 doc: Add some general documentation about negated options (Ryan Ofsky)
490c8fa178 doc: Add release notes summarizing negated option behavior changes. (Ryan Ofsky)
458ef0a11b refactor: Avoid using IsArgSet() on -connect list option (Ryan Ofsky)
752ab9c3c6 test: Add test to make sure -noconnect disables -dnsseed and -listen by default (Ryan Ofsky)
3c2920ec98 refactor: Avoid using IsArgSet() on -signetseednode and -signetchallenge list options (Ryan Ofsky)
d05668922a refactor: Avoid using IsArgSet() on -debug, -loglevel, and -vbparams list options (Ryan Ofsky)
3d1e8ca53a Normalize inconsistent -noexternalip behavior (Ryan Ofsky)
ecd590d4c1 Normalize inconsistent -noonlynet behavior (Ryan Ofsky)
5544a19f86 Fix nonsensical bitcoin-cli -norpcwallet behavior (Ryan Ofsky)
6e8e7f433f Fix nonsensical -noasmap behavior (Ryan Ofsky)
b6ab350806 Fix nonsensical -notest behavior (Ryan Ofsky)
6768389917 Fix nonsensical -norpcwhitelist behavior (Ryan Ofsky)
e03409c70f Fix nonsensical -norpcbind and -norpcallowip behavior (Ryan Ofsky)
40c4899bc2 Fix nonsensical -nobind and -nowhitebind behavior (Ryan Ofsky)
5453e66fd9 Fix nonsensical -noseednode behavior (Ryan Ofsky)

Pull request description:

  The PR changes behavior of negated `-noseednode`, `-nobind`, `-nowhitebind`, `-norpcbind`, `-norpcallowip`, `-norpcwhitelist`, `-notest`, `-noasmap`, `-norpcwallet`, `-noonlynet`, and `-noexternalip` options, so negating these options just clears previously specified values doesn't have other side effects.

  Negating options on the command line can be a useful way of resetting options that may have been set earlier in the command line or config file. But before this change, negating these options wouldn't fully reset them, and would have confusing and undocumented side effects (see commit descriptions for details). Now, negating these options just resets them and behaves the same as not specifying them.

  Motivation for this PR is to fix confusing behaviors and also to remove incorrect usages of the `IsArgSet()` function. Using `IsArgSet()` tends to lead to negated option bugs in general, but it especially causes bugs when used with list settings returned by `GetArgs()`, because when these settings are negated, `IsArgSet()` will return true but `GetArgs()` will return an empty list. This PR eliminates all uses of `IsArgSet()` and `GetArgs()` together, and followup PR #17783 makes it an error to use `IsArgSet()` on list settings, since calling `IsArgSet()` is never actually necessary. Most of the changes here were originally made in #17783 and then moved here to be easier to review and avoid a dependency on #16545.

ACKs for top commit:
  achow101:
    ACK a85e8c0e61
  danielabrozzoni:
    re-ACK a85e8c0e61
  hodlinator:
    re-ACK a85e8c0e61

Tree-SHA512: dd4b19faac923aeaa647b1c241d929609ce8242b43e3b7bc32523cc48ec92a83ac0dc5aee79f1eba8794535e0314b96cb151fd04ac973671a1ebb9b52dd16697
2025-02-14 15:10:09 -08:00
Ava Chow
254fd89d39
Merge bitcoin/bitcoin#31863: random: Initialize variables in hardware RNG functions
99755e04ff random: Initialize variables in hardware RNG functions (Eval EXEC)

Pull request description:

  See: https://github.com/bitcoin/bitcoin/pull/31826#discussion_r1955045279 , So this PR want to prevent potential uninitialized value issues and improve code clarity.

ACKs for top commit:
  sipa:
    utACK 99755e04ff
  achow101:
    ACK 99755e04ff

Tree-SHA512: 4cf9c214617769cf051b4f36453275b407e37d96315b6a206102d17019375b3834ba07e2ccb28c7650c90ff8e1f1034522fccafaa33e136dfe63cc68396a1f6e
2025-02-14 15:03:32 -08:00
Ava Chow
75f8396c90
Merge bitcoin/bitcoin#30746: test: cover base[32|58|64] with symmetric roundtrip fuzz (and padding) tests
f919d919eb fuzz: Add fuzzing for max_ret_len in DecodeBase58/DecodeBase58Check (Lőrinc)
635bc58f46 test: Fuzz Base32/Base58/Base64 roundtrip conversions (Lőrinc)
5dd3a0d8a8 test: Extend base58_encode_decode.json with edge cases (Lőrinc)
ae40cf1a8e test: Add padding tests for Base32/Base64 (Lőrinc)

Pull request description:

  Added fuzzed roundtrips for `base[32|58|64]` encoding to make sure encoding/decoding are symmetric.
  Note that if we omit the padding in `EncodeBase32` we won't be able to decode it with `DecodeBase32`.
  Added dedicated padding tests to cover failure behavior
  Also moved over the Base58 json test edge cases from https://github.com/bitcoin/bitcoin/pull/30035

ACKs for top commit:
  hodlinator:
    re-ACK f919d919eb
  achow101:
    ACK f919d919eb

Tree-SHA512: 6a6c63d0a659b70d42aad7a8f37ce6e372756e2c88c84e7be5c1ff1f2a7c58860ed7113acbe1a9658a7d19deb91f0abe2ec527ed660335845cd1e0a9380b4295
2025-02-14 14:48:01 -08:00
Ava Chow
c4b46b4589
Merge bitcoin/bitcoin#31629: wallet: fix rescanning inconsistency
4818da809f wallet: fix rescanning inconsistency (Martin Zumsande)

Pull request description:

  If the chain advances during a rescan, ScanForWalletTransactions would previously process the new blocks without adjusting `m_last_processed_block`, which would leave the wallet in an inconsistent state temporarily, and could lead to crashes in the GUI reported in #31474.
  Fix this by not rescanning blocks beyond `m_last_processed_block` - for all blocks beyond that height, there will be pending BlockConnected notifications that will process them after the rescan is finished.

  This means that if rescanning was triggered with `cs_wallet` permanently held (`AttachChain`), additional blocks that were connected during the rescan will only be processed with the pending `blockConnected` notifications after the lock is released.
  If rescanning without a permanent `cs_wallet` lock (`RescanFromTime`), additional blocks that were connected during the rescan can be re-processed here because `m_last_processed_block` was already updated by `blockConnected`.

  Fixes #31474

ACKs for top commit:
  psgreco:
    Not that it matters much, but UTACK 4818da809f
  achow101:
    ACK 4818da809f
  furszy:
    utACK 4818da809f

Tree-SHA512: 8e7dbc9e00019aef4f80a11776f3089cd671e0eadd3c548cc6267b5c722433f80339a9b2b338ff9b611863de75ed0a817a845e1668e729b71af70c9038b075af
2025-02-14 14:42:12 -08:00
Ava Chow
d0dfd6d3f6
Merge bitcoin/bitcoin#31865: build: move rpc/external_signer to node library
e501246e77 build: move rpc/external_signer to node library (fanquake)

Pull request description:

  Move `rpc/external_signer` from `bitcoin_common` to `bitcoin_node`.
  Remove the check-deps suppression.

ACKs for top commit:
  maflcko:
    lgtm ACK e501246e77
  achow101:
    ACK e501246e77
  TheCharlatan:
    ACK e501246e77

Tree-SHA512: d535da9038a6b37bd83e852721b42c0806b9ddf060a9b96544027a34d11c1728b3b97385768fca1acc483c6632c28050e2194e2d2ac831d944f332431bfd6792
2025-02-14 14:32:28 -08:00
Ava Chow
ce4dbfc359
Merge bitcoin/bitcoin#31851: doc: build: Fix instructions for msvc gui builds
c3fa043ae5 doc: build: Fix instructions for msvc gui builds (David Gumberg)

Pull request description:

  If the instructions in `doc/build-windows-msvc.md` are followed as-is, and "Developer (PowerShell|Command Prompt) for VS 2022" is used to execute the suggested build commands, the root directory of vcpkg (e.g. in VS 2022 Community edition: `C:\Program Files\Microsoft Visual Studio\2022\Community\VC\vcpkg`), is too long, and when vcpkg attempts to build any of the QT packages, it will fail because of build steps that require path lengths greater than Windows' `MAX_PATH` 260 character limit. This can be avoided without needing to move the vcpkg root dir by setting [`--x-buildtrees-root`](https://learn.microsoft.com/en-us/vcpkg/commands/common-options#buildtrees-root) to a short path, like `C:\vcpkg`.

  See e.g. https://github.com/microsoft/vcpkg/issues/28451, https://github.com/microsoft/vcpkg/issues/28083, https://github.com/microsoft/vcpkg/issues/24751.

ACKs for top commit:
  achow101:
    ACK c3fa043ae5
  hebasto:
    ACK c3fa043ae5.
  TheCharlatan:
    ACK c3fa043ae5

Tree-SHA512: 7de11d38b9125de63e72415f79d82f18818123a1b37f679f2229c4c82f5628dd7d1039dbc5dcdf1bc1c8c382e3e29de74a31d256e73872cbf1fa2687c52185ca
2025-02-14 14:11:54 -08:00
Ava Chow
504d0c21e2
Merge bitcoin/bitcoin#31439: validation: In case of a continued reindex, only activate chain in the end
c9136ca906 validation: fix issue with an interrupted -reindex (Martin Zumsande)
a2675897e2 validation: Don't loop over all chainstates in LoadExternalBlock (Martin Zumsande)

Pull request description:

  If a user interrupts a reindex while it is iterating over the block files, it will continue to reindex with the next node start (if the `-reindex` arg is dropped, otherwise it will start reindexing from scratch).
  However, due to an early call to `ActivateBestChainState()` that only exists to connect the genesis block during
  the original `-reindex`, it wil start connecting blocks immediately before having iterated through all block files.
  Because later headers above the minchainwork threshold won't be loaded in this case, `-assumevalid` will not
  be applied and the process is much slower due to script validation being done.

  Fix this by only calling `ActivateBestChainState()` here if Genesis is not connected yet (equivalent to `ActiveHeight() == -1`).
  Also simplify this spot by only doing this for the active chainstate instead of looping over all chainstates (first commit).

  This issue was discussed in the thread below https://github.com/bitcoin/bitcoin/pull/31346#discussion_r1856824817, the impact on assumevalid was found by l0rinc.

  The fix can be tested by manually aborting a `-reindex` e.g. on signet and observing in the debug log the order in which blockfiles are indexed / blocks are connected with this branch vs master.

ACKs for top commit:
  achow101:
    ACK c9136ca906
  ryanofsky:
    Code review ACK c9136ca906. Only comments changed since last review. Appreciate the new comments, I think they make a little clearer what things code is trying to do and what things are just side-effects.
  TheCharlatan:
    Re-ACK c9136ca906

Tree-SHA512: 6f34abc317ad7e605ccc0c2f4615e4ea6978223d207f80f768f39cc135a9ac0adf31681fadfa2aed45324a5d27a4f68c5e118ee7eec18ca5c40ef177caa9cc47
2025-02-14 13:59:34 -08:00
Ava Chow
0b48f77e10
Merge bitcoin/bitcoin#31413: rpc: Remove deprecated dummy alias for listtransactions::label
fa8e0956c2 rpc: Remove deprecated dummy alias for listtransactions::label (MarcoFalke)

Pull request description:

  The RPC arg is not a dummy, but a label, so offering an undocumented alias is inconsistent with all other label interfaces and confusing at best, if not entirely unused.

  Fix it by removing the deprecated alias.

  This pull is a breaking change, but it should be limited, because it only affects someone using the deprecated named arg on this RPC. I can't imagine anyone doing this, because in all other places where label args are accepted, they are called `label`. If someone really didn't use `label` here as named arg, it would be trivial and less confusing for them to fix it up.

ACKs for top commit:
  achow101:
    ACK fa8e0956c2
  rkrux:
    tACK fa8e0956c2
  ryanofsky:
    Code review ACK fa8e0956c2

Tree-SHA512: 0d0f3f53237ff9fac8c065b7d0a4245f5ff86efa427dbeeca711765494b7315a9d72b44751d346c76422847daf3d7ff90dbccb5ba200b089fb96128bd95da9f0
2025-02-14 13:29:17 -08:00
Ava Chow
21a0efaf8c
Merge bitcoin/bitcoin#29858: test: Add test for rpcwhitelistdefault
f0e5e4cdbe test: Add test for rpcwhitelistdefault (naiyoma)

Pull request description:

  This PR adds tests for `rpcwhitelistdefault.` The implementation is a continuation of this [PR](https://github.com/bitcoin/bitcoin/pull/17805).

  Applied suggestions  to include the tests in` rpc_whitelist.py` and to use a single node.

  PR covers three test cases:
  - rpcwhitelistdefault = 0, no permissions
  - rpcwhitelistdefault = 1, no permissions
  - rpcwhitelistdefault = 1, with user permissions

  I didn't add tests for rpcwhitelistdefault = 0 with user permissions since that is already tested here: [rpc_whitelist.py#L77](https://github.com/bitcoin/bitcoin/blob/master/test/functional/rpc_whitelist.py#L77).

ACKs for top commit:
  achow101:
    ACK f0e5e4cdbe
  ryanofsky:
    Code review ACK f0e5e4cdbe. PR seems very clear and simple, moving 1 test and adding 3 new tests.
  ismaelsadeeq:
    Tested and Code review ACK f0e5e4cdbe

Tree-SHA512: c3652940d2f23746e769ebe834e43dee47b7af8f258cbb133e38663aa8a05a1a8d0194d3008c3a10b0c54d11b5b95420c9cad0aa761c0fc1b9559277443b0696
2025-02-14 11:27:01 -08:00
Ava Chow
8a00b755e9
Merge bitcoin/bitcoin#31634: doc: Improve dependencies documentation
a759ea3e92 doc: Improve dependencies documentation (Nicola Leonardo Susca)

Pull request description:

  Initially there was a distinction between the compiler dependencies and
  other required dependencies (refs https://github.com/bitcoin/bitcoin/pull/23565) but the distinction was
  removed (refs https://github.com/bitcoin/bitcoin/pull/24585) which is why having two distinct tables could lead
  to confusion now.

ACKs for top commit:
  achow101:
    ACK a759ea3e92
  hodlinator:
    re-ACK a759ea3e92
  rkrux:
    ACK a759ea3e92

Tree-SHA512: 14aaf9356d65bd150c9993dcbc51b1b98c835a760b95e6d91e69460c97c18f1dd10eb52b9f1d70129e6aa5e361af3a55619fd35787ed4e1ec48909568adbb604
2025-02-14 11:04:24 -08:00
Ava Chow
e58605e04f
Merge bitcoin/bitcoin#31854: net: reduce CAddress usage to CService or CNetAddr
cd4bfaee10 net: reduce CAddress usage to CService or CNetAddr (Vasil Dimov)

Pull request description:

  Using `CAddress` when only `CService` or `CNetAddr` is needed is excessive and confusing. Fix those occurrences to use the class they need:

  * `CConnman::CalculateKeyedNetGroup()` needs `CNetAddr`, not `CAddress`, thus change its argument.

  * Both callers of `CConnman::CreateNodeFromAcceptedSocket()` create a dummy `CAddress` from `CService`, so use `CService` instead.

  * `GetBindAddress()` only needs to return `CService`.

  * `CNode::addrBind` only needs to be `CService`.

ACKs for top commit:
  Sjors:
    ACK cd4bfaee10
  achow101:
    ACK cd4bfaee10
  hodlinator:
    ACK cd4bfaee10
  laanwj:
    Code review ACK cd4bfaee10

Tree-SHA512: 0b41c1519784eeeaf9926c6a4d24f583b90c3376741f37a3199a3808b0dd6d143d3f929bd7c06f87b031f4fc1c2bd7a6dfc7d715ec1f79bf36b862c00fd67085
2025-02-14 10:56:14 -08:00
merge-script
06b9236f43
Merge bitcoin/bitcoin#31359: cmake: Add CheckLinkerSupportsPIE module
81c174e318 cmake: Refer to the configure log instead of printing PIE test error (Hennadii Stepanov)
65a0920ca6 cmake: Add `CheckLinkerSupportsPIE` module (Hennadii Stepanov)

Pull request description:

  This new module is a wrapper around CMake's `CheckPIESupported` module that fixes an upstream bug.

  See: https://gitlab.kitware.com/cmake/cmake/-/issues/26463.

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

ACKs for top commit:
  theuni:
    utACK 81c174e318.
  vasild:
    ACK 81c174e318

Tree-SHA512: 77d7022238551a4e69c59d1fe6b78975bb552cbbed5339459853d7ebf0086813036081f464fed230be330b3bd7d6cf8590b536b064028d2f786d6ae40f342f95
2025-02-14 18:02:35 +01:00
fanquake
e501246e77
build: move rpc/external_signer to node library 2025-02-14 14:38:41 +01:00
merge-script
73e2ec1373
Merge bitcoin/bitcoin#31844: cmake: add a component for each binary
9b033bebb1 cmake: rename Kernel component to bitcoinkernel for consistency (Cory Fields)
2e0c92558e cmake: add and use install_binary_component (Cory Fields)
0264c5d86c cmake: use per-target components for bitcoin-qt and bitcoin-gui (Cory Fields)
fb0546b1c5 ci: don't try to install for a fuzz build (Cory Fields)

Pull request description:

  This makes it possible to build/install only the desired binaries regardless of the configuration.
  For consistency, the component names match the binary names. `Kernel` and `GUI` have been renamed.

  Additionally it fixes #31762 by installing only the manpages for the configured targets (and includes them in the component installs for each).

  Also fixes #31745.

  Alternative to #31765 which is (imo) more correct/thorough.

  Can be tested using (for ex):
  ```bash
  $ cmake -B build
  $ cmake --build build -t bitcoind -t bitcoin-cli
  $ cmake --install build --component bitcoind
  $ cmake --install build --component bitcoin-cli
  ```

ACKs for top commit:
  hebasto:
    ACK 9b033bebb1.
  TheCharlatan:
    Re-ACK 9b033bebb1
  stickies-v:
    re-ACK 9b033bebb1

Tree-SHA512: fd4818e76f190dbeafbf0c246b466f829771902c9d6d7111ed917093b811c8a5536a4a45e20708f73e7f581d6cb77c8e61cfa69e065788dcf0886792f553a355
2025-02-14 14:19:12 +01:00
Eval EXEC
99755e04ff
random: Initialize variables in hardware RNG functions 2025-02-14 19:26:29 +08:00
merge-script
7bbd761e81
Merge bitcoin/bitcoin#31421: cmake: Improve compatibility with Python version managers
dead908654 cmake: Improve compatibility with Python version managers (Hennadii Stepanov)

Pull request description:

  This PR resolves the issue [highlighted](https://github.com/bitcoin/bitcoin/pull/31411#issuecomment-2516745547) in https://github.com/bitcoin/bitcoin/pull/31411:
  > Here's another case where CMake just picks some other Python...

  The fix leverages two [hints](https://cmake.org/cmake/help/latest/module/FindPython3.html#hints) for the CMake `FindPython3` module:
  1. `Python3_FIND_FRAMEWORK` is set to `LAST`. This ensures that Unix-style package components are preferred over frameworks on macOS. As a side effect, the `FindPython3` module reports a shim or symlink (e.g., from `pyenv`) rather than the underlying framework's binary.  The module's output aligns with the result of the `which` command.
  2. `Python3_FIND_UNVERSIONED_NAMES` is set to `FIRST`. This supports scenarios where tools like `pyenv`—which use shims—have multiple Python versions installed.

  Here are examples of output on my macOS 15.1.1 (Intel) with installed Homebrew's [Python 3.13.0](https://formulae.brew.sh/formula/python@3.13):
  - without any Python version manager:
  ```
  % which -a python3
  /usr/local/bin/python3
  /usr/bin/python3
  % cmake -B build
  <snip>
  -- Found Python3: /usr/local/bin/python3 (found suitable version "3.13.0", minimum required is "3.10") found components: Interpreter
  <snip>
  ```
  - using `pyenv`:
  ```
  % pyenv versions
    system
  * 3.10.14 (set by /Users/hebasto/dev/bitcoin/.python-version)
    3.12.8
    3.13.1
  % which -a python3
  /Users/hebasto/.pyenv/shims/python3
  /usr/local/bin/python3
  /usr/bin/python3
  % cmake -B build
  <snip>
  -- Found Python3: /Users/hebasto/.pyenv/shims/python3 (found suitable version "3.10.14", minimum required is "3.10") found components: Interpreter
  <snip>
  ```

  Both variables, `Python3_FIND_FRAMEWORK` and `Python3_FIND_UNVERSIONED_NAMES`, can still be overridden by the user via the command line if needed.

ACKs for top commit:
  theuni:
    No opinion on the python selection changes themselves, but code-review ACK dead908654
  willcl-ark:
    ACK dead908654

Tree-SHA512: 69f8541223e5b6c35c892b4ba2a2dcfc24b41a10cf20accc75d3008b16434db8a9240c99c886c3a4566ba24269c5b0e0d856357891811f0a77b39f4afbee3634
2025-02-14 11:38:22 +01:00
merge-script
9491676438
Merge bitcoin/bitcoin#31157: Cleanups to port mapping module post UPnP drop
70398ae05b mapport: make ProcessPCP void (Antoine Poinsot)
9e6cba2988 mapport: remove unnecessary 'g_mapport_enabled' (Antoine Poinsot)
8fb45fcda0 mapport: remove unnecessary 'g_mapport_current' variable (Antoine Poinsot)
1b223cb19b mapport: merge DispatchMapPort into StartMapPort (Antoine Poinsot)
9bd936fa34 mapport: drop unnecessary function (Antoine Poinsot)
2a6536ceda mapport: rename 'use_pcp' to 'enable' (Antoine Poinsot)
c4e82b854c mapport: make 'enabled' and 'current' bool (Antoine Poinsot)

Pull request description:

  Followup to #31130, this does a couple cleanups to `src/mapport.*` to clarify the logic now that there is a single protocol option for port mapping.

ACKs for top commit:
  laanwj:
    Code review ACK 70398ae05b
  TheCharlatan:
    ACK 70398ae05b

Tree-SHA512: d9a3ab4fcd59a7cf4872415c40cc7ac3a98dfc5aa25e195d4df880bb588bac286c30c3471e9d9499de379a75f45dcd0a82019eba3cb9f342004ae1482d0ba075
2025-02-14 11:15:53 +01:00
merge-script
109bfe9573
Merge bitcoin/bitcoin#31857: depends: avoid an unset CMAKE_OBJDUMP
2434aeab62 depends: avoid an unset CMAKE_OBJDUMP (fanquake)

Pull request description:

  Similar to #31840, currently our Linux toolchain file contains:
  ```bash
  set(CMAKE_AR "aarch64-linux-gnu-ar")
  set(CMAKE_RANLIB "aarch64-linux-gnu-ranlib")
  set(CMAKE_STRIP "aarch64-linux-gnu-strip")
  set(CMAKE_OBJCOPY "aarch64-linux-gnu-objcopy")
  set(CMAKE_OBJDUMP "")
  ```

  `objdump` is currently only used for the macOS cross build, where it's `llvm-objdump`, but we should be consistent in producing a toolchain file that points to actual tools, rather than leaving variables unset.

ACKs for top commit:
  hebasto:
    ACK 2434aeab62.
  theuni:
    utACK 2434aeab62

Tree-SHA512: 65f6b7b9cae79e9c0784c108709139125e52d8f2818afbea5f719bc1b6dc338b870abbdfcb174ae541c0027a7ac07cb56012735b7a37b58b9a6e55a48c0257cf
2025-02-14 10:49:09 +01:00
merge-script
14d1d8e212
Merge bitcoin/bitcoin#31758: test: deduplicates p2p_tx_download constants
0a02e7fdea test: deduplicates p2p_tx_download constants (Sergi Delgado Segura)

Pull request description:

  Some of the networking constants defined in p2p_tx_download.py are more generally defined in p2p.py

ACKs for top commit:
  i-am-yuvi:
    re-ACK 0a02e7fdea
  maflcko:
    review ACK 0a02e7fdea 🔖
  danielabrozzoni:
    re-ACK 0a02e7fdea
  tdb3:
    re ACK 0a02e7fdea

Tree-SHA512: 05fc114a32b6b42a7c57563a38f1a8921e0bb224c4b124ae9d395c3a1105ae6e9cdfc62f603f4f2dee55cef5f6a6ed400d328740ad84fbd3093c5e0f3fb2982a
2025-02-14 10:47:18 +01:00
Ava Chow
2549fc6fd1
Merge bitcoin/bitcoin#31768: test: check scanning field from getwalletinfo
bb0879ddab test: check `scanning` field from `getwalletinfo` (brunoerg)

Pull request description:

  During a rescan, check that `getwalletinfo` returns properly information (the scanning field) about it.

ACKs for top commit:
  maflcko:
    lgtm ACK bb0879ddab
  arejula27:
    ACK [`bb0879d`](bb0879ddab)
  achow101:
    ACK bb0879ddab
  BrandonOdiwuor:
    Code Review ACK bb0879ddab
  Prabhat1308:
    re-ACK [`bb0879d`](bb0879ddab)

Tree-SHA512: 9bca1c1e813bf4f61a5621bdc0a5f5c2bcfb388ffe9dfacb821bf6954f6e0880140d72258dc93ab6b84efb54f55c682a17aebd42f6559d6cfac9998e6bc4e5b9
2025-02-13 16:25:01 -08:00
Cory Fields
9b033bebb1 cmake: rename Kernel component to bitcoinkernel for consistency 2025-02-13 18:25:58 +00:00
Cory Fields
2e0c92558e cmake: add and use install_binary_component
Add a separate component for each binary for fine-grained installation options.

Also install the man pages for only for the targets enabled.
2025-02-13 18:14:41 +00:00
Ryan Ofsky
a85e8c0e61 doc: Add some general documentation about negated options 2025-02-13 12:30:15 -05:00
glozow
96d30ed4f9
Merge bitcoin/bitcoin#31495: wallet: Utilize IsMine() and CanProvide() in migration to cover edge cases
af76664b12 test: Test migration of a solvable script with no privkeys (Ava Chow)
17f01b0795 test: Test migration of taproot output scripts (Ava Chow)
1eb9a2a39f test: Test migration of miniscript in legacy wallets (Ava Chow)
e8c3efc7d8 wallet migration: Determine Solvables with CanProvide (Ava Chow)
fa1b7cd6e2 migration: Skip descriptors which do not parse (Ava Chow)
440ea1ab63 legacy spkm: use IsMine() to extract watched output scripts (Ava Chow)
b777e84cd7 legacy spkm: Move CanProvide to LegacyDataSPKM (Ava Chow)
b1ab927bbf tests: Test migration of additional P2WSH scripts (Ava Chow)
c39b3cfcd1 test: Extra verification that migratewallet migrates (Ava Chow)

Pull request description:

  The legacy wallet `IsMine()` is essentially a black box that would tell us whether the wallet is watching an output script. In order to migrate legacy wallets to descriptor wallets, we need to be able to compute all of the output scripts that a legacy wallet would watch. The original approach for this was to understand `IsMine()` and write a function which would be its inverse. This was partially done in the original migration code, and attempted to be completed in #30328. However, further analysis of `IsMine()` has continued to reveal additional edge cases which make writing an inverse function increasingly difficult to verify correctness.

  This PR instead changes migration to utilize `IsMine()` to produce the output scripts by first computing a superset of all of the output scripts that `IsMine()` would watch and testing each script against `IsMine()` to filter for the ones that actually are watched. The superset is constructed by computing all possible output scripts for the keys and scripts in the wallet - for keys, every key could be a P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH; for scripts, every script could be an output script, the redeemScript of a P2SH, the witnessScript of a P2WSH, and the witnessScript of a P2SH-P2WSH.

  Additionally, the legacy wallet can contain scripts that are redeemScripts and witnessScripts, while not watching for any output script utilizing that script. These are known as solvable scripts and are migrated to a separate "solvables" wallet. The previous approach to identifying these solvables was similar to identifying output scripts - finding known solvable conditions and computing the scripts. However, this also can miss scripts, so the solvables are now identified in a manner similar to the output scripts but using the function `CanProvide()`. Using the same superset as before, all output scripts which are `ISMINE_NO` are put through `CanProvide()` which will perform a dummy signing and then a key lookup to determine whether the legacy wallet could provide any solving data for the output script. The scripts that pass will have their descriptors inferred and the script included in the solvables wallet.

  The main downside of this approach is that `IsMine()` and `CanProvide()` can no longer be deleted. They will need to be refactored to be migration only code instead in #28710.

  Lastly, I've added 2 test cases for the edge cases that prompted this change of approach. In particular, miniscript witnessScripts and `rawtr()` output scripts are  solvable and signable in a legacy wallet, although never `ISMINE_SPENDABLE`.

ACKs for top commit:
  sipa:
    Code review ACK af76664b12d8611b606a7e755a103a20542ee539; I did not review the tests in detail.
  brunoerg:
    code review ACK af76664b12
  rkrux:
    ACK af76664b12

Tree-SHA512: 7f58a90de6f38fe9801fb6c2a520627072c8d66358652ad0872ff59deb678a82664b99babcfd874288bebcb1487d099a77821f03ae063c2b4cbf2d316e77d141
2025-02-13 12:30:15 -05:00
Ryan Ofsky
490c8fa178 doc: Add release notes summarizing negated option behavior changes. 2025-02-13 12:30:15 -05:00
Ryan Ofsky
458ef0a11b refactor: Avoid using IsArgSet() on -connect list option
This commit does not change behavior, it just changes code to handle -noconnect
values explicitly with IsArgNegated() instead of implicitly with IsArgSet(),
and adds comments to make it clear what behavior is intended when -noconnect is
specified.
2025-02-13 12:30:15 -05:00
Ryan Ofsky
752ab9c3c6 test: Add test to make sure -noconnect disables -dnsseed and -listen by default
Make sure -noconnect has same effect as -connect for disabling DNS seeding and
listening by default, and warning about -dnsseed being ignored with the -proxy
setting.

Initial implementation of https://github.com/bitcoin/bitcoin/pull/30529
accidentally broke this behavior, so having coverage may be useful to make sure
it does not break again.

Co-authored-by: Hodlinator <172445034+hodlinator@users.noreply.github.com>
2025-02-13 13:30:15 -04:00
Ryan Ofsky
3c2920ec98 refactor: Avoid using IsArgSet() on -signetseednode and -signetchallenge list options
This commit does not change behavior because negation of -signetseednode and
-signetchallenge parameters has been disallowed since these were introduced in
#18267, so calling IsArgSet() is equivalent to checking if GetArgs() returns a
non-empty list.
2025-02-13 12:30:15 -05:00
Ryan Ofsky
d05668922a refactor: Avoid using IsArgSet() on -debug, -loglevel, and -vbparams list options
This commit does not change behavior, it just drops unnecessary IsArgSet()
calls for -debug, -loglevel, and -vbparams options. The calls are unnecessary
because GetArgs() already returns empty arrays if these arguments are not
specified.
2025-02-13 12:30:15 -05:00
Ryan Ofsky
3d1e8ca53a Normalize inconsistent -noexternalip behavior
Treat specifying -noexternalip the same as not specifying -externalip, instead
of causing it to soft-set the -discover default to false.

Before this change, was -noexternalip basically an undocumented synonym for
-nodiscover.

After this change, specifying -noexternalip just clears previously specifed
-externalip options, restoring default behavior as if they were not were
specified.

The previous -noexternalip behavior wasn't neccessarily bad, but it was
undocumented, redundant with the -nodiscover option, and inconsistent with
behavior of other list options.
2025-02-13 12:30:15 -05:00
Ryan Ofsky
ecd590d4c1 Normalize inconsistent -noonlynet behavior
Treat specifying -noonlynet the same as not specifying -onlynet, instead of
marking all networks unreachable.

Before this change, specifying -noonlynet cleared list of reachable networks
and did not allow connecting to any network. It was basically an undocumented
synonym for -noconnect.

After this change, specifying -nononlynet just clears previously specifed
-onlynet options and allows connecting to all networks, restoring default
behavior as if no -onlynet options were specified.

Before this change, there was no way to restore default behavior once an
-onlynet option was specified. So for example, if a config file specifed
onlynet settings, they couldn't be reset on the command line without disabling
the entire config file.

The previous -noonlynet behavior wasn't neccessarily bad, but it was
undocumented, redundant with the -noconnect option, inconsistent with behavior
of other list options, and inconsistent with being able to use the command line
to selectively override config options. It was also probably unintended,
arising from use of the IsArgSet() method and its interaction with negated
options.
2025-02-13 12:30:15 -05:00
Ryan Ofsky
5544a19f86 Fix nonsensical bitcoin-cli -norpcwallet behavior
Treat specifying -norpcwallet the same as not specifying any -rpcwallet option,
instead of treating it like -rpcwallet=0 with 0 as the wallet name.

This restores previous behavior before 743077544b
from https://github.com/bitcoin/bitcoin/pull/18594, which inadvertently changed
it.
2025-02-13 12:30:15 -05:00
Ryan Ofsky
6e8e7f433f Fix nonsensical -noasmap behavior
Instead of failing with "fread failed: iostream error" error when -noasmap is
specified, just don't load an asmap file.
2025-02-13 12:30:15 -05:00
Ryan Ofsky
b6ab350806 Fix nonsensical -notest behavior
Treat specifying -notest exactly the same as not specifying any
-test value, instead of complaining that it must be used with -regtest.
2025-02-13 12:30:15 -05:00
Ryan Ofsky
6768389917 Fix nonsensical -norpcwhitelist behavior
Treat specifying -norpcwhitelist the same as not specifying -rpcwhitelist,
instead of behaving almost the same but flipping the default
-rpcwhitelistdefault value.

This is confusing because before this change if -norpcwhitelist was specified
it would block users from calling any RPC methods.
2025-02-13 12:30:15 -05:00
Ryan Ofsky
e03409c70f Fix nonsensical -norpcbind and -norpcallowip behavior
Treat specifying -norpcbind and -norpcallowip the same as not specifying
-rpcbind or -rpcallowip, instead of failing to bind to localhost and failing to
show warnings.

Also add code comment to clarify what intent of existing code is.
2025-02-13 12:30:15 -05:00
Ryan Ofsky
40c4899bc2 Fix nonsensical -nobind and -nowhitebind behavior
Treat specifying -nobind and -nowhitebind the same as not specifying -bind and
-whitebind values instead of causing them to soft-set -listen=1.
2025-02-13 12:30:15 -05:00
Ryan Ofsky
5453e66fd9 Fix nonsensical -noseednode behavior
Treat specifying -noseednode the same as not specifying any -seednode value,
instead of enabling the seed node timeout and log messages, and waiting longer
to add other seeds.
2025-02-13 12:30:15 -05:00
merge-script
c242fa5be3
Merge bitcoin/bitcoin#31858: chore: remove redundant word
4c62b37fcd chore: remove redundant word (tianzedavid)

Pull request description:

  Remove redundant word

  For https://github.com/bitcoin/bitcoin/pull/31855#issuecomment-2656392782

ACKs for top commit:
  maflcko:
    lgtm ACK 4c62b37fcd
  delta1:
    ACK 4c62b37fcd

Tree-SHA512: b6af8aa158be37977d7016435aafb07542e38db863111b86369cba29bab25c9dd0075892dbe559d4d72c6aa33fcb08a7881a41d1a124d0bfc2c18aea696a0b57
2025-02-13 15:33:43 +01:00
tianzedavid
4c62b37fcd chore: remove redundant word
Signed-off-by: tianzedavid <cuitianze@aliyun.com>
2025-02-13 22:09:55 +08:00
Ryan Ofsky
251ea7367c
Merge bitcoin/bitcoin#31767: logging: Ensure -debug=0/none behaves consistently with -nodebug
7afeaa2469 test: `-debug=0` and `-debug=none` behave similarly to `-nodebug` (Daniela Brozzoni)
a8fedb36a7 logging: Ensure -debug=0/none behaves consistently with -nodebug (Daniela Brozzoni)
d39d521d86 test: `-nodebug` clears previously set debug options (Daniela Brozzoni)

Pull request description:

  Previously, -nodebug cleared all prior -debug configurations in the command line while allowing subsequent debug options to be applied.
  However, -debug=0 and -debug=none completely disabled debugging, even for categories specified afterward.

  This commit ensures consistency by making -debug=0 and -debug=none behave like -nodebug: they now clear previously set debug configurations but do not disable debugging for categories specified later.

  See https://github.com/bitcoin/bitcoin/pull/30529#discussion_r1930956563

ACKs for top commit:
  hodlinator:
    re-ACK 7afeaa2469
  ryanofsky:
    Code review ACK 7afeaa2469. Nicely implemented change with test and release notes, and I like how the test is implemented as the first commit.
  maflcko:
    review ACK 7afeaa2469 👡

Tree-SHA512: c69b17ff10da6c88636bd01918366dd408832e70f2d0a7b951e9619089e89c39282db70398ba2542d3aa69a2fe6b6a0a01638b3225aff79d234d84d3067f2caa
2025-02-13 08:40:12 -05:00
fanquake
2434aeab62
depends: avoid an unset CMAKE_OBJDUMP
Similar to #31840, currently our Linux toolchain file contains:
```bash
set(CMAKE_AR "aarch64-linux-gnu-ar")
set(CMAKE_RANLIB "aarch64-linux-gnu-ranlib")
set(CMAKE_STRIP "aarch64-linux-gnu-strip")
set(CMAKE_OBJCOPY "aarch64-linux-gnu-objcopy")
set(CMAKE_OBJDUMP "")
```

`objdump` is currently only used for the macOS cross build, where it's
`llvm-objdump`, but we should be consistent in producing a toolchain
file that points to actual tools, rather than leaving variables unset.
2025-02-13 13:02:53 +01:00
merge-script
a5b0a441f8
Merge bitcoin/bitcoin#31855: chore: remove redundant word
033acdf03d chore: remove redundant word (tianzedavid)

Pull request description:

  Remove redundant word
  For https://github.com/ElementsProject/elements/pull/1407

ACKs for top commit:
  maflcko:
    lgtm ACK 033acdf03d
  delta1:
    ACK 033acdf03d

Tree-SHA512: ec9c9951c0153fa598d7733cfba287217c4a3389090a6d106d9144ac9cb1c13cf854f660fe187dad992b6ae1b252c01f1764af5bba5bdf8703b978d04cdb190f
2025-02-13 13:01:47 +01:00
Vasil Dimov
cd4bfaee10
net: reduce CAddress usage to CService or CNetAddr
* `CConnman::CalculateKeyedNetGroup()` needs `CNetAddr`, not `CAddress`,
  thus change its argument.

* Both callers of `CConnman::CreateNodeFromAcceptedSocket()` create a
  dummy `CAddress` from `CService`, so use `CService` instead.

* `GetBindAddress()` only needs to return `CService`.

* `CNode::addrBind` only needs to be `CService`.
2025-02-13 12:38:55 +01:00
tianzedavid
033acdf03d chore: remove redundant word
Signed-off-by: tianzedavid <cuitianze@aliyun.com>
2025-02-13 18:55:31 +08:00
merge-script
55cf39e4c5
Merge bitcoin/bitcoin#31722: cmake: Copy cov_tool_wrapper.sh.in to the build tree
e3c0152769 cmake: Copy `cov_tool_wrapper.sh.in` to the build tree (Hennadii Stepanov)

Pull request description:

  This PR ensures that `cov_tool_wrapper.sh.in` is available when invoking the `Coverage.cmake` script from any directory.

  Here is an example of usage on Ubuntu 24.10 with the default GCC 14.2.0:
  ```
  $ cmake -B build -DCMAKE_BUILD_TYPE=Coverage -DCMAKE_CXX_FLAGS="-fprofile-update=atomic" -DCMAKE_C_FLAGS="-fprofile-update=atomic"
  $ cmake --build build -j $(nproc)
  $ cd ..
  $ cmake -DJOBS=$(nproc) -DLCOV_OPTS="--ignore-errors inconsistent,inconsistent" -P bitcoin/build/Coverage.cmake
  ```

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

ACKs for top commit:
  theuni:
    utACK e3c0152769

Tree-SHA512: ccfc8e893567f199d9b05ea3916cac06fca89c5892cc7492d5251c331c35408222fd918ed08017515e2dfca10970ae3f633b3917bfb7037db539559e71d7f711
2025-02-13 10:34:28 +01:00
David Gumberg
c3fa043ae5 doc: build: Fix instructions for msvc gui builds
If the instructions are followed as-is, and "Developer
(PowerShell|Command Prompt) for VS 2022" is used to execute the
suggested build commands, the root directory of vcpkg (e.g. in VS 2022
Community edition: `C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\vcpkg`), is too long, and when vcpkg attempts
to build any of the QT packages, it will fail because of build steps
that require path lengths greater than Windows' `MAX_PATH` 260 character
limit. This can be avoided without needing to move the vcpkg root dir by
setting `--x-buildtrees-root` to a short path, like `C:\vcpkg`.
2025-02-12 12:53:59 -08:00
merge-script
048ef98626
Merge bitcoin/bitcoin#31840: depends: add missing Darwin objcopy
3edaf0b428 depends: add missing Darwin objcopy (fanquake)

Pull request description:

  Our CMake toolchain for a Darwin cross build currently contains:
  ```bash
  set(CMAKE_AR "/usr/bin/llvm-ar")
  set(CMAKE_RANLIB "/usr/bin/llvm-ranlib")
  set(CMAKE_STRIP "/usr/bin/llvm-strip")
  set(CMAKE_OBJCOPY "arm64-apple-darwin-objcopy")
  set(CMAKE_OBJDUMP "/usr/bin/llvm-objdump")
  ```

  `objcopy` isn't currently used for the Darwin build (only for Linux and splitting the debug symbols), but we shouldn't be producing a toolchain file that refers to nonexistent tools.

ACKs for top commit:
  laanwj:
    Code review ACK 3edaf0b428
  theuni:
    utACK 3edaf0b428

Tree-SHA512: b74deb9f3f053c37d03505e698419d4a14131131f12a042dab698a81f2ad76b71fd55c1d1afd5f5822cc50fdaad5acdab15a8b20626c56f705179add1165449f
2025-02-12 18:50:58 +01:00
merge-script
713bf66b1f
Merge bitcoin/bitcoin#31500: depends: Fix compiling libevent package on NetBSD
f89f16846e depends: Fix compiling `libevent` package on NetBSD (Hennadii Stepanov)

Pull request description:

  Libevent [introduced](https://github.com/libevent/libevent/pull/909) the [`typeof`](https://gcc.gnu.org/onlinedocs/gcc/Typeof.html) C language extension in the NetBSD-specific code, which was pulled into our depends in https://github.com/bitcoin/bitcoin/pull/21991.

  However, GCC [states](https://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html):
  > the various `-std` options disable certain keywords.

  Due to our use of b042c4f053/depends/hosts/netbsd.mk (L1)

  the `typeof` keyword is disabled, resulting in a compilation error:
  ```
  $ gmake -C depends libevent CC=/usr/pkg/gcc14/bin/gcc CXX=/usr/pkg/gcc14/bin/g++
  <snip>
  [ 37%] Building C object CMakeFiles/event_core_static.dir/kqueue.c.o
  /home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c: In function 'kq_setup_kevent':
  /home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:56:27: error: implicit declaration of function 'typeof' [-Wimplicit-function-declaration]
     56 | #define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
        |                           ^~~~~~
  /home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:190:30: note: in expansion of macro 'INT_TO_UDATA'
    190 |                 out->udata = INT_TO_UDATA(ADD_UDATA);
        |                              ^~~~~~~~~~~~
  /home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:56:64: error: expected expression before 'intptr_t'
     56 | #define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
        |                                                                ^~~~~~~~
  /home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:190:30: note: in expansion of macro 'INT_TO_UDATA'
    190 |                 out->udata = INT_TO_UDATA(ADD_UDATA);
        |                              ^~~~~~~~~~~~
  /home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:56:27: error: called object is not a function or function pointer
     56 | #define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
        |                          ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:190:30: note: in expansion of macro 'INT_TO_UDATA'
    190 |                 out->udata = INT_TO_UDATA(ADD_UDATA);
        |                              ^~~~~~~~~~~~
  gmake[3]: *** [CMakeFiles/event_core_static.dir/build.make:328: CMakeFiles/event_core_static.dir/kqueue.c.o] Error 1
  <snip>
  ```

  This PR resolves this issue by following GCC's [recommendation](https://gcc.gnu.org/onlinedocs/gcc/Typeof.html):
  > write `__typeof__` instead of `typeof`.

ACKs for top commit:
  fanquake:
    ACK f89f16846e

Tree-SHA512: c0d2e535408db120535781f8518c616b0f5a39b1c6babb2a74e8e0565348aaf00b0f5a93cac0af7cf6d6bf028d5d58763fe71b3969ed9c7059fa7c3dca9d084c
2025-02-12 16:38:24 +01:00