From a73b2bd0f035a0355387cdf436cea0b06ce17c31 Mon Sep 17 00:00:00 2001 From: TheCharlatan Date: Thu, 14 Nov 2024 11:44:15 +0100 Subject: [PATCH] Squashed 'libbitcoinkernel-sys/bitcoin/' changes from 1047757ea3b..48158303fe2 48158303fe2 kernel: Add pure kernel bitcoin-chainstate bf80d2f5009 kernel: Add block index utility functions to C header a6ab5345e3b kernel: Add function to read block undo data from disk to C header 845b824d6c7 kernel: Add functions to read block from disk to C header 9324c8c4f67 kernel: Add function for copying block data to C header 368fc93fd80 kernel: Add functions for the block validation state to C header eb6e25ac007 kernel: Add validation interface to C header cdce4484005 kernel: Add interrupt function to C header 7e47ec78768 kernel: Add import blocks function to C header 2b803d50747 kernel: Add chainstate load options for in-memory dbs in C header ea92eb13c4a kernel: Add options for reindexing in C header 8254f2035a7 kernel: Add block validation to C header ad7b880346e Kernel: Add chainstate loading to kernel C header 583820c4487 kernel: Add chainstate manager object to C header ec137a086a0 kernel: Add notifications context option to C header 62a89689266 kerenl: Add chain params context option to C header bb482dcbd30 kernel: Add kernel library context object d114ccfdf8a kernel: Add logging to kernel library C header 44c65c46c43 kernel: Introduce initial kernel C header API 69c03134440 Merge bitcoin/bitcoin#31269: validation: Remove RECENT_CONSENSUS_CHANGE validation result 42282592943 Merge bitcoin/bitcoin#31000: bench: add support for custom data directory 36f5effa178 Merge bitcoin/bitcoin#31235: addrman: cap the `max_pct` to not exceed the maximum number of addresses 98ad249b69f Merge bitcoin/bitcoin#31277: doc: mention `descriptorprocesspsbt` in psbt.md b0222bbb494 Merge bitcoin/bitcoin#30239: Ephemeral Dust 1dda1892b6b Merge bitcoin/bitcoin#31037: test: enhance p2p_orphan_handling 5c2e291060c bench: Add basic CheckEphemeralSpends benchmark 3f6559fa581 Add release note for ephemeral dust 71a6ab4b33d test: unit test for CheckEphemeralSpends 21d28b2f362 fuzz: add ephemeral_package_eval harness 127719f516a test: Add CheckMempoolEphemeralInvariants e2e30e89ba4 functional test: Add ephemeral dust tests 4e68f901390 rpc: disallow in-mempool prioritisation of dusty tx e1d3e81ab4d policy: Allow dust in transactions, spent in-mempool 04b2714fbbc functional test: Add new -dustrelayfee=0 test case ebb6cd82baf doc: mention `descriptorprocesspsbt` in psbt.md 2b33322169b Merge bitcoin/bitcoin#31249: test: Add combinerawtransaction test to rpc_createmultisig 3fb6229dcfd Merge bitcoin/bitcoin#31271: doc: correct typos fa66e0887ca bench: add support for custom data directory ad9c2cceda9 test, bench: specialize working directory name 9c5775c331e addrman: cap the `max_pct` to not exceed the maximum number of addresses 8d340be9247 Merge bitcoin/bitcoin#31181: cmake: Revamp `FindLibevent` module 9a8e5adb161 Merge bitcoin/bitcoin#31267: refactor: Drop deprecated space in operator""_mst 726cbee9553 doc: correct typos 9fdfb73ca84 doc: fix typos af6088701a2 Merge bitcoin/bitcoin#31237: doc: Add missing 'blank=true' option in offline-signing-tutorial.md 7a526653022 Merge bitcoin/bitcoin#31239: test: clarify log messages when handling SOCKS5 proxy connections 900b17239fb Merge bitcoin/bitcoin#31259: doc: Fix missing comma in JSON example in REST-interface.md faf21625652 refactor: Drop deprecated space in operator""_mst c889890e4a3 Merge bitcoin/bitcoin#31264: doc: Fixup bitcoin-wallet manpage chain selection args 0f6d20e43f2 Merge bitcoin/bitcoin#31163: scripted-diff: get rid of remaining "command" terminology in protocol.{h,cpp} 5acd5e7f874 Merge bitcoin/bitcoin#31257: ci: make ctest stop on failure 19f277711eb Merge bitcoin/bitcoin#26593: tracing: Only prepare tracepoint arguments when actually tracing e80e4c6ff91 validation: Remove RECENT_CONSENSUS_CHANGE validation result fa729ab4a27 doc: Fixup bitcoin-wallet manpage chain selection args 5e3b444022c doc: Fix missing comma in JSON example in REST-interface.md 0903ce8dbc2 Merge bitcoin/bitcoin#30592: Remove mempoolfullrbf f842d0801e1 Merge bitcoin/bitcoin#29686: Update manpage descriptions 36a22e56833 ci: make ctest stop on failure 83fab3212c9 test: Add combinerawtransaction test to rpc_createmultisig 018e5fcc462 Merge bitcoin/bitcoin#31190: TxDownloadManager followups 3a5f6027e16 Merge bitcoin/bitcoin#31171: depends: Specify CMake generator explicitly 99d9a093cf6 test: clarify log messages when handling SOCKS5 proxy connections c9e67e214f0 Merge bitcoin/bitcoin#31238: fuzz: Limit wallet_notifications iterations 564238aabf1 Merge bitcoin/bitcoin#31164: net: Use actual memory size in receive buffer accounting fa461d7a43a fuzz: Limit wallet_notifications iterations ec375de39ff doc: Add missing 'blank=true' option in offline-signing-tutorial.md 5a96767e3f5 depends, libevent: Do not install *.pc files and remove patches for them ffda355b5a2 cmake, refactor: Move `HAVE_EVHTTP_...` to `libevent` interface b619bdc3303 cmake: Revamp `FindLibevent` module 2c90f8e08c4 Merge bitcoin/bitcoin#31232: ci: `add second_deadlock_stack=1` to TSAN options 5dc94d13d41 fuzz fix: assert MAX_PEER_TX_ANNOUNCEMENTS is not exceeded 45e2f8f87d8 Merge bitcoin/bitcoin#31173: cmake: Add `FindQRencode` module and enable `libqrencode` package for MSVC 80cb630bd94 Merge bitcoin/bitcoin#31216: Update secp256k1 subtree to v0.6.0 5161c2618cd ci: add second_deadlock_stack=1 to TSAN options 85224f92d52 Merge bitcoin/bitcoin#30811: build: Unify `-logsourcelocations` format 9719d373dc2 Merge bitcoin/bitcoin#30634: ci: Use clang-19 from apt.llvm.org 97235c446e9 build: Disable secp256k1 musig module 9e5089dbb02 build, msvc: Enable `libqrencode` vcpkg package 30089b0cb61 cmake: Add `FindQRencode` module 65b19419366 Merge bitcoin/bitcoin#31186: msvc: Update vcpkg manifest d3388720837 Merge bitcoin/bitcoin#31206: doc: Use relative hyperlinks in release-process.md ffc05fca6f7 Merge bitcoin/bitcoin#31220: doc: Fix word order in developer-notes.md 9f2c8287a24 Merge bitcoin/bitcoin#31192: depends, doc: List packages required to build `qt` package separately 03cff2c1421 Merge bitcoin/bitcoin#31191: build: Make G_FUZZING constexpr, require -DBUILD_FOR_FUZZING=ON to fuzz 44939e5de1b doc: Fix word order in developer-notes.md b934954ad10 Merge bitcoin/bitcoin#30670: doc: Extend developer-notes with file-name-only debugging fix 05aebe3790f Merge bitcoin/bitcoin#30930: netinfo: add peer services column and outbound-only option 0ba680d41b4 Update secp256k1 subtree to v0.6.0 2d46a89386d Squashed 'src/secp256k1/' changes from 2f2ccc46954..0cdc758a563 d22a234ed27 net: Use actual memory size in receive buffer accounting 047b5e2af1f streams: add DataStream::GetMemoryUsage c3a6722f34a net: Use DynamicUsage(m_type) in CSerializedNetMsg::GetMemoryUsage c6594c0b142 memusage: Add DynamicUsage for std::string 7596282a556 memusage: Allow counting usage of vectors with different allocators 6463117a292 Merge bitcoin/bitcoin#31208: doc: archive release notes for v27.2 788c1324f3d build: Unify `-logsourcelocations` format 4747f030956 depends, doc: List packages required to build `qt` package separately 1a05c86ae47 doc: archive release notes for v27.2 9f71cff6ab3 doc: Use relative hyperlinks in release-process.md f1bcf3edc50 Merge bitcoin/bitcoin#31139: test: added test to assert TX decode rpc error on submitpackage rpc 975b115e1a2 Merge bitcoin/bitcoin#31198: init: warn, don't error, when '-upnp' is set 4a0251c05dd Merge bitcoin/bitcoin#31187: ci: Do not error on unused-member-function in test each commit e001dc3dc6e Merge bitcoin/bitcoin#31203: fuzz: fix `implicit-integer-sign-change` in wallet_create_transaction 5a26cf7773e fuzz: fix `implicit-integer-sign-change` in wallet_create_transaction a1b3ccae4be init: warn, don't error, when '-upnp' is set c189eec848e doc: release note for mempoolrullrbf removal d47297c6aab rpc: Mark fullrbf and bip125-replaceable as deprecated 04a5dcee8ab docs: remove requirement to signal bip125 fafbf8acf41 Make G_FUZZING constexpr, require -DBUILD_FOR_FUZZING=ON to execute a fuzz target fae3cf0ffa6 ci: Temporarily disable macOS/Windows fuzz step f6577b71741 build, msvc: Update vcpkg manifest baseline 16e16013bfa build, msvc: Document `libevent` version pinning ec47cd2b508 build, msvc: Drop no longer needed `liblzma` version pinning 9a0734df5f1 build, msvc: Reorder keys in `vcpkg.json` 8351562bec6 [fuzz] allow negative time jumps in txdownloadman_impl 917ab810d93 [doc] comment fixups from n30110 f07a533dfcb Merge bitcoin/bitcoin#24214: Fix unsigned integer overflows in interpreter 62516105536 Merge bitcoin/bitcoin#31015: build: have "make test" depend on "make all" 4a31f8ccc9d Merge bitcoin/bitcoin#31156: test: Don't enforce BIP94 on regtest unless specified by arg 02be3dced71 Merge bitcoin/bitcoin#31166: key: clear out secret data in `DecodeExtKey` 54d07dd37d5 ci: Do not error on unused-member-function in test each commit 47f50c7af55 doc: add bitcoin-qt man description 40b82e3ab0a doc: add bitcoin-util man description a7bf80f3a2d doc: add bitcoin-tx man description 3f9a5168323 doc: add bitcoin-wallet man description d8c0bb23ef8 doc: add bitcoin-cli man description 09abccfa772 doc: add bitcoind man description 97b790e844a Merge bitcoin/bitcoin#29420: test: extend the SOCKS5 Python proxy to actually connect to a destination 6b73eb9a1a2 Merge bitcoin/bitcoin#31064: init: Correct coins db cache size setting 27d12cf17f2 Merge bitcoin/bitcoin#31043: rpc: getorphantxs follow-up 7b66815b16b Merge bitcoin/bitcoin#30110: refactor: TxDownloadManager + fuzzing dc97e7f6dba Merge bitcoin/bitcoin#30903: cmake: Add `FindZeroMQ` module 1b0b9b4c787 Extend possible debugging fixes with file-name-only da10e0bab4a Merge bitcoin/bitcoin#30942: test: Remove dead code from interface_zmq test 111a23d9b36 Remove -mempoolfullrbf option e96ffa98b04 Merge bitcoin/bitcoin#31142: test: fix intermittent failure in p2p_seednode.py, don't connect to random IPs 54c4b09f083 Merge bitcoin/bitcoin#31042: build: Rename `PACKAGE_*` variables to `CLIENT_*` e60cecc8115 doc: add release note for 31156 fc7dfb3df5b test: Don't enforce BIP94 on regtest unless specified by arg fabe90c8242 ci: Use clang-19 from apt.llvm.org 0de3e96e333 tracing: use bitcoind pid in bcc tracing examples 411c6cfc6c2 tracing: only prepare tracepoint args if attached d524c1ec066 tracing: dedup TRACE macros & rename to TRACEPOINT 70713303b63 scripted-diff: Rename `PACKAGE_*` variables to `CLIENT_*` 332655cb52c build: Rename `PACKAGE_*` variables to `CLIENT_*` e6e29e3c94c scripted-diff: Clarify "user agent" variable name e2ba8236715 depends: Specify CMake generator explicitly 1c7ca6e64de Merge bitcoin/bitcoin#31093: Introduce `g_fuzzing` global for fuzzing checks 6e21dedbf2b Merge bitcoin/bitcoin#31130: Drop miniupnp dependency d7fd766feb2 test: added test to assert TX decode rpc error on submitpackage rpc 559a8dd9c0a key: clear out secret data in `DecodeExtKey` 4120c7543ee scripted-diff: get rid of remaining "command" terminology in protocol.{h,cpp} 2a52718d734 Merge bitcoin/bitcoin#31152: functional test: Additional package evaluation coverage 9de9c858d5a test: enhance p2p_orphan_handling 33af14b62e4 test: reduce assert_debug_log reliance 0ea84bc362f test: explicitly check boolean verbosity is disallowed 7a2e6b68cd9 doc: add rpc guidance for boolean verbosity avoidance 698f302df8b rpc: disallow boolean verbosity in getorphantxs 63f5e6ec795 test: add entry and expiration time checks 808a708107e rpc: add entry time to getorphantxs 56bf3027144 refactor: rename rpc_getorphantxs to rpc_orphans 7824f6b0770 test: check that getorphantxs is hidden ac68fcca701 rpc: disallow undefined verbosity in getorphantxs 25dacae9c7f Merge bitcoin/bitcoin#31040: test: Assert that when we add the max orphan amount that we cannot add anymore and that a random orphan gets dropped 40e5f26a3ff mapport: remove dead code in DispatchMapPort 38fdf7c1fb1 mapport: drop outdated comments 915640e191b depends: zeromq: don't install .pc files and remove patches for them 6b8a74463b5 cmake: Add `FindZeroMQ` module 9a7206a34e3 Merge bitcoin/bitcoin#29536: fuzz: fuzz connman with non-empty addrman + ASMap d4abaf8c9d9 Merge bitcoin/bitcoin#29608: optimization: Preallocate addresses in GetAddr based on nNodes b7b24352906 doc: add release note for #31130 1b6dec98da3 depends: drop miniupnpc 953533d0214 doc: remove mentions of UPnP 94ad614482f ci: remove UPnP options f32c34d0c3d functional test: Additional package evaluation coverage 87532fe5585 netinfo: allow setting an outbound-only peer list 9f243cd7fa6 Introduce `g_fuzzing` global for fuzzing checks b95adf057a4 Merge bitcoin/bitcoin#31150: util: Treat Assume as Assert when evaluating at compile-time 8f24e492e20 Merge bitcoin/bitcoin#29991: depends: sqlite 3.46.1 2ef5004f78c Merge bitcoin/bitcoin#31146: ci: Temporary workaround for old CCACHE_DIR cirrus env 8c12fe828de Merge bitcoin/bitcoin#29936: fuzz: wallet: add target for `CreateTransaction` 5c299ecafe6 test: Assert that when we add the max orphan amount that we cannot add anymore and that a random orphan gets dropped 0f4bc635854 [fuzz] txdownloadman and txdownload_impl 699643f23a1 [unit test] MempoolRejectedTx fa584cbe727 [p2p] add TxDownloadOptions bool to make TxRequestTracker deterministic f803c8ce8dd [p2p] filter 1p1c for child txid in recent rejects 5269d57e6d7 [p2p] don't process orphan if in recent rejects 2266eba43a9 [p2p] don't find 1p1cs for reconsiderable txns that are AlreadyHaveTx fa7027d0fc1 [refactor] add CheckIsEmpty and GetOrphanTransactions, remove access to TxDownloadMan internals 969b07237b9 [refactor] wrap {Have,Get}TxToReconsider in txdownload f150fb94e7d [refactor] make AlreadyHaveTx and Find1P1CPackage private to TxDownloadImpl 1e08195135b [refactor] move new tx logic to txdownload 257568eab5b [refactor] move invalid package processing to TxDownload c4ce0c1218d [refactor] move invalid tx processing to TxDownload c6b21749ca0 [refactor] move valid tx processing to TxDownload a8cf3b6e845 [refactor] move Find1P1CPackage to txdownload f497414ce76 [refactor] put peerman tasks at the end of ProcessInvalidTx 6797bc42a76 [p2p] restrict RecursiveDynamicUsage of orphans added to vExtraTxnForCompact 798cc8f5aac [refactor] move Find1P1CPackage into ProcessInvalidTx 416fbc952b2 [refactor] move new orphan handling to ProcessInvalidTx c8e67b9169b [refactor] move ProcessInvalidTx and ProcessValidTx definitions down 3a41926d1b5 [refactor] move notfound processing to txdownload 042a97ce7fc [refactor] move tx inv/getdata handling to txdownload 58e09f244b4 [p2p] don't log tx invs when in IBD 288865338f5 [refactor] rename maybe_add_extra_compact_tx to first_time_failure f48d36cd97e [refactor] move peer (dis)connection logic to TxDownload f61d9e4b4b8 [refactor] move AlreadyHaveTx to TxDownload 84e4ef843db [txdownload] add read-only reference to mempool af918349de5 [refactor] move ValidationInterface functions to TxDownloadManager f6c860efb12 [doc] fix typo in m_lazy_recent_confirmed_transactions doc 5f9004e1550 [refactor] add TxDownloadManager wrapping TxOrphanage, TxRequestTracker, and bloom filters 947f2925d55 Merge bitcoin/bitcoin#31124: util: Remove RandAddSeedPerfmon 7640cfdd624 Merge bitcoin/bitcoin#31118: doc: replace `-?` with `-h` and `-help` 74fb19317ae Merge bitcoin/bitcoin#30849: refactor: migrate `bool GetCoin` to return `optional` c16e909b3e2 Merge bitcoin/bitcoin#28574: wallet: optimize migration process, batch db transactions a9598e5eaab build: drop miniupnpc dependency a5fcfb7385c interfaces: remove now unused 'use_upnp' arg from 'mapPort' 038bbe7b200 daemon: remove UPnP support 844770b05eb qt: remove UPnP settings dd92911732d Merge bitcoin/bitcoin#31148: ci: display logs of failed unit tests automatically fa69a5f4b76 util: Treat Assume as Assert when evaluating at compile-time 0c79c343a9f Merge bitcoin/bitcoin#31147: cmake, qt, test: Remove problematic code 8523d8c0fc8 ci: display logs of failed tests automatically 2f40e453ccd Merge bitcoin/bitcoin#29450: build: replace custom `MAC_OSX` macro with existing `__APPLE__` cb7c5ca824e Add gdb and lldb links to debugging troubleshooting 6c6b2442eda build: Replace MAC_OSX macro with existing __APPLE__ fb46d57d4e7 cmake, qt, test: Remove problematic code fa9747a8961 ci: Temporary workaround for old CCACHE_DIR cirrus env 6c9fe7b73ea test: Prevent connection attempts to random IPs in p2p_seednodes.py bb97b1ffa9f test: fix intermittent timeout in p2p_seednodes.py 57529ac4dbb test: set P2PConnection.p2p_connected_to_node in peer_connect_helper() 22cd0e888c7 test: support WTX INVs from P2PDataStore and fix a comment ebe42c00aa4 test: extend the SOCKS5 Python proxy to actually connect to a destination 9bb92c0e7ff util: Remove RandAddSeedPerfmon c98fc36d094 wallet: migration, consolidate external wallets db writes 7c9076a2d2e wallet: migration, consolidate main wallet db writes 9ef20e86d7f wallet: provide WalletBatch to 'SetupDescriptorScriptPubKeyMans' 34bf0795fc0 wallet: refactor ApplyMigrationData to return util::Result aacaaaa0d3a wallet: provide WalletBatch to 'RemoveTxs' 57249ff6697 wallet: introduce active db txn listeners 91e065ec175 wallet: remove post-migration signals connection 055c0532fc8 wallet: provide WalletBatch to 'DeleteRecords' 122d103ca22 wallet: introduce 'SetWalletFlagWithDB' 6052c7891dc wallet: decouple default descriptors creation from external signer setup f2541d09e13 wallet: batch MigrateToDescriptor() db transactions 66c9936455f bench: add coverage for wallet migration process 33a28e252a7 Change default help arg to `-help` and mention `-h` and `-?` as alternatives f0130ab1a1e doc: replace `-?` with `-h` for bench_bitcoin help 681ebcceca7 netinfo: rename and hoist max level constant to use in top-level help e7d307ce8cf netinfo: clarify relaytxes and addr_relay_enabled help docs eef2a9d4062 netinfo: add peer services column 3a4a788ee0d init: Correct coins db cache size setting 2957ca96119 build: have "make test" depend on "make all" bbbbaa0d9ac Fix unsigned integer overflows in interpreter c4dc81f9c69 test: Remove dead code from interface_zmq c495731a316 fuzz: wallet: add target for `CreateTransaction` 3db68e29ec6 wallet: move `ImportDescriptors`/`FuzzedWallet` to util 552cae243a1 fuzz: cover `ASMapHealthCheck` in connman target 33b0f3ae966 fuzz: use `ConsumeNetGroupManager` in connman target 18c8a0945bd fuzz: move `ConsumeNetGroupManager` to util fe624631aeb fuzz: fuzz `connman` with a non-empty addrman 0a12cff2a8e fuzz: move `AddrManDeterministic` to util 4feaa287284 refactor: Rely on returned value of GetCoin instead of parameter 46dfbf169b4 refactor: Return optional of Coin in GetCoin e31bfb26c21 refactor: Remove unrealistic simulation state ba621ffb9cb test: improve debug log message from P2PConnection::connection_made() def6dd0c597 depends: sqlite 3.46.1 66082ca3488 Preallocate addresses in GetAddr based on nNodes REVERT: 1047757ea3b kernel: Add pure kernel bitcoin-chainstate REVERT: c568fdf75fd kernel: Add block index utility functions to C header REVERT: 0f1da1dcba5 kernel: Add function to read block undo data from disk to C header REVERT: 45af559c9f6 kernel: Add functions to read block from disk to C header REVERT: 2a7f8a8240c kernel: Add function for copying block data to C header REVERT: b19f5336c03 kernel: Add functions for the block validation state to C header REVERT: 9c0ffa913f4 kernel: Add validation interface to C header REVERT: a93318c6152 kernel: Add interrupt function to C header REVERT: 51053f33720 kernel: Add import blocks function to C header REVERT: 6b0ada2af42 kernel: Add chainstate load options for in-memory dbs in C header REVERT: 34427bfa9c7 kernel: Add options for reindexing in C header REVERT: ca57311c969 kernel: Add block validation to C header REVERT: 44156d84838 Kernel: Add chainstate loading to kernel C header REVERT: 2cee46cdcc1 kernel: Add chainstate manager object to C header REVERT: 7102c7ae45e kernel: Add notifications context option to C header REVERT: ed628a2a3c4 kerenl: Add chain params context option to C header REVERT: 27643297ff7 kernel: Add kernel library context object REVERT: 2ba22cf3f90 kernel: Add logging to kernel library C header REVERT: 873874c03e9 kernel: Introduce initial kernel C header API git-subtree-dir: libbitcoinkernel-sys/bitcoin git-subtree-split: 48158303fe276cb2f8fbc53ff31a4162d8f55c84 --- .github/workflows/ci.yml | 24 +- CMakeLists.txt | 47 +- CMakePresets.json | 7 +- ci/test/00_setup_env_mac_native.sh | 3 +- ci/test/00_setup_env_native_asan.sh | 7 +- ci/test/00_setup_env_native_fuzz.sh | 9 +- .../00_setup_env_native_previous_releases.sh | 2 +- ci/test/00_setup_env_native_tidy.sh | 4 +- ci/test/00_setup_env_native_tsan.sh | 5 +- ci/test/00_setup_env_native_valgrind.sh | 4 +- ci/test/01_base_install.sh | 11 + ci/test/02_run_container.sh | 5 + ci/test/03_test_script.sh | 4 +- cmake/bitcoin-build-config.h.in | 13 +- cmake/ccache.cmake | 8 - cmake/module/FindLibevent.cmake | 60 +- cmake/module/FindMiniUPnPc.cmake | 84 -- cmake/module/FindQRencode.cmake | 71 + cmake/module/FindUSDT.cmake | 7 +- cmake/module/FindZeroMQ.cmake | 41 + cmake/module/GenerateSetupNsi.cmake | 4 +- cmake/module/Maintenance.cmake | 4 +- contrib/guix/libexec/build.sh | 1 - contrib/tracing/README.md | 8 +- contrib/tracing/log_raw_p2p_msgs.py | 13 +- contrib/tracing/log_utxocache_flush.py | 13 +- contrib/tracing/mempool_monitor.py | 11 +- contrib/tracing/p2p_monitor.py | 22 +- depends/Makefile | 6 +- depends/README.md | 11 +- depends/funcs.mk | 3 +- depends/packages/libevent.mk | 9 +- depends/packages/miniupnpc.mk | 36 - depends/packages/packages.mk | 2 - depends/packages/sqlite.mk | 6 +- depends/packages/zeromq.mk | 11 +- depends/patches/libevent/cmake_fixups.patch | 22 - depends/patches/libevent/fix_mingw_link.patch | 25 - .../miniupnpc/cmake_get_src_addr.patch | 22 - .../patches/miniupnpc/dont_leak_info.patch | 32 - .../miniupnpc/fix_windows_snprintf.patch | 25 - depends/patches/zeromq/fix_mingw_link.patch | 31 - .../patches/zeromq/remove_libstd_link.patch | 25 - depends/toolchain.cmake.in | 7 - doc/Doxyfile.in | 2 +- doc/REST-interface.md | 2 +- doc/benchmarking.md | 2 +- doc/bips.md | 1 - doc/build-freebsd.md | 2 +- doc/build-openbsd.md | 2 +- doc/build-osx.md | 13 - doc/build-unix.md | 12 +- doc/build-windows-msvc.md | 4 +- doc/dependencies.md | 5 - doc/developer-notes.md | 16 +- doc/offline-signing-tutorial.md | 3 +- doc/policy/mempool-replacements.md | 9 +- doc/policy/packages.md | 2 - doc/psbt.md | 4 + doc/release-notes-30239.md | 12 + doc/release-notes-30592.md | 7 + doc/release-notes-31130.md | 10 + doc/release-notes-31156.md | 4 + doc/release-notes/release-notes-27.2.md | 92 ++ doc/release-process.md | 6 +- doc/tor.md | 2 +- doc/tracing.md | 94 +- libbitcoinkernel.pc.in | 4 +- share/setup.nsi.in | 40 +- src/CMakeLists.txt | 12 +- src/addrdb.cpp | 4 +- src/addrman.cpp | 5 +- src/addrman.h | 2 +- src/bench/CMakeLists.txt | 2 + src/bench/bench.cpp | 30 +- src/bench/bench.h | 1 + src/bench/bench_bitcoin.cpp | 15 + src/bench/mempool_ephemeral_spends.cpp | 83 ++ src/bench/wallet_migration.cpp | 80 ++ src/bitcoin-chainstate.cpp | 3 - src/bitcoin-cli-res.rc | 6 +- src/bitcoin-cli.cpp | 100 +- src/bitcoin-tx-res.rc | 4 +- src/bitcoin-tx.cpp | 9 +- src/bitcoin-util-res.rc | 4 +- src/bitcoin-util.cpp | 7 +- src/bitcoin-wallet-res.rc | 6 +- src/bitcoin-wallet.cpp | 15 +- src/bitcoind-res.rc | 4 +- src/bitcoind.cpp | 12 +- src/chainparams.cpp | 1 + src/clientversion.cpp | 6 +- src/clientversion.h | 2 +- src/cluster_linearize.h | 2 +- src/coins.cpp | 56 +- src/coins.h | 13 +- src/common/args.cpp | 9 +- src/common/settings.cpp | 2 +- src/common/system.cpp | 2 +- src/consensus/validation.h | 16 - src/httpserver.cpp | 2 - src/init.cpp | 30 +- src/init/common.cpp | 2 +- src/interfaces/node.h | 2 +- src/ipc/protocol.h | 2 +- src/kernel/CMakeLists.txt | 1 + src/kernel/bitcoin-chainstate.cpp | 10 +- src/kernel/bitcoinkernel.cpp | 50 +- src/kernel/bitcoinkernel.h | 44 +- src/kernel/bitcoinkernel_wrapper.h | 6 +- src/kernel/chainparams.cpp | 2 +- src/kernel/chainparams.h | 1 + src/kernel/mempool_options.h | 3 - src/key_io.cpp | 3 + src/mapport.cpp | 103 +- src/mapport.h | 6 +- src/memusage.h | 19 +- src/net.cpp | 44 +- src/net.h | 7 +- src/net_processing.cpp | 633 ++------- src/node/chainstate.cpp | 11 +- src/node/coin.cpp | 9 +- src/node/interfaces.cpp | 6 +- src/node/mempool_args.cpp | 5 - src/node/txdownloadman.h | 179 +++ src/node/txdownloadman_impl.cpp | 536 ++++++++ src/node/txdownloadman_impl.h | 194 +++ src/policy/ephemeral_policy.cpp | 78 ++ src/policy/ephemeral_policy.h | 55 + src/policy/policy.cpp | 10 +- src/policy/policy.h | 4 + src/pow.cpp | 8 +- src/protocol.cpp | 26 +- src/protocol.h | 24 +- src/qt/CMakeLists.txt | 3 +- src/qt/bitcoin.cpp | 24 +- src/qt/bitcoingui.cpp | 14 +- src/qt/forms/optionsdialog.ui | 10 - src/qt/intro.cpp | 12 +- src/qt/modaloverlay.cpp | 2 +- src/qt/optionsdialog.cpp | 15 +- src/qt/optionsmodel.cpp | 20 +- src/qt/optionsmodel.h | 1 - src/qt/res/bitcoin-qt-res.rc | 4 +- src/qt/rpcconsole.cpp | 4 +- src/qt/sendcoinsdialog.cpp | 6 +- src/qt/signverifymessagedialog.cpp | 4 +- src/qt/splashscreen.cpp | 2 +- src/qt/test/CMakeLists.txt | 8 - src/qt/test/optiontests.cpp | 5 +- src/qt/test/test_main.cpp | 1 - src/qt/utilitydialog.cpp | 13 +- src/random.cpp | 8 +- src/random.h | 2 +- src/randomenv.cpp | 42 - src/rest.cpp | 11 +- src/rpc/blockchain.cpp | 23 +- src/rpc/client.cpp | 1 - src/rpc/mempool.cpp | 19 +- src/rpc/mining.cpp | 17 +- src/rpc/net.cpp | 6 +- src/rpc/rawtransaction.cpp | 2 +- src/rpc/server.cpp | 4 +- src/rpc/util.cpp | 9 +- src/rpc/util.h | 6 +- src/script/interpreter.cpp | 4 +- src/script/miniscript.cpp | 15 +- src/script/miniscript.h | 27 +- src/secp256k1/.cirrus.yml | 5 +- src/secp256k1/.github/workflows/ci.yml | 51 +- src/secp256k1/.gitignore | 1 + src/secp256k1/CHANGELOG.md | 23 +- src/secp256k1/CMakeLists.txt | 47 +- src/secp256k1/Makefile.am | 16 + src/secp256k1/README.md | 1 + src/secp256k1/ci/ci.sh | 3 +- src/secp256k1/configure.ac | 26 +- src/secp256k1/doc/musig.md | 54 + src/secp256k1/examples/CMakeLists.txt | 13 +- src/secp256k1/examples/ecdh.c | 22 +- src/secp256k1/examples/ecdsa.c | 22 +- src/secp256k1/examples/ellswift.c | 22 +- src/secp256k1/examples/musig.c | 260 ++++ src/secp256k1/examples/schnorr.c | 25 +- src/secp256k1/include/secp256k1.h | 62 +- src/secp256k1/include/secp256k1_extrakeys.h | 13 +- src/secp256k1/include/secp256k1_musig.h | 588 +++++++++ src/secp256k1/include/secp256k1_recovery.h | 4 +- src/secp256k1/include/secp256k1_schnorrsig.h | 2 +- src/secp256k1/src/CMakeLists.txt | 9 +- src/secp256k1/src/bench_ecmult.c | 2 +- src/secp256k1/src/ctime_tests.c | 57 + src/secp256k1/src/ecmult_gen_impl.h | 9 +- src/secp256k1/src/ecmult_impl.h | 18 +- src/secp256k1/src/field.h | 7 +- src/secp256k1/src/field_10x26_impl.h | 7 - src/secp256k1/src/field_5x52_impl.h | 7 - src/secp256k1/src/field_impl.h | 13 +- src/secp256k1/src/group.h | 16 + src/secp256k1/src/group_impl.h | 62 +- src/secp256k1/src/hash.h | 3 + src/secp256k1/src/hash_impl.h | 19 +- src/secp256k1/src/modinv32_impl.h | 10 +- src/secp256k1/src/modinv64_impl.h | 10 +- src/secp256k1/src/modules/ecdh/main_impl.h | 7 +- .../src/modules/ellswift/main_impl.h | 4 +- .../src/modules/musig/Makefile.am.include | 8 + src/secp256k1/src/modules/musig/keyagg.h | 32 + src/secp256k1/src/modules/musig/keyagg_impl.h | 291 +++++ src/secp256k1/src/modules/musig/main_impl.h | 12 + src/secp256k1/src/modules/musig/session.h | 24 + .../src/modules/musig/session_impl.h | 816 ++++++++++++ src/secp256k1/src/modules/musig/tests_impl.h | 1143 +++++++++++++++++ src/secp256k1/src/modules/musig/vectors.h | 346 +++++ .../src/modules/schnorrsig/main_impl.h | 4 +- src/secp256k1/src/scalar_4x64_impl.h | 7 - src/secp256k1/src/scalar_8x32_impl.h | 11 - src/secp256k1/src/scalar_impl.h | 4 + src/secp256k1/src/scalar_low_impl.h | 2 - src/secp256k1/src/scratch.h | 2 + src/secp256k1/src/secp256k1.c | 32 +- src/secp256k1/src/tests.c | 67 +- src/secp256k1/src/testutil.h | 2 +- src/secp256k1/src/util.h | 58 +- src/secp256k1/tools/check-abi.sh | 9 +- .../tools/test_vectors_musig2_generate.py | 656 ++++++++++ src/streams.cpp | 6 + src/streams.h | 3 + src/test/CMakeLists.txt | 4 +- src/test/coins_tests.cpp | 16 +- src/test/fuzz/CMakeLists.txt | 3 +- src/test/fuzz/addrman.cpp | 119 +- src/test/fuzz/coins_view.cpp | 16 +- src/test/fuzz/coinscache_sim.cpp | 47 +- src/test/fuzz/connman.cpp | 29 +- src/test/fuzz/deserialize.cpp | 2 +- src/test/fuzz/fuzz.cpp | 4 + src/test/fuzz/miniscript.cpp | 2 +- src/test/fuzz/p2p_transport_serialization.cpp | 6 +- src/test/fuzz/package_eval.cpp | 218 ++++ src/test/fuzz/partially_downloaded_block.cpp | 1 - src/test/fuzz/process_message.cpp | 2 +- src/test/fuzz/process_messages.cpp | 2 +- src/test/fuzz/protocol.cpp | 2 +- src/test/fuzz/tx_pool.cpp | 5 +- src/test/fuzz/txdownloadman.cpp | 445 +++++++ src/test/fuzz/util/net.h | 112 ++ src/test/fuzz/util/wallet.h | 134 ++ src/test/kernel/test_kernel.cpp | 32 +- src/test/miniscript_tests.cpp | 2 +- src/test/net_tests.cpp | 10 +- src/test/transaction_tests.cpp | 9 + src/test/txdownload_tests.cpp | 336 +++++ src/test/txvalidation_tests.cpp | 120 ++ src/test/util/setup_common.cpp | 21 +- src/test/util/setup_common.h | 3 + src/test/util/txmempool.cpp | 48 + src/test/util/txmempool.h | 12 + src/test/util_trace_tests.cpp | 58 + src/txdb.cpp | 6 +- src/txdb.h | 2 +- src/txmempool.cpp | 22 +- src/txmempool.h | 2 +- src/txorphanage.h | 2 +- src/util/check.cpp | 2 +- src/util/check.h | 12 +- src/util/fs_helpers.cpp | 4 +- src/util/threadnames.cpp | 2 +- src/util/trace.h | 63 +- src/validation.cpp | 104 +- src/wallet/bdb.h | 1 + src/wallet/db.h | 1 + src/wallet/migrate.h | 1 + src/wallet/rpc/backup.cpp | 2 +- src/wallet/salvage.cpp | 1 + src/wallet/scriptpubkeyman.cpp | 33 +- src/wallet/scriptpubkeyman.h | 4 +- src/wallet/spend.cpp | 13 +- src/wallet/sqlite.cpp | 2 +- src/wallet/sqlite.h | 1 + src/wallet/test/fuzz/CMakeLists.txt | 1 + src/wallet/test/fuzz/notifications.cpp | 120 +- src/wallet/test/fuzz/spend.cpp | 102 ++ src/wallet/test/util.h | 1 + src/wallet/wallet.cpp | 201 ++- src/wallet/wallet.h | 11 +- src/wallet/walletdb.cpp | 32 +- src/wallet/walletdb.h | 14 + src/wallet/wallettool.cpp | 4 +- src/zmq/CMakeLists.txt | 5 +- test/config.ini.in | 4 +- test/functional/feature_addrman.py | 2 +- test/functional/feature_filelock.py | 4 +- test/functional/feature_rbf.py | 161 +-- test/functional/feature_settings.py | 2 +- test/functional/interface_bitcoin_cli.py | 2 +- test/functional/interface_zmq.py | 9 +- test/functional/mempool_accept.py | 13 - test/functional/mempool_dust.py | 30 + test/functional/mempool_ephemeral_dust.py | 482 +++++++ test/functional/mempool_limit.py | 95 ++ test/functional/mempool_truc.py | 29 - test/functional/mining_basic.py | 1 + test/functional/p2p_orphan_handling.py | 85 +- test/functional/p2p_seednode.py | 16 +- test/functional/rpc_createmultisig.py | 14 +- .../{rpc_getorphantxs.py => rpc_orphans.py} | 41 +- test/functional/rpc_packages.py | 8 + .../functional/test_framework/mempool_util.py | 16 + test/functional/test_framework/netutil.py | 7 + test/functional/test_framework/p2p.py | 15 +- test/functional/test_framework/socks5.py | 74 +- .../test_framework/test_framework.py | 2 +- test/functional/test_framework/test_node.py | 2 - test/functional/test_framework/util.py | 1 - test/functional/test_runner.py | 3 +- test/functional/tool_wallet.py | 2 +- test/functional/wallet_multiwallet.py | 2 +- test/lint/check-doc.py | 2 +- test/sanitizer_suppressions/ubsan | 1 - vcpkg.json | 72 +- 321 files changed, 10002 insertions(+), 2928 deletions(-) delete mode 100644 cmake/module/FindMiniUPnPc.cmake create mode 100644 cmake/module/FindQRencode.cmake create mode 100644 cmake/module/FindZeroMQ.cmake delete mode 100644 depends/packages/miniupnpc.mk delete mode 100644 depends/patches/libevent/fix_mingw_link.patch delete mode 100644 depends/patches/miniupnpc/cmake_get_src_addr.patch delete mode 100644 depends/patches/miniupnpc/dont_leak_info.patch delete mode 100644 depends/patches/miniupnpc/fix_windows_snprintf.patch delete mode 100644 depends/patches/zeromq/fix_mingw_link.patch delete mode 100644 depends/patches/zeromq/remove_libstd_link.patch create mode 100644 doc/release-notes-30239.md create mode 100644 doc/release-notes-30592.md create mode 100644 doc/release-notes-31130.md create mode 100644 doc/release-notes-31156.md create mode 100644 doc/release-notes/release-notes-27.2.md create mode 100644 src/bench/mempool_ephemeral_spends.cpp create mode 100644 src/bench/wallet_migration.cpp create mode 100644 src/node/txdownloadman.h create mode 100644 src/node/txdownloadman_impl.cpp create mode 100644 src/node/txdownloadman_impl.h create mode 100644 src/policy/ephemeral_policy.cpp create mode 100644 src/policy/ephemeral_policy.h create mode 100644 src/secp256k1/doc/musig.md create mode 100644 src/secp256k1/examples/musig.c create mode 100644 src/secp256k1/include/secp256k1_musig.h create mode 100644 src/secp256k1/src/modules/musig/Makefile.am.include create mode 100644 src/secp256k1/src/modules/musig/keyagg.h create mode 100644 src/secp256k1/src/modules/musig/keyagg_impl.h create mode 100644 src/secp256k1/src/modules/musig/main_impl.h create mode 100644 src/secp256k1/src/modules/musig/session.h create mode 100644 src/secp256k1/src/modules/musig/session_impl.h create mode 100644 src/secp256k1/src/modules/musig/tests_impl.h create mode 100644 src/secp256k1/src/modules/musig/vectors.h create mode 100755 src/secp256k1/tools/test_vectors_musig2_generate.py create mode 100644 src/test/fuzz/txdownloadman.cpp create mode 100644 src/test/fuzz/util/wallet.h create mode 100644 src/test/txdownload_tests.cpp create mode 100644 src/test/util_trace_tests.cpp create mode 100644 src/wallet/test/fuzz/spend.cpp create mode 100755 test/functional/mempool_ephemeral_dust.py rename test/functional/{rpc_getorphantxs.py => rpc_orphans.py} (79%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 439d02c..3275586 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,12 +67,12 @@ jobs: echo "TEST_BASE=$(git rev-list -n$((${{ env.MAX_COUNT }} + 1)) --reverse HEAD $EXCLUDE_MERGE_BASE_ANCESTORS | head -1)" >> "$GITHUB_ENV" - run: | sudo apt-get update - sudo apt-get install clang ccache build-essential cmake pkg-config python3-zmq libevent-dev libboost-dev libsqlite3-dev libdb++-dev systemtap-sdt-dev libminiupnpc-dev libzmq3-dev qtbase5-dev qttools5-dev qttools5-dev-tools qtwayland5 libqrencode-dev -y + sudo apt-get install clang ccache build-essential cmake pkg-config python3-zmq libevent-dev libboost-dev libsqlite3-dev libdb++-dev systemtap-sdt-dev libzmq3-dev qtbase5-dev qttools5-dev qttools5-dev-tools qtwayland5 libqrencode-dev -y - name: Compile and run tests run: | # Run tests on commits after the last merge commit and before the PR head commit # Use clang++, because it is a bit faster and uses less memory than g++ - git rebase --exec "echo Running test-one-commit on \$( git log -1 ) && CC=clang CXX=clang++ cmake -B build -DWERROR=ON -DWITH_ZMQ=ON -DBUILD_GUI=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWITH_BDB=ON -DWITH_MINIUPNPC=ON -DWITH_USDT=ON && cmake --build build -j $(nproc) && ctest --test-dir build -j $(nproc) && ./build/test/functional/test_runner.py -j $(( $(nproc) * 2 ))" ${{ env.TEST_BASE }} + git rebase --exec "echo Running test-one-commit on \$( git log -1 ) && CC=clang CXX=clang++ cmake -B build -DWERROR=ON -DWITH_ZMQ=ON -DBUILD_GUI=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWITH_BDB=ON -DWITH_USDT=ON -DCMAKE_CXX_FLAGS='-Wno-error=unused-member-function' && cmake --build build -j $(nproc) && ctest --output-on-failure --stop-on-failure --test-dir build -j $(nproc) && ./build/test/functional/test_runner.py -j $(( $(nproc) * 2 ))" ${{ env.TEST_BASE }} macos-native-arm64: name: 'macOS 14 native, arm64, no depends, sqlite only, gui' @@ -105,7 +105,7 @@ jobs: run: | # A workaround for "The `brew link` step did not complete successfully" error. brew install --quiet python@3 || brew link --overwrite python@3 - brew install --quiet coreutils ninja pkg-config gnu-getopt ccache boost libevent miniupnpc zeromq qt@5 qrencode + brew install --quiet coreutils ninja pkg-config gnu-getopt ccache boost libevent zeromq qt@5 qrencode - name: Set Ccache directory run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV" @@ -182,7 +182,7 @@ jobs: - name: Generate build system run: | - cmake -B build --preset vs2022-static -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" -DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_MINIUPNPC=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWERROR=ON + cmake -B build --preset vs2022-static -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" -DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DBUILD_FUZZ_BINARY=ON -DWERROR=ON - name: Save vcpkg binary cache uses: actions/cache/save@v4 @@ -199,7 +199,7 @@ jobs: - name: Run test suite working-directory: build run: | - ctest -j $env:NUMBER_OF_PROCESSORS -C Release + ctest --output-on-failure --stop-on-failure -j $env:NUMBER_OF_PROCESSORS -C Release - name: Run functional tests working-directory: build @@ -212,20 +212,6 @@ jobs: shell: cmd run: py -3 test\functional\test_runner.py --jobs %NUMBER_OF_PROCESSORS% --ci --quiet --tmpdirprefix=%RUNNER_TEMP% --combinedlogslen=99999999 --timeout-factor=%TEST_RUNNER_TIMEOUT_FACTOR% %TEST_RUNNER_EXTRA% - - name: Clone fuzz corpus - run: | - git clone --depth=1 https://github.com/bitcoin-core/qa-assets "$env:RUNNER_TEMP\qa-assets" - Set-Location "$env:RUNNER_TEMP\qa-assets" - Write-Host "Using qa-assets repo from commit ..." - git log -1 - - - name: Run fuzz binaries - working-directory: build - env: - BITCOINFUZZ: '${{ github.workspace }}\build\src\test\fuzz\Release\fuzz.exe' - shell: cmd - run: py -3 test\fuzz\test_runner.py --par %NUMBER_OF_PROCESSORS% --loglevel DEBUG %RUNNER_TEMP%\qa-assets\fuzz_corpora - asan-lsan-ubsan-integer-no-depends-usdt: name: 'ASan + LSan + UBSan + integer, no depends, USDT' runs-on: ubuntu-24.04 # has to match container in ci/test/00_setup_env_native_asan.sh for tracing tools diff --git a/CMakeLists.txt b/CMakeLists.txt index a11e2a9..9f1bdd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() #============================= # Project / Package metadata #============================= -set(PACKAGE_NAME "Bitcoin Core") +set(CLIENT_NAME "Bitcoin Core") set(CLIENT_VERSION_MAJOR 28) set(CLIENT_VERSION_MINOR 99) set(CLIENT_VERSION_BUILD 0) @@ -47,14 +47,14 @@ project(BitcoinCore LANGUAGES NONE ) -set(PACKAGE_VERSION ${PROJECT_VERSION}) +set(CLIENT_VERSION_STRING ${PROJECT_VERSION}) if(CLIENT_VERSION_RC GREATER 0) - string(APPEND PACKAGE_VERSION "rc${CLIENT_VERSION_RC}") + string(APPEND CLIENT_VERSION_STRING "rc${CLIENT_VERSION_RC}") endif() set(COPYRIGHT_HOLDERS "The %s developers") -set(COPYRIGHT_HOLDERS_FINAL "The ${PACKAGE_NAME} developers") -set(PACKAGE_BUGREPORT "https://github.com/bitcoin/bitcoin/issues") +set(COPYRIGHT_HOLDERS_FINAL "The ${CLIENT_NAME} developers") +set(CLIENT_BUGREPORT "https://github.com/bitcoin/bitcoin/issues") #============================= # Language setup @@ -122,23 +122,9 @@ option(REDUCE_EXPORTS "Attempt to reduce exported symbols in the resulting execu option(WERROR "Treat compiler warnings as errors." OFF) option(WITH_CCACHE "Attempt to use ccache for compiling." ON) -option(WITH_MINIUPNPC "Enable UPnP." OFF) -if(WITH_MINIUPNPC) - find_package(MiniUPnPc MODULE REQUIRED) -endif() - option(WITH_ZMQ "Enable ZMQ notifications." OFF) if(WITH_ZMQ) - if(VCPKG_TARGET_TRIPLET) - find_package(ZeroMQ CONFIG REQUIRED) - else() - # The ZeroMQ project has provided config files since v4.2.2. - # However, mainstream distributions do not yet provide CMake - # config files for ZeroMQ packages. If they do in the future, - # find_package(ZeroMQ) may be used instead. - find_package(PkgConfig REQUIRED) - pkg_check_modules(libzmq REQUIRED IMPORTED_TARGET libzmq>=4) - endif() + find_package(ZeroMQ 4.0.0 MODULE REQUIRED) endif() option(WITH_USDT "Enable tracepoints for Userspace, Statically Defined Tracing." OFF) @@ -150,8 +136,7 @@ cmake_dependent_option(ENABLE_EXTERNAL_SIGNER "Enable external signer support." cmake_dependent_option(WITH_QRENCODE "Enable QR code support." ON "BUILD_GUI" OFF) if(WITH_QRENCODE) - find_package(PkgConfig REQUIRED) - pkg_check_modules(libqrencode REQUIRED IMPORTED_TARGET libqrencode) + find_package(QRencode MODULE REQUIRED) set(USE_QRCODE TRUE) endif() @@ -236,7 +221,6 @@ if(BUILD_FOR_FUZZING) set(BUILD_WALLET_TOOL OFF) set(BUILD_GUI OFF) set(ENABLE_EXTERNAL_SIGNER OFF) - set(WITH_MINIUPNPC OFF) set(WITH_ZMQ OFF) set(BUILD_TESTS OFF) set(BUILD_GUI_TESTS OFF) @@ -244,7 +228,6 @@ if(BUILD_FOR_FUZZING) set(BUILD_FUZZ_BINARY ON) target_compile_definitions(core_interface INTERFACE - ABORT_ON_FAILED_ASSUME FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION ) endif() @@ -326,10 +309,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4) endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - target_compile_definitions(core_interface INTERFACE - MAC_OSX - OBJC_OLD_DISPATCH_PROTOTYPES=0 - ) + target_compile_definitions(core_interface INTERFACE OBJC_OLD_DISPATCH_PROTOTYPES=0) # These flags are specific to ld64, and may cause issues with other linkers. # For example: GNU ld will interpret -dead_strip as -de and then try and use # "ad_strip" as the symbol for the entry point. @@ -457,6 +437,10 @@ configure_file(contrib/filter-lcov.py filter-lcov.py USE_SOURCE_PERMISSIONS COPY # Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review. try_append_cxx_flags("-fno-extended-identifiers" TARGET core_interface SKIP_LINK) +try_append_cxx_flags("-ffile-prefix-map=A=B" TARGET core_interface SKIP_LINK + IF_CHECK_PASSED "-ffile-prefix-map=${PROJECT_SOURCE_DIR}/src=." +) + # Currently all versions of gcc are subject to a class of bugs, see the # gccbug_90348 test case (only reproduces on GCC 11 and earlier) and # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111843. To work around that, set @@ -567,6 +551,12 @@ endif() if(BUILD_TESTS) enable_testing() endif() + +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.29) + # have "make test" depend on "make all" + set(CMAKE_SKIP_TEST_ALL_DEPENDENCY FALSE) +endif() + # TODO: The `CMAKE_SKIP_BUILD_RPATH` variable setting can be deleted # in the future after reordering Guix script commands to # perform binary checks after the installation step. @@ -618,7 +608,6 @@ if(ENABLE_WALLET) message(" - legacy wallets (Berkeley DB) ..... ${WITH_BDB}") endif() message(" external signer ..................... ${ENABLE_EXTERNAL_SIGNER}") -message(" port mapping using UPnP ............. ${WITH_MINIUPNPC}") message(" ZeroMQ .............................. ${WITH_ZMQ}") message(" USDT tracing ........................ ${WITH_USDT}") message(" QR code (GUI) ....................... ${WITH_QRENCODE}") diff --git a/CMakePresets.json b/CMakePresets.json index 3bbb61a..597907b 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -15,8 +15,7 @@ "toolchainFile": "$env{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake", "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x64-windows", - "BUILD_GUI": "ON", - "WITH_QRENCODE": "OFF" + "BUILD_GUI": "ON" } }, { @@ -32,8 +31,7 @@ "toolchainFile": "$env{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake", "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x64-windows-static", - "BUILD_GUI": "ON", - "WITH_QRENCODE": "OFF" + "BUILD_GUI": "ON" } }, { @@ -84,7 +82,6 @@ "ENABLE_WALLET": "ON", "WARN_INCOMPATIBLE_BDB": "OFF", "WITH_BDB": "ON", - "WITH_MINIUPNPC": "ON", "WITH_MULTIPROCESS": "ON", "WITH_QRENCODE": "ON", "WITH_SQLITE": "ON", diff --git a/ci/test/00_setup_env_mac_native.sh b/ci/test/00_setup_env_mac_native.sh index 45d644d..e01a568 100755 --- a/ci/test/00_setup_env_mac_native.sh +++ b/ci/test/00_setup_env_mac_native.sh @@ -11,8 +11,7 @@ export LC_ALL=C.UTF-8 export PIP_PACKAGES="--break-system-packages zmq" export GOAL="install" export CMAKE_GENERATOR="Ninja" -export BITCOIN_CONFIG="-DBUILD_GUI=ON -DWITH_ZMQ=ON -DWITH_MINIUPNPC=ON -DREDUCE_EXPORTS=ON" +export BITCOIN_CONFIG="-DBUILD_GUI=ON -DWITH_ZMQ=ON -DREDUCE_EXPORTS=ON" export CI_OS_NAME="macos" export NO_DEPENDS=1 export OSX_SDK="" -export RUN_FUZZ_TESTS=true diff --git a/ci/test/00_setup_env_native_asan.sh b/ci/test/00_setup_env_native_asan.sh index dc84ef4..d7ff7c2 100755 --- a/ci/test/00_setup_env_native_asan.sh +++ b/ci/test/00_setup_env_native_asan.sh @@ -19,14 +19,15 @@ else fi export CONTAINER_NAME=ci_native_asan -export PACKAGES="systemtap-sdt-dev clang-18 llvm-18 libclang-rt-18-dev python3-zmq qtbase5-dev qttools5-dev qttools5-dev-tools libevent-dev libboost-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE}" +export APT_LLVM_V="19" +export PACKAGES="systemtap-sdt-dev clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev python3-zmq qtbase5-dev qttools5-dev qttools5-dev-tools libevent-dev libboost-dev libdb5.3++-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE}" export NO_DEPENDS=1 export GOAL="install" export BITCOIN_CONFIG="\ -DWITH_USDT=ON -DWITH_ZMQ=ON -DWITH_BDB=ON -DWARN_INCOMPATIBLE_BDB=OFF -DBUILD_GUI=ON \ -DSANITIZERS=address,float-divide-by-zero,integer,undefined \ - -DCMAKE_C_COMPILER=clang-18 \ - -DCMAKE_CXX_COMPILER=clang++-18 \ + -DCMAKE_C_COMPILER=clang-${APT_LLVM_V} \ + -DCMAKE_CXX_COMPILER=clang++-${APT_LLVM_V} \ -DCMAKE_C_FLAGS='-ftrivial-auto-var-init=pattern' \ -DCMAKE_CXX_FLAGS='-ftrivial-auto-var-init=pattern -Wno-error=deprecated-declarations' \ -DAPPEND_CXXFLAGS='-std=c++23' \ diff --git a/ci/test/00_setup_env_native_fuzz.sh b/ci/test/00_setup_env_native_fuzz.sh index 1aa2487..597e240 100755 --- a/ci/test/00_setup_env_native_fuzz.sh +++ b/ci/test/00_setup_env_native_fuzz.sh @@ -8,7 +8,8 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04" export CONTAINER_NAME=ci_native_fuzz -export PACKAGES="clang-18 llvm-18 libclang-rt-18-dev libevent-dev libboost-dev libsqlite3-dev" +export APT_LLVM_V="19" +export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev libevent-dev libboost-dev libsqlite3-dev" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false @@ -18,9 +19,9 @@ export CI_CONTAINER_CAP="--cap-add SYS_PTRACE" # If run with (ASan + LSan), the export BITCOIN_CONFIG="\ -DBUILD_FOR_FUZZING=ON \ -DSANITIZERS=fuzzer,address,undefined,float-divide-by-zero,integer \ - -DCMAKE_C_COMPILER=clang-18 \ - -DCMAKE_CXX_COMPILER=clang++-18 \ + -DCMAKE_C_COMPILER=clang-${APT_LLVM_V} \ + -DCMAKE_CXX_COMPILER=clang++-${APT_LLVM_V} \ -DCMAKE_C_FLAGS='-ftrivial-auto-var-init=pattern' \ -DCMAKE_CXX_FLAGS='-ftrivial-auto-var-init=pattern' \ " -export LLVM_SYMBOLIZER_PATH="/usr/bin/llvm-symbolizer-18" +export LLVM_SYMBOLIZER_PATH="/usr/bin/llvm-symbolizer-${APT_LLVM_V}" diff --git a/ci/test/00_setup_env_native_previous_releases.sh b/ci/test/00_setup_env_native_previous_releases.sh index 717eb67..19a33f1 100755 --- a/ci/test/00_setup_env_native_previous_releases.sh +++ b/ci/test/00_setup_env_native_previous_releases.sh @@ -10,7 +10,7 @@ export CONTAINER_NAME=ci_native_previous_releases export CI_IMAGE_NAME_TAG="docker.io/ubuntu:22.04" # Use minimum supported python3.10 and gcc-11, see doc/dependencies.md export PACKAGES="gcc-11 g++-11 python3-zmq" -export DEP_OPTS="NO_UPNP=1 DEBUG=1 CC=gcc-11 CXX=g++-11" +export DEP_OPTS="DEBUG=1 CC=gcc-11 CXX=g++-11" export TEST_RUNNER_EXTRA="--previous-releases --coverage --extended --exclude feature_dbcrash" # Run extended tests so that coverage does not fail, but exclude the very slow dbcrash export RUN_UNIT_TESTS_SEQUENTIAL="true" export RUN_UNIT_TESTS="false" diff --git a/ci/test/00_setup_env_native_tidy.sh b/ci/test/00_setup_env_native_tidy.sh index cc1dea0..9068045 100755 --- a/ci/test/00_setup_env_native_tidy.sh +++ b/ci/test/00_setup_env_native_tidy.sh @@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04" export CONTAINER_NAME=ci_native_tidy export TIDY_LLVM_V="18" -export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq libevent-dev libboost-dev libminiupnpc-dev libzmq3-dev systemtap-sdt-dev qtbase5-dev qttools5-dev qttools5-dev-tools libqrencode-dev libsqlite3-dev libdb++-dev" +export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qtbase5-dev qttools5-dev qttools5-dev-tools libqrencode-dev libsqlite3-dev libdb++-dev" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false @@ -18,7 +18,7 @@ export RUN_CHECK_DEPS=true export RUN_TIDY=true export GOAL="install" export BITCOIN_CONFIG="\ - -DWITH_ZMQ=ON -DBUILD_GUI=ON -DBUILD_BENCH=ON -DWITH_MINIUPNPC=ON -DWITH_USDT=ON -DWITH_BDB=ON -DWARN_INCOMPATIBLE_BDB=OFF \ + -DWITH_ZMQ=ON -DBUILD_GUI=ON -DBUILD_BENCH=ON -DWITH_USDT=ON -DWITH_BDB=ON -DWARN_INCOMPATIBLE_BDB=OFF \ -DENABLE_HARDENING=OFF \ -DCMAKE_C_COMPILER=clang-${TIDY_LLVM_V} \ -DCMAKE_CXX_COMPILER=clang++-${TIDY_LLVM_V} \ diff --git a/ci/test/00_setup_env_native_tsan.sh b/ci/test/00_setup_env_native_tsan.sh index 9c2da77..d82dda3 100755 --- a/ci/test/00_setup_env_native_tsan.sh +++ b/ci/test/00_setup_env_native_tsan.sh @@ -8,8 +8,9 @@ export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_native_tsan export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04" -export PACKAGES="clang-18 llvm-18 libclang-rt-18-dev libc++abi-18-dev libc++-18-dev python3-zmq" -export DEP_OPTS="CC=clang-18 CXX='clang++-18 -stdlib=libc++'" +export APT_LLVM_V="19" +export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev libc++abi-${APT_LLVM_V}-dev libc++-${APT_LLVM_V}-dev python3-zmq" +export DEP_OPTS="CC=clang-${APT_LLVM_V} CXX='clang++-${APT_LLVM_V} -stdlib=libc++'" export GOAL="install" export BITCOIN_CONFIG="-DWITH_ZMQ=ON -DSANITIZERS=thread \ -DAPPEND_CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES'" diff --git a/ci/test/00_setup_env_native_valgrind.sh b/ci/test/00_setup_env_native_valgrind.sh index 3c5622c..3acb584 100755 --- a/ci/test/00_setup_env_native_valgrind.sh +++ b/ci/test/00_setup_env_native_valgrind.sh @@ -8,14 +8,14 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04" export CONTAINER_NAME=ci_native_valgrind -export PACKAGES="valgrind clang-16 llvm-16 libclang-rt-16-dev python3-zmq libevent-dev libboost-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libsqlite3-dev" +export PACKAGES="valgrind clang-16 llvm-16 libclang-rt-16-dev python3-zmq libevent-dev libboost-dev libdb5.3++-dev libzmq3-dev libsqlite3-dev" export USE_VALGRIND=1 export NO_DEPENDS=1 export TEST_RUNNER_EXTRA="--exclude feature_init,rpc_bind,feature_bind_extra" # feature_init excluded for now, see https://github.com/bitcoin/bitcoin/issues/30011 ; bind tests excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547 export GOAL="install" # TODO enable GUI export BITCOIN_CONFIG="\ - -DWITH_ZMQ=ON -DWITH_BDB=ON -DWITH_MINIUPNPC=ON -DWARN_INCOMPATIBLE_BDB=OFF -DBUILD_GUI=OFF \ + -DWITH_ZMQ=ON -DWITH_BDB=ON -DWARN_INCOMPATIBLE_BDB=OFF -DBUILD_GUI=OFF \ -DCMAKE_C_COMPILER=clang-16 \ -DCMAKE_CXX_COMPILER=clang++-16 \ " diff --git a/ci/test/01_base_install.sh b/ci/test/01_base_install.sh index 72e3985..e026b91 100755 --- a/ci/test/01_base_install.sh +++ b/ci/test/01_base_install.sh @@ -21,6 +21,17 @@ if [ -n "$DPKG_ADD_ARCH" ]; then dpkg --add-architecture "$DPKG_ADD_ARCH" fi +if [ -n "${APT_LLVM_V}" ]; then + ${CI_RETRY_EXE} apt-get update + ${CI_RETRY_EXE} apt-get install curl -y + curl "https://apt.llvm.org/llvm-snapshot.gpg.key" | tee "/etc/apt/trusted.gpg.d/apt.llvm.org.asc" + ( + # shellcheck disable=SC2034 + source /etc/os-release + echo "deb http://apt.llvm.org/${VERSION_CODENAME}/ llvm-toolchain-${VERSION_CODENAME}-${APT_LLVM_V} main" > "/etc/apt/sources.list.d/llvm-toolchain-${VERSION_CODENAME}-${APT_LLVM_V}.list" + ) +fi + if [[ $CI_IMAGE_NAME_TAG == *centos* ]]; then bash -c "dnf -y install epel-release" bash -c "dnf -y --allowerasing install $CI_BASE_PACKAGES $PACKAGES" diff --git a/ci/test/02_run_container.sh b/ci/test/02_run_container.sh index 9069fba..ce01db3 100755 --- a/ci/test/02_run_container.sh +++ b/ci/test/02_run_container.sh @@ -59,11 +59,16 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then fi if [ "$DANGER_CI_ON_HOST_CCACHE_FOLDER" ]; then + # Temporary exclusion for https://github.com/bitcoin/bitcoin/issues/31108 + # to allow CI configs and envs generated in the past to work for a bit longer. + # Can be removed in March 2025. + if [ "${CCACHE_DIR}" != "/tmp/ccache_dir" ]; then if [ ! -d "${CCACHE_DIR}" ]; then echo "Error: Directory '${CCACHE_DIR}' must be created in advance." exit 1 fi CI_CCACHE_MOUNT="type=bind,src=${CCACHE_DIR},dst=${CCACHE_DIR}" + fi # End temporary exclusion fi docker network create --ipv6 --subnet 1111:1111::/112 ci-ip6net || true diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh index 6eab4f7..f9064d1 100755 --- a/ci/test/03_test_script.sh +++ b/ci/test/03_test_script.sh @@ -10,7 +10,7 @@ set -ex export ASAN_OPTIONS="detect_leaks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1" export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan" -export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1" +export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1:second_deadlock_stack=1" export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1" echo "Number of available processing units: $(nproc)" @@ -145,7 +145,7 @@ if [ "$RUN_CHECK_DEPS" = "true" ]; then fi if [ "$RUN_UNIT_TESTS" = "true" ]; then - DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" CTEST_OUTPUT_ON_FAILURE=ON ctest "${MAKEJOBS}" --timeout $(( TEST_RUNNER_TIMEOUT_FACTOR * 60 )) + DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" CTEST_OUTPUT_ON_FAILURE=ON ctest --stop-on-failure "${MAKEJOBS}" --timeout $(( TEST_RUNNER_TIMEOUT_FACTOR * 60 )) fi if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then diff --git a/cmake/bitcoin-build-config.h.in b/cmake/bitcoin-build-config.h.in index 094eb80..56e0519 100644 --- a/cmake/bitcoin-build-config.h.in +++ b/cmake/bitcoin-build-config.h.in @@ -24,7 +24,7 @@ #define COPYRIGHT_HOLDERS_FINAL "@COPYRIGHT_HOLDERS_FINAL@" /* Replacement for %s in copyright holders string */ -#define COPYRIGHT_HOLDERS_SUBSTITUTION "@PACKAGE_NAME@" +#define COPYRIGHT_HOLDERS_SUBSTITUTION "@CLIENT_NAME@" /* Copyright year */ #define COPYRIGHT_YEAR @COPYRIGHT_YEAR@ @@ -71,9 +71,6 @@ */ #cmakedefine01 HAVE_DECL_SETSID -/* Define this symbol if evhttp_connection_get_peer expects const char** */ -#cmakedefine HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR 1 - /* Define to 1 if fdatasync is available. */ #cmakedefine HAVE_FDATASYNC 1 @@ -124,16 +121,16 @@ #cmakedefine HAVE_VM_VM_PARAM_H 1 /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" +#define CLIENT_BUGREPORT "@CLIENT_BUGREPORT@" /* Define to the full name of this package. */ -#define PACKAGE_NAME "@PACKAGE_NAME@" +#define CLIENT_NAME "@CLIENT_NAME@" /* Define to the home page for this package. */ -#define PACKAGE_URL "@PROJECT_HOMEPAGE_URL@" +#define CLIENT_URL "@PROJECT_HOMEPAGE_URL@" /* Define to the version of this package. */ -#define PACKAGE_VERSION "@PACKAGE_VERSION@" +#define CLIENT_VERSION_STRING "@CLIENT_VERSION_STRING@" /* Define to 1 if strerror_r returns char *. */ #cmakedefine STRERROR_R_CHAR_P 1 diff --git a/cmake/ccache.cmake b/cmake/ccache.cmake index 099aa66..d1cc204 100644 --- a/cmake/ccache.cmake +++ b/cmake/ccache.cmake @@ -23,14 +23,6 @@ if(NOT MSVC) else() set(WITH_CCACHE OFF) endif() - if(WITH_CCACHE) - try_append_cxx_flags("-fdebug-prefix-map=A=B" TARGET core_interface SKIP_LINK - IF_CHECK_PASSED "-fdebug-prefix-map=${PROJECT_SOURCE_DIR}=." - ) - try_append_cxx_flags("-fmacro-prefix-map=A=B" TARGET core_interface SKIP_LINK - IF_CHECK_PASSED "-fmacro-prefix-map=${PROJECT_SOURCE_DIR}=." - ) - endif() endif() mark_as_advanced(CCACHE_EXECUTABLE) diff --git a/cmake/module/FindLibevent.cmake b/cmake/module/FindLibevent.cmake index 901a4f3..c006b43 100644 --- a/cmake/module/FindLibevent.cmake +++ b/cmake/module/FindLibevent.cmake @@ -35,46 +35,52 @@ function(check_evhttp_connection_get_peer target) " HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR ) cmake_pop_check_state() - set(HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR ${HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR} PARENT_SCOPE) + target_compile_definitions(${target} INTERFACE + $<$:HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR> + ) endfunction() +set(_libevent_components core extra) +if(NOT WIN32) + list(APPEND _libevent_components pthreads) +endif() + +find_package(Libevent ${Libevent_FIND_VERSION} QUIET + NO_MODULE +) include(FindPackageHandleStandardArgs) -if(VCPKG_TARGET_TRIPLET) - find_package(Libevent ${Libevent_FIND_VERSION} NO_MODULE QUIET - COMPONENTS extra +if(Libevent_FOUND) + find_package(Libevent ${Libevent_FIND_VERSION} QUIET + REQUIRED COMPONENTS ${_libevent_components} + NO_MODULE ) find_package_handle_standard_args(Libevent REQUIRED_VARS Libevent_DIR VERSION_VAR Libevent_VERSION ) check_evhttp_connection_get_peer(libevent::extra) - add_library(libevent::libevent ALIAS libevent::extra) - mark_as_advanced(Libevent_DIR) - mark_as_advanced(_event_h) - mark_as_advanced(_event_lib) else() find_package(PkgConfig REQUIRED) - pkg_check_modules(libevent QUIET - IMPORTED_TARGET - libevent>=${Libevent_FIND_VERSION} - ) - set(_libevent_required_vars libevent_LIBRARY_DIRS libevent_FOUND) - if(NOT WIN32) - pkg_check_modules(libevent_pthreads QUIET - IMPORTED_TARGET - libevent_pthreads>=${Libevent_FIND_VERSION} + foreach(component IN LISTS _libevent_components) + pkg_check_modules(libevent_${component} + REQUIRED QUIET + IMPORTED_TARGET GLOBAL + libevent_${component}>=${Libevent_FIND_VERSION} ) - list(APPEND _libevent_required_vars libevent_pthreads_FOUND) - endif() + if(TARGET PkgConfig::libevent_${component} AND NOT TARGET libevent::${component}) + add_library(libevent::${component} ALIAS PkgConfig::libevent_${component}) + endif() + endforeach() find_package_handle_standard_args(Libevent - REQUIRED_VARS ${_libevent_required_vars} - VERSION_VAR libevent_VERSION + REQUIRED_VARS libevent_core_LIBRARY_DIRS + VERSION_VAR libevent_core_VERSION ) - unset(_libevent_required_vars) - check_evhttp_connection_get_peer(PkgConfig::libevent) - add_library(libevent::libevent ALIAS PkgConfig::libevent) - if(NOT WIN32) - add_library(libevent::pthreads ALIAS PkgConfig::libevent_pthreads) - endif() + check_evhttp_connection_get_peer(PkgConfig::libevent_extra) endif() + +unset(_libevent_components) + +mark_as_advanced(Libevent_DIR) +mark_as_advanced(_event_h) +mark_as_advanced(_event_lib) diff --git a/cmake/module/FindMiniUPnPc.cmake b/cmake/module/FindMiniUPnPc.cmake deleted file mode 100644 index 34b94f0..0000000 --- a/cmake/module/FindMiniUPnPc.cmake +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright (c) 2023-present The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or https://opensource.org/license/mit/. - -if(NOT MSVC) - find_package(PkgConfig REQUIRED) - pkg_check_modules(PC_MiniUPnPc QUIET miniupnpc) -endif() - -find_path(MiniUPnPc_INCLUDE_DIR - NAMES miniupnpc/miniupnpc.h - PATHS ${PC_MiniUPnPc_INCLUDE_DIRS} -) - -if(MiniUPnPc_INCLUDE_DIR) - file( - STRINGS "${MiniUPnPc_INCLUDE_DIR}/miniupnpc/miniupnpc.h" version_strings - REGEX "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+[0-9]+" - ) - string(REGEX REPLACE "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+([0-9]+)" "\\1" MiniUPnPc_API_VERSION "${version_strings}") - - # The minimum supported miniUPnPc API version is set to 17. This excludes - # versions with known vulnerabilities. - if(MiniUPnPc_API_VERSION GREATER_EQUAL 17) - set(MiniUPnPc_API_VERSION_OK TRUE) - endif() -endif() - -if(MSVC) - cmake_path(GET MiniUPnPc_INCLUDE_DIR PARENT_PATH MiniUPnPc_IMPORTED_PATH) - find_library(MiniUPnPc_LIBRARY_DEBUG - NAMES miniupnpc PATHS ${MiniUPnPc_IMPORTED_PATH}/debug/lib - NO_DEFAULT_PATH - ) - find_library(MiniUPnPc_LIBRARY_RELEASE - NAMES miniupnpc PATHS ${MiniUPnPc_IMPORTED_PATH}/lib - NO_DEFAULT_PATH - ) - set(MiniUPnPc_required MiniUPnPc_IMPORTED_PATH) -else() - find_library(MiniUPnPc_LIBRARY - NAMES miniupnpc - PATHS ${PC_MiniUPnPc_LIBRARY_DIRS} - ) - set(MiniUPnPc_required MiniUPnPc_LIBRARY) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(MiniUPnPc - REQUIRED_VARS ${MiniUPnPc_required} MiniUPnPc_INCLUDE_DIR MiniUPnPc_API_VERSION_OK -) - -if(MiniUPnPc_FOUND AND NOT TARGET MiniUPnPc::MiniUPnPc) - add_library(MiniUPnPc::MiniUPnPc UNKNOWN IMPORTED) - set_target_properties(MiniUPnPc::MiniUPnPc PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${MiniUPnPc_INCLUDE_DIR}" - ) - if(MSVC) - if(MiniUPnPc_LIBRARY_DEBUG) - set_property(TARGET MiniUPnPc::MiniUPnPc APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(MiniUPnPc::MiniUPnPc PROPERTIES - IMPORTED_LOCATION_DEBUG "${MiniUPnPc_LIBRARY_DEBUG}" - ) - endif() - if(MiniUPnPc_LIBRARY_RELEASE) - set_property(TARGET MiniUPnPc::MiniUPnPc APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(MiniUPnPc::MiniUPnPc PROPERTIES - IMPORTED_LOCATION_RELEASE "${MiniUPnPc_LIBRARY_RELEASE}" - ) - endif() - else() - set_target_properties(MiniUPnPc::MiniUPnPc PROPERTIES - IMPORTED_LOCATION "${MiniUPnPc_LIBRARY}" - ) - endif() - set_property(TARGET MiniUPnPc::MiniUPnPc PROPERTY - INTERFACE_COMPILE_DEFINITIONS USE_UPNP=1 $<$:MINIUPNP_STATICLIB> - ) -endif() - -mark_as_advanced( - MiniUPnPc_INCLUDE_DIR - MiniUPnPc_LIBRARY -) diff --git a/cmake/module/FindQRencode.cmake b/cmake/module/FindQRencode.cmake new file mode 100644 index 0000000..39e3b8b --- /dev/null +++ b/cmake/module/FindQRencode.cmake @@ -0,0 +1,71 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +#[=======================================================================[ +FindQRencode +------------ + +Finds the QRencode header and library. + +This is a wrapper around find_package()/pkg_check_modules() commands that: + - facilitates searching in various build environments + - prints a standard log message + +#]=======================================================================] + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_QRencode QUIET libqrencode) +endif() + +find_path(QRencode_INCLUDE_DIR + NAMES qrencode.h + PATHS ${PC_QRencode_INCLUDE_DIRS} +) + +find_library(QRencode_LIBRARY_RELEASE + NAMES qrencode + PATHS ${PC_QRencode_LIBRARY_DIRS} +) +find_library(QRencode_LIBRARY_DEBUG + NAMES qrencoded qrencode + PATHS ${PC_QRencode_LIBRARY_DIRS} +) +include(SelectLibraryConfigurations) +select_library_configurations(QRencode) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(QRencode + REQUIRED_VARS QRencode_LIBRARY QRencode_INCLUDE_DIR + VERSION_VAR PC_QRencode_VERSION +) + +if(QRencode_FOUND) + if(NOT TARGET QRencode::QRencode) + add_library(QRencode::QRencode UNKNOWN IMPORTED) + endif() + if(QRencode_LIBRARY_RELEASE) + set_property(TARGET QRencode::QRencode APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE + ) + set_target_properties(QRencode::QRencode PROPERTIES + IMPORTED_LOCATION_RELEASE "${QRencode_LIBRARY_RELEASE}" + ) + endif() + if(QRencode_LIBRARY_DEBUG) + set_property(TARGET QRencode::QRencode APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG + ) + set_target_properties(QRencode::QRencode PROPERTIES + IMPORTED_LOCATION_DEBUG "${QRencode_LIBRARY_DEBUG}" + ) + endif() + set_target_properties(QRencode::QRencode PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${QRencode_INCLUDE_DIR}" + ) +endif() + +mark_as_advanced( + QRencode_INCLUDE_DIR +) diff --git a/cmake/module/FindUSDT.cmake b/cmake/module/FindUSDT.cmake index 0ba9a58..0be7c28 100644 --- a/cmake/module/FindUSDT.cmake +++ b/cmake/module/FindUSDT.cmake @@ -36,13 +36,16 @@ if(USDT_INCLUDE_DIR) include(CheckCXXSourceCompiles) set(CMAKE_REQUIRED_INCLUDES ${USDT_INCLUDE_DIR}) check_cxx_source_compiles(" + // Setting SDT_USE_VARIADIC lets systemtap (sys/sdt.h) know that we want to use + // the optional variadic macros to define tracepoints. + #define SDT_USE_VARIADIC 1 #include int main() { - DTRACE_PROBE(context, event); + STAP_PROBEV(context, event); int a, b, c, d, e, f, g; - DTRACE_PROBE7(context, event, a, b, c, d, e, f, g); + STAP_PROBEV(context, event, a, b, c, d, e, f, g); } " HAVE_USDT_H ) diff --git a/cmake/module/FindZeroMQ.cmake b/cmake/module/FindZeroMQ.cmake new file mode 100644 index 0000000..eecd9b2 --- /dev/null +++ b/cmake/module/FindZeroMQ.cmake @@ -0,0 +1,41 @@ +# Copyright (c) 2024-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. + +#[=======================================================================[ +FindZeroMQ +---------- + +Finds the ZeroMQ headers and library. + +This is a wrapper around find_package()/pkg_check_modules() commands that: + - facilitates searching in various build environments + - prints a standard log message + +#]=======================================================================] + +include(FindPackageHandleStandardArgs) +find_package(ZeroMQ ${ZeroMQ_FIND_VERSION} NO_MODULE QUIET) +if(ZeroMQ_FOUND) + find_package_handle_standard_args(ZeroMQ + REQUIRED_VARS ZeroMQ_DIR + VERSION_VAR ZeroMQ_VERSION + ) + if(TARGET libzmq) + add_library(zeromq ALIAS libzmq) + elseif(TARGET libzmq-static) + add_library(zeromq ALIAS libzmq-static) + endif() + mark_as_advanced(ZeroMQ_DIR) +else() + find_package(PkgConfig REQUIRED) + pkg_check_modules(libzmq QUIET + IMPORTED_TARGET + libzmq>=${ZeroMQ_FIND_VERSION} + ) + find_package_handle_standard_args(ZeroMQ + REQUIRED_VARS libzmq_LIBRARY_DIRS + VERSION_VAR libzmq_VERSION + ) + add_library(zeromq ALIAS PkgConfig::libzmq) +endif() diff --git a/cmake/module/GenerateSetupNsi.cmake b/cmake/module/GenerateSetupNsi.cmake index 3c358c5..97a53b0 100644 --- a/cmake/module/GenerateSetupNsi.cmake +++ b/cmake/module/GenerateSetupNsi.cmake @@ -5,8 +5,8 @@ function(generate_setup_nsi) set(abs_top_srcdir ${PROJECT_SOURCE_DIR}) set(abs_top_builddir ${PROJECT_BINARY_DIR}) - set(PACKAGE_URL ${PROJECT_HOMEPAGE_URL}) - set(PACKAGE_TARNAME "bitcoin") + set(CLIENT_URL ${PROJECT_HOMEPAGE_URL}) + set(CLIENT_TARNAME "bitcoin") set(BITCOIN_GUI_NAME "bitcoin-qt") set(BITCOIN_DAEMON_NAME "bitcoind") set(BITCOIN_CLI_NAME "bitcoin-cli") diff --git a/cmake/module/Maintenance.cmake b/cmake/module/Maintenance.cmake index 456419b..61251d2 100644 --- a/cmake/module/Maintenance.cmake +++ b/cmake/module/Maintenance.cmake @@ -98,7 +98,7 @@ function(add_macos_deploy_target) file(CONFIGURE OUTPUT ${macos_app}/Contents/Resources/empty.lproj CONTENT "") configure_file(${PROJECT_SOURCE_DIR}/src/qt/res/icons/bitcoin.icns ${macos_app}/Contents/Resources/bitcoin.icns NO_SOURCE_PERMISSIONS COPYONLY) file(CONFIGURE OUTPUT ${macos_app}/Contents/Resources/Base.lproj/InfoPlist.strings - CONTENT "{ CFBundleDisplayName = \"@PACKAGE_NAME@\"; CFBundleName = \"@PACKAGE_NAME@\"; }" + CONTENT "{ CFBundleDisplayName = \"@CLIENT_NAME@\"; CFBundleName = \"@CLIENT_NAME@\"; }" ) add_custom_command( @@ -109,7 +109,7 @@ function(add_macos_deploy_target) VERBATIM ) - string(REPLACE " " "-" osx_volname ${PACKAGE_NAME}) + string(REPLACE " " "-" osx_volname ${CLIENT_NAME}) if(CMAKE_HOST_APPLE) add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/${osx_volname}.zip diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index 3184cd4..6c252e7 100755 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -212,7 +212,6 @@ CONFIGFLAGS="-DREDUCE_EXPORTS=ON -DBUILD_BENCH=OFF -DBUILD_GUI_TESTS=OFF -DBUILD HOST_CFLAGS="-O2 -g" HOST_CFLAGS+=$(find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;) case "$HOST" in - *linux*) HOST_CFLAGS+=" -ffile-prefix-map=${DISTSRC}/src=." ;; *mingw*) HOST_CFLAGS+=" -fno-ident" ;; *darwin*) unset HOST_CFLAGS ;; esac diff --git a/contrib/tracing/README.md b/contrib/tracing/README.md index c471770..cf59d7e 100644 --- a/contrib/tracing/README.md +++ b/contrib/tracing/README.md @@ -82,7 +82,7 @@ about the connection. Peers can be selected individually to view recent P2P messages. ``` -$ python3 contrib/tracing/p2p_monitor.py ./build/src/bitcoind +$ python3 contrib/tracing/p2p_monitor.py $(pidof bitcoind) ``` Lists selectable peers and traffic and connection information. @@ -150,7 +150,7 @@ lost. BCC prints: `Possibly lost 2 samples` on lost messages. ``` -$ python3 contrib/tracing/log_raw_p2p_msgs.py ./build/src/bitcoind +$ python3 contrib/tracing/log_raw_p2p_msgs.py $(pidof bitcoind) ``` ``` @@ -241,7 +241,7 @@ A BCC Python script to log the UTXO cache flushes. Based on the `utxocache:flush` tracepoint. ```bash -$ python3 contrib/tracing/log_utxocache_flush.py ./build/src/bitcoind +$ python3 contrib/tracing/log_utxocache_flush.py $(pidof bitcoind) ``` ``` @@ -300,7 +300,7 @@ comprising a timestamp along with all event data available via the event's tracepoint. ```console -$ python3 contrib/tracing/mempool_monitor.py ./build/src/bitcoind +$ python3 contrib/tracing/mempool_monitor.py $(pidof bitcoind) ``` ``` diff --git a/contrib/tracing/log_raw_p2p_msgs.py b/contrib/tracing/log_raw_p2p_msgs.py index c0ab704..bd51c2e 100755 --- a/contrib/tracing/log_raw_p2p_msgs.py +++ b/contrib/tracing/log_raw_p2p_msgs.py @@ -132,8 +132,9 @@ def print_message(event, inbound): ) -def main(bitcoind_path): - bitcoind_with_usdts = USDT(path=str(bitcoind_path)) +def main(pid): + print(f"Hooking into bitcoind with pid {pid}") + bitcoind_with_usdts = USDT(pid=int(pid)) # attaching the trace functions defined in the BPF program to the tracepoints bitcoind_with_usdts.enable_probe( @@ -176,8 +177,8 @@ def handle_outbound(_, data, size): if __name__ == "__main__": - if len(sys.argv) < 2: - print("USAGE:", sys.argv[0], "path/to/bitcoind") + if len(sys.argv) != 2: + print("USAGE:", sys.argv[0], "") exit() - path = sys.argv[1] - main(path) + pid = sys.argv[1] + main(pid) diff --git a/contrib/tracing/log_utxocache_flush.py b/contrib/tracing/log_utxocache_flush.py index 6c56899..8ff9cd5 100755 --- a/contrib/tracing/log_utxocache_flush.py +++ b/contrib/tracing/log_utxocache_flush.py @@ -70,8 +70,9 @@ def print_event(event): )) -def main(bitcoind_path): - bitcoind_with_usdts = USDT(path=str(bitcoind_path)) +def main(pid): + print(f"Hooking into bitcoind with pid {pid}") + bitcoind_with_usdts = USDT(pid=int(pid)) # attaching the trace functions defined in the BPF program # to the tracepoints @@ -99,9 +100,9 @@ def handle_flush(_, data, size): if __name__ == "__main__": - if len(sys.argv) < 2: - print("USAGE: ", sys.argv[0], "path/to/bitcoind") + if len(sys.argv) != 2: + print("USAGE: ", sys.argv[0], "") exit(1) - path = sys.argv[1] - main(path) + pid = sys.argv[1] + main(pid) diff --git a/contrib/tracing/mempool_monitor.py b/contrib/tracing/mempool_monitor.py index afb5e60..4492cb7 100755 --- a/contrib/tracing/mempool_monitor.py +++ b/contrib/tracing/mempool_monitor.py @@ -114,8 +114,9 @@ """ -def main(bitcoind_path): - bitcoind_with_usdts = USDT(path=str(bitcoind_path)) +def main(pid): + print(f"Hooking into bitcoind with pid {pid}") + bitcoind_with_usdts = USDT(pid=int(pid)) # attaching the trace functions defined in the BPF program # to the tracepoints @@ -365,8 +366,8 @@ def timestamp_age(timestamp): if __name__ == "__main__": if len(sys.argv) < 2: - print("USAGE: ", sys.argv[0], "path/to/bitcoind") + print("USAGE: ", sys.argv[0], "") exit(1) - path = sys.argv[1] - main(path) + pid = sys.argv[1] + main(pid) diff --git a/contrib/tracing/p2p_monitor.py b/contrib/tracing/p2p_monitor.py index 4ff701c..63a27fc 100755 --- a/contrib/tracing/p2p_monitor.py +++ b/contrib/tracing/p2p_monitor.py @@ -14,8 +14,9 @@ # outbound P2P messages. The eBPF program submits the P2P messages to # this script via a BPF ring buffer. -import sys import curses +import os +import sys from curses import wrapper, panel from bcc import BPF, USDT @@ -115,10 +116,10 @@ def add_message(self, message): self.total_outbound_msgs += 1 -def main(bitcoind_path): +def main(pid): peers = dict() - - bitcoind_with_usdts = USDT(path=str(bitcoind_path)) + print(f"Hooking into bitcoind with pid {pid}") + bitcoind_with_usdts = USDT(pid=int(pid)) # attaching the trace functions defined in the BPF program to the tracepoints bitcoind_with_usdts.enable_probe( @@ -245,9 +246,14 @@ def render(screen, peers, cur_list_pos, scroll, ROWS_AVALIABLE_FOR_LIST, info_pa (msg.msg_type, msg.size), curses.A_NORMAL) +def running_as_root(): + return os.getuid() == 0 + if __name__ == "__main__": - if len(sys.argv) < 2: - print("USAGE:", sys.argv[0], "path/to/bitcoind") + if len(sys.argv) != 2: + print("USAGE:", sys.argv[0], "") exit() - path = sys.argv[1] - main(path) + if not running_as_root(): + print("You might not have the privileges required to hook into the tracepoints!") + pid = sys.argv[1] + main(pid) diff --git a/depends/Makefile b/depends/Makefile index f1dc300..a2a9f68 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -40,7 +40,6 @@ NO_BDB ?= NO_SQLITE ?= NO_WALLET ?= NO_ZMQ ?= -NO_UPNP ?= NO_USDT ?= MULTIPROCESS ?= LTO ?= @@ -157,13 +156,11 @@ bdb_packages_$(NO_BDB) = $(bdb_packages) sqlite_packages_$(NO_SQLITE) = $(sqlite_packages) wallet_packages_$(NO_WALLET) = $(bdb_packages_) $(sqlite_packages_) -upnp_packages_$(NO_UPNP) = $(upnp_packages) - zmq_packages_$(NO_ZMQ) = $(zmq_packages) multiprocess_packages_$(MULTIPROCESS) = $(multiprocess_packages) usdt_packages_$(NO_USDT) = $(usdt_$(host_os)_packages) -packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(boost_packages_) $(libevent_packages_) $(qt_packages_) $(wallet_packages_) $(upnp_packages_) $(usdt_packages_) +packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(boost_packages_) $(libevent_packages_) $(qt_packages_) $(wallet_packages_) $(usdt_packages_) native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) ifneq ($(zmq_packages_),) @@ -231,7 +228,6 @@ $(host_prefix)/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_$(fina -e 's|@wallet_packages@|$(wallet_packages_)|' \ -e 's|@bdb_packages@|$(bdb_packages_)|' \ -e 's|@sqlite_packages@|$(sqlite_packages_)|' \ - -e 's|@upnp_packages@|$(upnp_packages_)|' \ -e 's|@usdt_packages@|$(usdt_packages_)|' \ -e 's|@no_harden@|$(NO_HARDEN)|' \ -e 's|@multiprocess@|$(MULTIPROCESS)|' \ diff --git a/depends/README.md b/depends/README.md index 0b3430d..5ecf16e 100644 --- a/depends/README.md +++ b/depends/README.md @@ -41,11 +41,17 @@ The paths are automatically configured and no other options are needed. #### Common - apt install bison cmake curl make patch pkg-config python3 xz-utils + apt install cmake curl make patch + +#### GUI + +Skip the following packages if you don't intend to use the GUI and will build with [`NO_QT=1`](#dependency-options): + + apt install bison g++ pkg-config python3 xz-utils #### For macOS cross compilation - apt install clang lld llvm g++ zip + apt install clang lld llvm zip Clang 18 or later is required. You must also obtain the macOS SDK before proceeding with a cross-compile. Under the depends directory, create a @@ -112,7 +118,6 @@ The following can be set when running make: `make FOO=bar` - `NO_WALLET`: Don't download/build/cache libs needed to enable the wallet - `NO_BDB`: Don't download/build/cache BerkeleyDB - `NO_SQLITE`: Don't download/build/cache SQLite -- `NO_UPNP`: Don't download/build/cache packages needed for enabling UPnP - `NO_USDT`: Don't download/build/cache packages needed for enabling USDT tracepoints - `MULTIPROCESS`: Build libmultiprocess (experimental) - `DEBUG`: Disable some optimizations and enable more runtime checking diff --git a/depends/funcs.mk b/depends/funcs.mk index a2f760b..b07432a 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -179,7 +179,8 @@ $(1)_cmake=env CC="$$($(1)_cc)" \ CXX="$$($(1)_cxx)" \ CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \ LDFLAGS="$$($(1)_ldflags)" \ - cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" \ + cmake -G "Unix Makefiles" \ + -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" \ -DCMAKE_AR=`which $$($(1)_ar)` \ -DCMAKE_NM=`which $$($(1)_nm)` \ -DCMAKE_RANLIB=`which $$($(1)_ranlib)` \ diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk index 4c05e8a..91bc75c 100644 --- a/depends/packages/libevent.mk +++ b/depends/packages/libevent.mk @@ -4,7 +4,6 @@ $(package)_download_path=https://github.com/libevent/libevent/releases/download/ $(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb $(package)_patches=cmake_fixups.patch -$(package)_patches+=fix_mingw_link.patch $(package)_build_subdir=build # When building for Windows, we set _WIN32_WINNT to target the same Windows @@ -23,8 +22,7 @@ define $(package)_set_vars endef define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch && \ - patch -p1 < $($(package)_patch_dir)/fix_mingw_link.patch + patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch endef define $(package)_config_cmds @@ -40,7 +38,8 @@ define $(package)_stage_cmds endef define $(package)_postprocess_cmds - rm -rf bin && \ + rm -rf bin lib/pkgconfig && \ rm include/ev*.h && \ - rm include/event2/*_compat.h + rm include/event2/*_compat.h && \ + rm lib/libevent.a endef diff --git a/depends/packages/miniupnpc.mk b/depends/packages/miniupnpc.mk deleted file mode 100644 index f9e114b..0000000 --- a/depends/packages/miniupnpc.mk +++ /dev/null @@ -1,36 +0,0 @@ -package=miniupnpc -$(package)_version=2.2.7 -$(package)_download_path=https://miniupnp.tuxfamily.org/files/ -$(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=b0c3a27056840fd0ec9328a5a9bac3dc5e0ec6d2e8733349cf577b0aa1e70ac1 -$(package)_patches=dont_leak_info.patch cmake_get_src_addr.patch fix_windows_snprintf.patch -$(package)_build_subdir=build - -define $(package)_set_vars -$(package)_config_opts = -DUPNPC_BUILD_SAMPLE=OFF -DUPNPC_BUILD_SHARED=OFF -$(package)_config_opts += -DUPNPC_BUILD_STATIC=ON -DUPNPC_BUILD_TESTS=OFF -$(package)_config_opts_mingw32 += -DMINIUPNPC_TARGET_WINDOWS_VERSION=0x0601 -endef - -define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/dont_leak_info.patch && \ - patch -p1 < $($(package)_patch_dir)/cmake_get_src_addr.patch && \ - patch -p1 < $($(package)_patch_dir)/fix_windows_snprintf.patch -endef - -define $(package)_config_cmds - $($(package)_cmake) -S .. -B . -endef - -define $(package)_build_cmds - $(MAKE) -endef - -define $(package)_stage_cmds - cmake --install . --prefix $($(package)_staging_prefix_dir) -endef - -define $(package)_postprocess_cmds - rm -rf bin && \ - rm -rf share -endef diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk index 08a91cb..61cf662 100644 --- a/depends/packages/packages.mk +++ b/depends/packages/packages.mk @@ -17,8 +17,6 @@ sqlite_packages=sqlite zmq_packages=zeromq -upnp_packages=miniupnpc - multiprocess_packages = libmultiprocess capnp multiprocess_native_packages = native_libmultiprocess native_capnp diff --git a/depends/packages/sqlite.mk b/depends/packages/sqlite.mk index 15bc0f4..d803a37 100644 --- a/depends/packages/sqlite.mk +++ b/depends/packages/sqlite.mk @@ -1,8 +1,8 @@ package=sqlite -$(package)_version=3380500 -$(package)_download_path=https://sqlite.org/2022/ +$(package)_version=3460100 +$(package)_download_path=https://sqlite.org/2024/ $(package)_file_name=sqlite-autoconf-$($(package)_version).tar.gz -$(package)_sha256_hash=5af07de982ba658fd91a03170c945f99c971f6955bc79df3266544373e39869c +$(package)_sha256_hash=67d3fe6d268e6eaddcae3727fce58fcc8e9c53869bdd07a0c61e38ddf2965071 define $(package)_set_vars $(package)_config_opts=--disable-shared --disable-readline --disable-dynamic-extensions --enable-option-checking diff --git a/depends/packages/zeromq.mk b/depends/packages/zeromq.mk index 67a0dd8..743cc38 100644 --- a/depends/packages/zeromq.mk +++ b/depends/packages/zeromq.mk @@ -4,15 +4,13 @@ $(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($ $(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=6653ef5910f17954861fe72332e68b03ca6e4d9c7160eb3a8de5a5a913bfab43 $(package)_build_subdir=build -$(package)_patches = remove_libstd_link.patch -$(package)_patches += macos_mktemp_check.patch +$(package)_patches = macos_mktemp_check.patch $(package)_patches += builtin_sha1.patch $(package)_patches += fix_have_windows.patch $(package)_patches += openbsd_kqueue_headers.patch $(package)_patches += cmake_minimum.patch $(package)_patches += cacheline_undefined.patch $(package)_patches += no_librt.patch -$(package)_patches += fix_mingw_link.patch define $(package)_set_vars $(package)_config_opts := -DCMAKE_BUILD_TYPE=None -DWITH_DOCS=OFF -DWITH_LIBSODIUM=OFF @@ -24,15 +22,13 @@ define $(package)_set_vars endef define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/remove_libstd_link.patch && \ patch -p1 < $($(package)_patch_dir)/macos_mktemp_check.patch && \ patch -p1 < $($(package)_patch_dir)/builtin_sha1.patch && \ patch -p1 < $($(package)_patch_dir)/cacheline_undefined.patch && \ patch -p1 < $($(package)_patch_dir)/fix_have_windows.patch && \ patch -p1 < $($(package)_patch_dir)/openbsd_kqueue_headers.patch && \ patch -p1 < $($(package)_patch_dir)/cmake_minimum.patch && \ - patch -p1 < $($(package)_patch_dir)/no_librt.patch && \ - patch -p1 < $($(package)_patch_dir)/fix_mingw_link.patch + patch -p1 < $($(package)_patch_dir)/no_librt.patch endef define $(package)_config_cmds @@ -48,5 +44,6 @@ define $(package)_stage_cmds endef define $(package)_postprocess_cmds - rm -rf share + rm -rf share && \ + rm -rf lib/pkgconfig endef diff --git a/depends/patches/libevent/cmake_fixups.patch b/depends/patches/libevent/cmake_fixups.patch index d80c1a9..a8812af 100644 --- a/depends/patches/libevent/cmake_fixups.patch +++ b/depends/patches/libevent/cmake_fixups.patch @@ -1,8 +1,5 @@ cmake: set minimum version to 3.5 -Fix generated pkg-config files, see -https://github.com/libevent/libevent/pull/1165. - --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ @@ -14,22 +11,3 @@ https://github.com/libevent/libevent/pull/1165. if (POLICY CMP0054) cmake_policy(SET CMP0054 NEW) -diff --git a/cmake/AddEventLibrary.cmake b/cmake/AddEventLibrary.cmake -index 04f5837e..d8ea42c4 100644 ---- a/cmake/AddEventLibrary.cmake -+++ b/cmake/AddEventLibrary.cmake -@@ -20,12 +20,12 @@ macro(generate_pkgconfig LIB_NAME) - - set(LIBS "") - foreach (LIB ${LIB_PLATFORM}) -- set(LIBS "${LIBS} -L${LIB}") -+ set(LIBS "${LIBS} -l${LIB}") - endforeach() - - set(OPENSSL_LIBS "") - foreach(LIB ${OPENSSL_LIBRARIES}) -- set(OPENSSL_LIBS "${OPENSSL_LIBS} -L${LIB}") -+ set(OPENSSL_LIBS "${OPENSSL_LIBS} -l${LIB}") - endforeach() - - configure_file("lib${LIB_NAME}.pc.in" "lib${LIB_NAME}.pc" @ONLY) diff --git a/depends/patches/libevent/fix_mingw_link.patch b/depends/patches/libevent/fix_mingw_link.patch deleted file mode 100644 index 41cbd46..0000000 --- a/depends/patches/libevent/fix_mingw_link.patch +++ /dev/null @@ -1,25 +0,0 @@ -commit d108099913c5fdbe518f3f4d711f248f8522bd10 -Author: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> -Date: Mon Apr 22 06:39:35 2024 +0100 - - build: Add `Iphlpapi` to `Libs.private` in `*.pc` files on Windows - - It has been required since https://github.com/libevent/libevent/pull/923 - at least for the `if_nametoindex` call. - - See https://github.com/libevent/libevent/pull/1622. - - -diff --git a/configure.ac b/configure.ac -index d00e063a..cd1fce37 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -906,7 +906,7 @@ if(WIN32) - list(APPEND HDR_PRIVATE WIN32-Code/getopt.h) - - set(EVENT__DNS_USE_FTIME_FOR_ID 1) -- set(LIB_PLATFORM ws2_32 shell32 advapi32) -+ set(LIB_PLATFORM ws2_32 shell32 advapi32 iphlpapi) - add_definitions( - -D_CRT_SECURE_NO_WARNINGS - -D_CRT_NONSTDC_NO_DEPRECATE) diff --git a/depends/patches/miniupnpc/cmake_get_src_addr.patch b/depends/patches/miniupnpc/cmake_get_src_addr.patch deleted file mode 100644 index bae1b73..0000000 --- a/depends/patches/miniupnpc/cmake_get_src_addr.patch +++ /dev/null @@ -1,22 +0,0 @@ -commit cb2026239c2a3aff393952ccb0ee1c448189402d -Author: fanquake -Date: Fri Mar 22 14:03:54 2024 +0000 - - build: add MINIUPNPC_GET_SRC_ADDR to CMake build - - This mirrors the autotools build. - - See https://github.com/miniupnp/miniupnp/pull/721. - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1aa95a8..0cacf3e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -31,6 +31,7 @@ endif () - if (NOT WIN32) - target_compile_definitions(miniupnpc-private INTERFACE - MINIUPNPC_SET_SOCKET_TIMEOUT -+ MINIUPNPC_GET_SRC_ADDR - _BSD_SOURCE _DEFAULT_SOURCE) - if (NOT APPLE AND NOT CMAKE_SYSTEM_NAME MATCHES ".*BSD" AND NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS") - # add_definitions (-D_POSIX_C_SOURCE=200112L) diff --git a/depends/patches/miniupnpc/dont_leak_info.patch b/depends/patches/miniupnpc/dont_leak_info.patch deleted file mode 100644 index 95a09a2..0000000 --- a/depends/patches/miniupnpc/dont_leak_info.patch +++ /dev/null @@ -1,32 +0,0 @@ -commit 51f6dd991c29af66fb4f64c6feb2787cce23a1a7 -Author: fanquake -Date: Mon Jan 8 11:21:40 2024 +0000 - - Don't leak OS and miniupnpc version info in User-Agent - -diff --git a/src/minisoap.c b/src/minisoap.c -index 903ac5f..046e0ea 100644 ---- a/src/minisoap.c -+++ b/src/minisoap.c -@@ -90,7 +90,7 @@ int soapPostSubmit(SOCKET fd, - headerssize = snprintf(headerbuf, sizeof(headerbuf), - "POST %s HTTP/%s\r\n" - "Host: %s%s\r\n" -- "User-Agent: " OS_STRING " " UPNP_VERSION_STRING " MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n" -+ "User-Agent: " UPNP_VERSION_STRING "\r\n" - "Content-Length: %d\r\n" - #if (UPNP_VERSION_MAJOR == 1) && (UPNP_VERSION_MINOR == 0) - "Content-Type: text/xml\r\n" -diff --git a/src/miniwget.c b/src/miniwget.c -index e76a5e5..0cc36fe 100644 ---- a/src/miniwget.c -+++ b/src/miniwget.c -@@ -444,7 +444,7 @@ miniwget3(const char * host, - "GET %s HTTP/%s\r\n" - "Host: %s:%d\r\n" - "Connection: Close\r\n" -- "User-Agent: " OS_STRING " " UPNP_VERSION_STRING " MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n" -+ "User-Agent: " UPNP_VERSION_STRING "\r\n" - - "\r\n", - path, httpversion, host, port); diff --git a/depends/patches/miniupnpc/fix_windows_snprintf.patch b/depends/patches/miniupnpc/fix_windows_snprintf.patch deleted file mode 100644 index ff9e262..0000000 --- a/depends/patches/miniupnpc/fix_windows_snprintf.patch +++ /dev/null @@ -1,25 +0,0 @@ -commit a1e9de80ab99b4c956a6a4e21d3e0de6f7a1014d -Author: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> -Date: Sat Apr 20 15:14:47 2024 +0100 - - Fix macro expression that guards `snprintf` for Windows - - Otherwise, the `snprintf` is still wrongly emulated for the following - cases: - - mingw-w64 6.0.0 or new with ucrt - - mingw-w64 8.0.0 or new with iso c ext - ---- a/src/win32_snprintf.h -+++ b/src/win32_snprintf.h -@@ -23,9 +23,9 @@ - (defined(_MSC_VER) && _MSC_VER < 1900) /* Visual Studio older than 2015 */ || \ - (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && defined(__NO_ISOCEXT)) /* mingw32 without iso c ext */ || \ - (defined(__MINGW64_VERSION_MAJOR) && /* mingw-w64 not ... */ !( \ -- (defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO != 0)) /* ... with ansi stdio */ || \ -+ (defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO != 0) /* ... with ansi stdio */ || \ - (__MINGW64_VERSION_MAJOR >= 6 && defined(_UCRT)) /* ... at least 6.0.0 with ucrt */ || \ -- (__MINGW64_VERSION_MAJOR >= 8 && !defined(__NO_ISOCEXT)) /* ... at least 8.0.0 with iso c ext */ || \ -+ (__MINGW64_VERSION_MAJOR >= 8 && !defined(__NO_ISOCEXT))) /* ... at least 8.0.0 with iso c ext */ || \ - 0) || \ - 0) - diff --git a/depends/patches/zeromq/fix_mingw_link.patch b/depends/patches/zeromq/fix_mingw_link.patch deleted file mode 100644 index 1434557..0000000 --- a/depends/patches/zeromq/fix_mingw_link.patch +++ /dev/null @@ -1,31 +0,0 @@ -Fix CMake-generated `libzmq.pc` file - -This change mirrors the Autotools-based build system behavior for -cross-compiling for Windows with static linking. - -See https://github.com/zeromq/libzmq/pull/4706. - - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 03462271..0315e606 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -546,12 +546,18 @@ if(ZMQ_HAVE_WINDOWS) - # Cannot use check_library_exists because the symbol is always declared as char(*)(void) - set(CMAKE_REQUIRED_LIBRARIES "ws2_32.lib") - check_cxx_symbol_exists(WSAStartup "winsock2.h" HAVE_WS2_32) -+ if(HAVE_WS2_32) -+ set(pkg_config_libs_private "${pkg_config_libs_private} -lws2_32") -+ endif() - - set(CMAKE_REQUIRED_LIBRARIES "rpcrt4.lib") - check_cxx_symbol_exists(UuidCreateSequential "rpc.h" HAVE_RPCRT4) - - set(CMAKE_REQUIRED_LIBRARIES "iphlpapi.lib") - check_cxx_symbol_exists(GetAdaptersAddresses "winsock2.h;iphlpapi.h" HAVE_IPHLAPI) -+ if(HAVE_IPHLAPI) -+ set(pkg_config_libs_private "${pkg_config_libs_private} -liphlpapi") -+ endif() - check_cxx_symbol_exists(if_nametoindex "iphlpapi.h" HAVE_IF_NAMETOINDEX) - - set(CMAKE_REQUIRED_LIBRARIES "") diff --git a/depends/patches/zeromq/remove_libstd_link.patch b/depends/patches/zeromq/remove_libstd_link.patch deleted file mode 100644 index ddf91e6..0000000 --- a/depends/patches/zeromq/remove_libstd_link.patch +++ /dev/null @@ -1,25 +0,0 @@ -commit 47d4cd12a2c051815ddda78adebdb3923b260d8a -Author: fanquake -Date: Tue Aug 18 14:45:40 2020 +0800 - - Remove needless linking against libstdc++ - - This is broken for a number of reasons, including: - - g++ understands "static-libstdc++ -lstdc++" to mean "link against - whatever libstdc++ exists, probably shared", which in itself is buggy. - - another stdlib (libc++ for example) may be in use - - See #11981. - -diff --git a/src/libzmq.pc.in b/src/libzmq.pc.in -index 233bc3a..3c2bf0d 100644 ---- a/src/libzmq.pc.in -+++ b/src/libzmq.pc.in -@@ -7,6 +7,6 @@ Name: libzmq - Description: 0MQ c++ library - Version: @VERSION@ - Libs: -L${libdir} -lzmq --Libs.private: -lstdc++ @pkg_config_libs_private@ -+Libs.private: @pkg_config_libs_private@ - Requires.private: @pkg_config_names_private@ - Cflags: -I${includedir} @pkg_config_defines@ diff --git a/depends/toolchain.cmake.in b/depends/toolchain.cmake.in index 735ebc8..37a0c67 100644 --- a/depends/toolchain.cmake.in +++ b/depends/toolchain.cmake.in @@ -139,13 +139,6 @@ else() set(WITH_SQLITE ON CACHE BOOL "") endif() -set(upnp_packages @upnp_packages@) -if("${upnp_packages}" STREQUAL "") - set(WITH_MINIUPNPC OFF CACHE BOOL "") -else() - set(WITH_MINIUPNPC ON CACHE BOOL "") -endif() - set(usdt_packages @usdt_packages@) if("${usdt_packages}" STREQUAL "") set(WITH_USDT OFF CACHE BOOL "") diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index ccaf311..cbbb655 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -38,7 +38,7 @@ PROJECT_NAME = "Bitcoin Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = @PACKAGE_VERSION@ +PROJECT_NUMBER = @CLIENT_VERSION_STRING@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/doc/REST-interface.md b/doc/REST-interface.md index 6664bc2..fbed4a3 100644 --- a/doc/REST-interface.md +++ b/doc/REST-interface.md @@ -117,7 +117,7 @@ $ curl localhost:18332/rest/getutxos/checkmempool/b2cdfd7b89def827ff8af7cd9bff76 "value" : 8.8687, "scriptPubKey" : { "asm" : "OP_DUP OP_HASH160 1c7cebb529b86a04c683dfa87be49de35bcf589e OP_EQUALVERIFY OP_CHECKSIG", - "desc" : "addr(mi7as51dvLJsizWnTMurtRmrP8hG2m1XvD)#gj9tznmy" + "desc" : "addr(mi7as51dvLJsizWnTMurtRmrP8hG2m1XvD)#gj9tznmy", "hex" : "76a9141c7cebb529b86a04c683dfa87be49de35bcf589e88ac", "type" : "pubkeyhash", "address" : "mi7as51dvLJsizWnTMurtRmrP8hG2m1XvD" diff --git a/doc/benchmarking.md b/doc/benchmarking.md index c6dc75d..8f83621 100644 --- a/doc/benchmarking.md +++ b/doc/benchmarking.md @@ -40,7 +40,7 @@ The output will look similar to: Help --------------------- - build/src/bench/bench_bitcoin -? + build/src/bench/bench_bitcoin -h To print the various options, like listing the benchmarks without running them or using a regex filter to only run certain benchmarks. diff --git a/doc/bips.md b/doc/bips.md index d544ff8..a95b315 100644 --- a/doc/bips.md +++ b/doc/bips.md @@ -34,7 +34,6 @@ BIPs that are implemented by Bitcoin Core: * [`BIP 111`](https://github.com/bitcoin/bips/blob/master/bip-0111.mediawiki): `NODE_BLOOM` service bit added, and enforced for all peer versions as of **v0.13.0** ([PR #6579](https://github.com/bitcoin/bitcoin/pull/6579) and [PR #6641](https://github.com/bitcoin/bitcoin/pull/6641)). * [`BIP 112`](https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki): The CHECKSEQUENCEVERIFY opcode has been implemented since **v0.12.1** ([PR #7524](https://github.com/bitcoin/bitcoin/pull/7524)), and has been *buried* since **v0.19.0** ([PR #16060](https://github.com/bitcoin/bitcoin/pull/16060)). * [`BIP 113`](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki): Median time past lock-time calculations have been implemented since **v0.12.1** ([PR #6566](https://github.com/bitcoin/bitcoin/pull/6566)), and has been *buried* since **v0.19.0** ([PR #16060](https://github.com/bitcoin/bitcoin/pull/16060)). -* [`BIP 125`](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki): Opt-in full replace-by-fee partially implemented: signaling is enforced if configured. For other replacement rules, see doc/policy/mempool-replacements.md. * [`BIP 130`](https://github.com/bitcoin/bips/blob/master/bip-0130.mediawiki): direct headers announcement is negotiated with peer versions `>=70012` as of **v0.12.0** ([PR 6494](https://github.com/bitcoin/bitcoin/pull/6494)). * [`BIP 133`](https://github.com/bitcoin/bips/blob/master/bip-0133.mediawiki): feefilter messages are respected and sent for peer versions `>=70013` as of **v0.13.0** ([PR 7542](https://github.com/bitcoin/bitcoin/pull/7542)). * [`BIP 141`](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki): Segregated Witness (Consensus Layer) as of **v0.13.0** ([PR 8149](https://github.com/bitcoin/bitcoin/pull/8149)), defined for mainnet as of **v0.13.1** ([PR 8937](https://github.com/bitcoin/bitcoin/pull/8937)), and *buried* since **v0.19.0** ([PR #16060](https://github.com/bitcoin/bitcoin/pull/16060)). diff --git a/doc/build-freebsd.md b/doc/build-freebsd.md index 8b3b10a..2456abd 100644 --- a/doc/build-freebsd.md +++ b/doc/build-freebsd.md @@ -42,7 +42,7 @@ from ports. However, you can build DB 4.8 yourself [using depends](/depends). ```bash pkg install gmake -gmake -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_UPNP=1 NO_ZMQ=1 NO_USDT=1 +gmake -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_ZMQ=1 NO_USDT=1 ``` When the build is complete, the Berkeley DB installation location will be displayed: diff --git a/doc/build-openbsd.md b/doc/build-openbsd.md index 908b750..d2535d2 100644 --- a/doc/build-openbsd.md +++ b/doc/build-openbsd.md @@ -44,7 +44,7 @@ from ports. However you can build it yourself, [using depends](/depends). Refer to [depends/README.md](/depends/README.md) for detailed instructions. ```bash -gmake -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_UPNP=1 NO_ZMQ=1 NO_USDT=1 +gmake -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_ZMQ=1 NO_USDT=1 ... to: /path/to/bitcoin/depends/*-unknown-openbsd* ``` diff --git a/doc/build-osx.md b/doc/build-osx.md index cb8e82d..c56da9d 100644 --- a/doc/build-osx.md +++ b/doc/build-osx.md @@ -110,19 +110,6 @@ Otherwise, if you don't need QR encoding support, you can pass `-DWITH_QRENCODE= --- -#### Port Mapping Dependencies - -###### miniupnpc - -miniupnpc may be used for UPnP port mapping. -Skip if you do not need this functionality. - -``` bash -brew install miniupnpc -``` - ---- - #### ZMQ Dependencies Support for ZMQ notifications requires the following dependency. diff --git a/doc/build-unix.md b/doc/build-unix.md index 086731b..4f04b4f 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -60,10 +60,6 @@ executables, which are based on BerkeleyDB 4.8. Otherwise, you can build Berkele To build Bitcoin Core without wallet, see [*Disable-wallet mode*](#disable-wallet-mode) -Optional port mapping library (see: `-DWITH_MINIUPNPC=ON`): - - sudo apt install libminiupnpc-dev - ZMQ dependencies (provides ZMQ API): sudo apt-get install libzmq3-dev @@ -112,10 +108,6 @@ are based on Berkeley DB 4.8. Otherwise, you can build Berkeley DB [yourself](#b To build Bitcoin Core without wallet, see [*Disable-wallet mode*](#disable-wallet-mode) -Optional port mapping library (see: `-DWITH_MINIUPNPC=ON`): - - sudo dnf install miniupnpc-devel - ZMQ dependencies (provides ZMQ API): sudo dnf install zeromq-devel @@ -153,7 +145,7 @@ The legacy wallet uses Berkeley DB. To ensure backwards compatibility it is recommended to use Berkeley DB 4.8. If you have to build it yourself, and don't want to use any other libraries built in depends, you can do: ```bash -make -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_UPNP=1 NO_ZMQ=1 NO_USDT=1 +make -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_ZMQ=1 NO_USDT=1 ... to: /path/to/bitcoin/depends/x86_64-pc-linux-gnu ``` @@ -190,7 +182,7 @@ Setup and Build Example: Arch Linux ----------------------------------- This example lists the steps necessary to setup and build a command line only distribution of the latest changes on Arch Linux: - pacman --sync --needed cmake boost gcc git libevent make pkgconf python sqlite + pacman --sync --needed cmake boost gcc git libevent make python sqlite git clone https://github.com/bitcoin/bitcoin.git cd bitcoin/ cmake -B build diff --git a/doc/build-windows-msvc.md b/doc/build-windows-msvc.md index 80c2b77..482b7a7 100644 --- a/doc/build-windows-msvc.md +++ b/doc/build-windows-msvc.md @@ -42,9 +42,7 @@ Available presets can be listed as follows: cmake --list-presets ``` -By default, all presets: -- Set `BUILD_GUI` to `ON`. -- Set `WITH_QRENCODE` to `OFF`, due to known build issues when using vcpkg's `libqrencode` package. +By default, all presets set `BUILD_GUI` to `ON`. ## Building diff --git a/doc/dependencies.md b/doc/dependencies.md index a3d42fc..ec06880 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -31,11 +31,6 @@ You can find installation instructions in the `build-*.md` file for your platfor | [qrencode](../depends/packages/qrencode.mk) | [link](https://fukuchi.org/works/qrencode/) | [4.1.1](https://github.com/bitcoin/bitcoin/pull/27312) | | No | | [Qt](../depends/packages/qt.mk) | [link](https://download.qt.io/official_releases/qt/) | [5.15.14](https://github.com/bitcoin/bitcoin/pull/30198) | [5.11.3](https://github.com/bitcoin/bitcoin/pull/24132) | No | -### Networking -| Dependency | Releases | Version used | Minimum required | Runtime | -| --- | --- | --- | --- | --- | -| [MiniUPnPc](../depends/packages/miniupnpc.mk) | [link](https://miniupnp.tuxfamily.org/) | [2.2.7](https://github.com/bitcoin/bitcoin/pull/29707) | 2.1 | No | - ### Notifications | Dependency | Releases | Version used | Minimum required | Runtime | | --- | --- | --- | --- | --- | diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 952dbc7..37e594e 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -369,18 +369,18 @@ If you have ccache enabled, absolute paths are stripped from debug information with the `-fdebug-prefix-map` and `-fmacro-prefix-map` options (if supported by the compiler). This might break source file detection in case you move binaries after compilation, debug from the directory other than the project root or use -an IDE that only supports absolute paths for debugging. +an IDE that only supports absolute paths for debugging (e.g. it won't stop at breakpoints). There are a few possible fixes: 1. Configure source file mapping. -For `gdb` create or append to `.gdbinit` file: +For `gdb` create or append to [`.gdbinit` file](https://sourceware.org/gdb/current/onlinedocs/gdb#gdbinit-man): ``` set substitute-path ./src /path/to/project/root/src ``` -For `lldb` create or append to `.lldbinit` file: +For `lldb` create or append to [`.lldbinit` file](https://lldb.llvm.org/man/lldb.html#configuration-files): ``` settings set target.source-map ./src /path/to/project/root/src ``` @@ -392,6 +392,8 @@ ln -s /path/to/project/root/src src 3. Use `debugedit` to modify debug information in the binary. +4. If your IDE has an option for this, change your breakpoints to use the file name only. + ### `debug.log` If the code is behaving strangely, take a look in the `debug.log` file in the data directory; @@ -957,7 +959,7 @@ Strings and formatting - *Rationale*: Qt has built-in functionality for converting their string type from/to C++. No need to roll your own. - - In cases where do you call `.c_str()`, you might want to additionally check that the string does not contain embedded '\0' characters, because + - In cases where you do call `.c_str()`, you might want to additionally check that the string does not contain embedded '\0' characters, because it will (necessarily) truncate the string. This might be used to hide parts of the string from logging or to circumvent checks. If a use of strings is sensitive to this, take care to check the string for embedded NULL characters first and reject it if there are any (see `ParsePrechecks` in `strencodings.cpp` for an example). @@ -1397,6 +1399,12 @@ A few guidelines for introducing and reviewing new RPC interfaces: to a multi-value, or due to other historical reasons. **Always** have false map to 0 and true to 1 in this case. +- For new RPC methods, if implementing a `verbosity` argument, use integer verbosity rather than boolean. + Disallow usage of boolean verbosity (see `ParseVerbosity()` in [util.h](/src/rpc/util.h)). + + - *Rationale*: Integer verbosity allows for multiple values. Undocumented boolean verbosity is deprecated + and new RPC methods should prevent its use. + - Don't forget to fill in the argument names correctly in the RPC command table. - *Rationale*: If not, the call cannot be used with name-based arguments. diff --git a/doc/offline-signing-tutorial.md b/doc/offline-signing-tutorial.md index e03a000..8ec4355 100644 --- a/doc/offline-signing-tutorial.md +++ b/doc/offline-signing-tutorial.md @@ -60,7 +60,8 @@ The `watch_only_wallet` wallet will be used to track and validate incoming trans ```sh [online]$ ./build/src/bitcoin-cli -signet -named createwallet \ wallet_name="watch_only_wallet" \ - disable_private_keys=true + disable_private_keys=true \ + blank=true { "name": "watch_only_wallet" diff --git a/doc/policy/mempool-replacements.md b/doc/policy/mempool-replacements.md index f044a0f..eb37067 100644 --- a/doc/policy/mempool-replacements.md +++ b/doc/policy/mempool-replacements.md @@ -10,12 +10,7 @@ A transaction ("replacement transaction") may replace its directly conflicting t their in-mempool descendants (together, "original transactions") if, in addition to passing all other consensus and policy rules, each of the following conditions are met: -1. If `-mempoolfullrbf=0` (the value is 1 by default), the directly conflicting transactions all signal replaceability explicitly. A transaction is - signaling BIP125 replaceability if any of its inputs have an nSequence number less than (0xffffffff - 1). - A transaction also signals replaceability if its version field is set to 3. - - *Rationale*: See [BIP125 - explanation](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki#motivation). +1. (Removed) 2. The replacement transaction only include an unconfirmed input if that input was included in one of the directly conflicting transactions. An unconfirmed input spends an output from a @@ -80,3 +75,5 @@ This set of rules is similar but distinct from BIP125. #25353](https://github.com/bitcoin/bitcoin/pull/25353)). * Full replace-by-fee is the default policy as of **v28.0** ([PR #30493](https://github.com/bitcoin/bitcoin/pull/30493)). + +* Signaling for replace-by-fee is no longer required as of [PR 30592](https://github.com/bitcoin/bitcoin/pull/30592). diff --git a/doc/policy/packages.md b/doc/policy/packages.md index b432008..ff25394 100644 --- a/doc/policy/packages.md +++ b/doc/policy/packages.md @@ -38,8 +38,6 @@ The following rules are enforced for all packages: * Only limited package replacements are currently considered. (#28984) - - If `-mempoolfullrbf=0` (the value is 1 by default), all direct conflicts must signal replacement. - - Packages are 1-parent-1-child, with no in-mempool ancestors of the package. - All conflicting clusters (connected components of mempool transactions) must be clusters of up to size 2. diff --git a/doc/psbt.md b/doc/psbt.md index 0f31cb8..e555718 100644 --- a/doc/psbt.md +++ b/doc/psbt.md @@ -67,6 +67,10 @@ hardware implementations will typically implement multiple roles simultaneously. input a PSBT, adds UTXO, key, and script data to inputs and outputs that miss it, and optionally signs inputs. Where possible it also finalizes the partial signatures. +- **`descriptorprocesspsbt` (Updater, Signer, Finalizer)** is a node RPC that takes + as input a PSBT and a list of descriptors. It updates SegWit inputs with + information available from the UTXO set and the mempool and signs the inputs using + the provided descriptors. Where possible it also finalizes the partial signatures. - **`utxoupdatepsbt` (Updater)** is a node RPC that takes a PSBT and updates it to include information available from the UTXO set (works only for SegWit inputs). diff --git a/doc/release-notes-30239.md b/doc/release-notes-30239.md new file mode 100644 index 0000000..9380bdd --- /dev/null +++ b/doc/release-notes-30239.md @@ -0,0 +1,12 @@ +P2P and network changes +----------------------- + +Ephemeral dust is a new concept that allows a single +dust output in a transaction, provided the transaction +is zero fee. In order to spend any unconfirmed outputs +from this transaction, the spender must also spend +this dust in addition to any other outputs. + +In other words, this type of transaction +should be created in a transaction package where +the dust is both created and spent simultaneously. diff --git a/doc/release-notes-30592.md b/doc/release-notes-30592.md new file mode 100644 index 0000000..a3c1a80 --- /dev/null +++ b/doc/release-notes-30592.md @@ -0,0 +1,7 @@ +Full Replace-By-Fee +=================== + +Starting with v28.0, the `mempoolfullrbf` startup option was set to +default to `1`. With widespread adoption of this policy, users no longer +benefit from disabling it, so the option has been removed, making full +replace-by-fee the standard behavior. (#30592) diff --git a/doc/release-notes-31130.md b/doc/release-notes-31130.md new file mode 100644 index 0000000..d8cb46c --- /dev/null +++ b/doc/release-notes-31130.md @@ -0,0 +1,10 @@ +P2P and network changes +----------------------- + +Support for UPnP was dropped. If you want to open a port automatically, consider using the `-natpmp` +option instead, which uses PCP or NAT-PMP depending on router support. + +Updated settings +------ + +- Setting `-upnp` will now return an error. Consider using `-natpmp` instead. diff --git a/doc/release-notes-31156.md b/doc/release-notes-31156.md new file mode 100644 index 0000000..c61cfc0 --- /dev/null +++ b/doc/release-notes-31156.md @@ -0,0 +1,4 @@ +Test +------ + +The BIP94 timewarp attack mitigation (designed for testnet4) is no longer active on the regtest network. (#31156) diff --git a/doc/release-notes/release-notes-27.2.md b/doc/release-notes/release-notes-27.2.md new file mode 100644 index 0000000..85bf57c --- /dev/null +++ b/doc/release-notes/release-notes-27.2.md @@ -0,0 +1,92 @@ +27.2 Release Notes +===================== + +Bitcoin Core version 27.2 is now available from: + + + +This release includes various bug fixes and performance +improvements, as well as updated translations. + +Please report bugs using the issue tracker at GitHub: + + + +To receive security and update notifications, please subscribe to: + + + +How to Upgrade +============== + +If you are running an older version, shut it down. Wait until it has completely +shut down (which might take a few minutes in some cases), then run the +installer (on Windows) or just copy over `/Applications/Bitcoin-Qt` (on macOS) +or `bitcoind`/`bitcoin-qt` (on Linux). + +Upgrading directly from a version of Bitcoin Core that has reached its EOL is +possible, but it might take some time if the data directory needs to be migrated. Old +wallet versions of Bitcoin Core are generally supported. + +Compatibility +============== + +Bitcoin Core is supported and extensively tested on operating systems +using the Linux Kernel 3.17+, macOS 11.0+, and Windows 7 and newer. Bitcoin +Core should also work on most other Unix-like systems but is not as +frequently tested on them. It is not recommended to use Bitcoin Core on +unsupported systems. + +Notable changes +=============== + +### P2P + +- #30394 net: fix race condition in self-connect detection + +### Init + +- #30435 init: change shutdown order of load block thread and scheduler + +### RPC + +- #30357 Fix cases of calls to FillPSBT errantly returning complete=true + +### PSBT + +- #29855 psbt: Check non witness utxo outpoint early + +### Test + +- #30552 test: fix constructor of msg_tx + +### Doc + +- #30504 doc: use proper doxygen formatting for CTxMemPool::cs + +### Build + +- #30283 upnp: fix build with miniupnpc 2.2.8 +- #30633 Fixes for GCC 15 compatibility + +### CI + +- #30193 ci: move ASan job to GitHub Actions from Cirrus CI +- #30299 ci: remove unused bcc variable from workflow + +Credits +======= + +Thanks to everyone who directly contributed to this release: + +- Ava Chow +- Cory Fields +- Martin Zumsande +- Matt Whitlock +- Max Edwards +- Sebastian Falbesoner +- Vasil Dimov +- willcl-ark + +As well as to everyone that helped with translations on +[Transifex](https://www.transifex.com/bitcoin/bitcoin/). diff --git a/doc/release-process.md b/doc/release-process.md index aeaed8d..3769991 100644 --- a/doc/release-process.md +++ b/doc/release-process.md @@ -6,8 +6,8 @@ Release Process ### Before every release candidate * Update release candidate version in `CMakeLists.txt` (`CLIENT_VERSION_RC`). -* Update manpages (after rebuilding the binaries), see [gen-manpages.py](https://github.com/bitcoin/bitcoin/blob/master/contrib/devtools/README.md#gen-manpagespy). -* Update bitcoin.conf and commit changes if they exist, see [gen-bitcoin-conf.sh](https://github.com/bitcoin/bitcoin/blob/master/contrib/devtools/README.md#gen-bitcoin-confsh). +* Update manpages (after rebuilding the binaries), see [gen-manpages.py](/contrib/devtools/README.md#gen-manpagespy). +* Update bitcoin.conf and commit changes if they exist, see [gen-bitcoin-conf.sh](/contrib/devtools/README.md#gen-bitcoin-confsh). ### Before every major and minor release @@ -28,7 +28,7 @@ Release Process #### Before branch-off -* Update translations see [translation_process.md](https://github.com/bitcoin/bitcoin/blob/master/doc/translation_process.md#synchronising-translations). +* Update translations see [translation_process.md](/doc/translation_process.md#synchronising-translations). * Update hardcoded [seeds](/contrib/seeds/README.md), see [this pull request](https://github.com/bitcoin/bitcoin/pull/27488) for an example. * Update the following variables in [`src/kernel/chainparams.cpp`](/src/kernel/chainparams.cpp) for mainnet, testnet, and signet: - `m_assumed_blockchain_size` and `m_assumed_chain_state_size` with the current size plus some overhead (see diff --git a/doc/tor.md b/doc/tor.md index 9560dc2..30c2381 100644 --- a/doc/tor.md +++ b/doc/tor.md @@ -200,7 +200,7 @@ as well, use `discover` instead: ./bitcoind ... -discover -and open port 8333 on your firewall (or use port mapping, i.e., `-upnp` or `-natpmp`). +and open port 8333 on your firewall (or use port mapping, i.e., `-natpmp`). If you only want to use Tor to reach .onion addresses, but not use it as a proxy for normal IPv4/IPv6 communication, use: diff --git a/doc/tracing.md b/doc/tracing.md index c12af12..5b9369f 100644 --- a/doc/tracing.md +++ b/doc/tracing.md @@ -265,42 +265,52 @@ Arguments passed: ## Adding tracepoints to Bitcoin Core -To add a new tracepoint, `#include ` in the compilation unit where -the tracepoint is inserted. Use one of the `TRACEx` macros listed below -depending on the number of arguments passed to the tracepoint. Up to 12 -arguments can be provided. The `context` and `event` specify the names by which -the tracepoint is referred to. Please use `snake_case` and try to make sure that -the tracepoint names make sense even without detailed knowledge of the -implementation details. Do not forget to update the tracepoint list in this -document. - -```c -#define TRACE(context, event) -#define TRACE1(context, event, a) -#define TRACE2(context, event, a, b) -#define TRACE3(context, event, a, b, c) -#define TRACE4(context, event, a, b, c, d) -#define TRACE5(context, event, a, b, c, d, e) -#define TRACE6(context, event, a, b, c, d, e, f) -#define TRACE7(context, event, a, b, c, d, e, f, g) -#define TRACE8(context, event, a, b, c, d, e, f, g, h) -#define TRACE9(context, event, a, b, c, d, e, f, g, h, i) -#define TRACE10(context, event, a, b, c, d, e, f, g, h, i, j) -#define TRACE11(context, event, a, b, c, d, e, f, g, h, i, j, k) -#define TRACE12(context, event, a, b, c, d, e, f, g, h, i, j, k, l) -``` +Use the `TRACEPOINT` macro to add a new tracepoint. If not yet included, include +`util/trace.h` (defines the tracepoint macros) with `#include `. +Each tracepoint needs a `context` and an `event`. Please use `snake_case` and +try to make sure that the tracepoint names make sense even without detailed +knowledge of the implementation details. You can pass zero to twelve arguments +to the tracepoint. Each tracepoint also needs a global semaphore. The semaphore +gates the tracepoint arguments from being processed if we are not attached to +the tracepoint. Add a `TRACEPOINT_SEMAPHORE(context, event)` with the `context` +and `event` of your tracepoint in the top-level namespace at the beginning of +the file. Do not forget to update the tracepoint list in this document. + +For example, the `net:outbound_message` tracepoint in `src/net.cpp` with six +arguments. -For example: +```C++ +// src/net.cpp +TRACEPOINT_SEMAPHORE(net, outbound_message); +… +void CConnman::PushMessage(…) { + … + TRACEPOINT(net, outbound_message, + pnode->GetId(), + pnode->m_addr_name.c_str(), + pnode->ConnectionTypeAsString().c_str(), + sanitizedType.c_str(), + msg.data.size(), + msg.data.data() + ); + … +} +``` +If needed, an extra `if (TRACEPOINT_ACTIVE(context, event)) {...}` check can be +used to prepare somewhat expensive arguments right before the tracepoint. While +the tracepoint arguments are only prepared when we attach something to the +tracepoint, an argument preparation should never hang the process. Hashing and +serialization of data structures is probably fine, a `sleep(10s)` not. ```C++ -TRACE6(net, inbound_message, - pnode->GetId(), - pnode->m_addr_name.c_str(), - pnode->ConnectionTypeAsString().c_str(), - sanitizedType.c_str(), - msg.data.size(), - msg.data.data() -); +// An example tracepoint with an expensive argument. + +TRACEPOINT_SEMAPHORE(example, gated_expensive_argument); +… +if (TRACEPOINT_ACTIVE(example, gated_expensive_argument)) { + expensive_argument = expensive_calulation(); + TRACEPOINT(example, gated_expensive_argument, expensive_argument); +} ``` ### Guidelines and best practices @@ -318,12 +328,6 @@ the tracepoint. See existing examples in [contrib/tracing/]. [contrib/tracing/]: ../contrib/tracing/ -#### No expensive computations for tracepoints -Data passed to the tracepoint should be inexpensive to compute. Although the -tracepoint itself only has overhead when enabled, the code to compute arguments -is always run - even if the tracepoint is not used. For example, avoid -serialization and parsing. - #### Semi-stable API Tracepoints should have a semi-stable API. Users should be able to rely on the tracepoints for scripting. This means tracepoints need to be documented, and the @@ -347,7 +351,7 @@ first six argument fields. Binary data can be placed in later arguments. The BCC supports reading from all 12 arguments. #### Strings as C-style String -Generally, strings should be passed into the `TRACEx` macros as pointers to +Generally, strings should be passed into the `TRACEPOINT` macros as pointers to C-style strings (a null-terminated sequence of characters). For C++ `std::strings`, [`c_str()`] can be used. It's recommended to document the maximum expected string size if known. @@ -370,9 +374,9 @@ $ gdb ./build/src/bitcoind … (gdb) info probes Type Provider Name Where Semaphore Object -stap net inbound_message 0x000000000014419e /build/src/bitcoind -stap net outbound_message 0x0000000000107c05 /build/src/bitcoind -stap validation block_connected 0x00000000002fb10c /build/src/bitcoind +stap net inbound_message 0x000000000014419e 0x0000000000d29bd2 /build/src/bitcoind +stap net outbound_message 0x0000000000107c05 0x0000000000d29bd0 /build/src/bitcoind +stap validation block_connected 0x00000000002fb10c 0x0000000000d29bd8 /build/src/bitcoind … ``` @@ -388,7 +392,7 @@ Displaying notes found in: .note.stapsdt stapsdt 0x0000005d NT_STAPSDT (SystemTap probe descriptors) Provider: net Name: outbound_message - Location: 0x0000000000107c05, Base: 0x0000000000579c90, Semaphore: 0x0000000000000000 + Location: 0x0000000000107c05, Base: 0x0000000000579c90, Semaphore: 0x0000000000d29bd0 Arguments: -8@%r12 8@%rbx 8@%rdi 8@192(%rsp) 8@%rax 8@%rdx … ``` @@ -407,7 +411,7 @@ between distributions. For example, on ``` $ tplist -l ./build/src/bitcoind -v -b'net':b'outbound_message' [sema 0x0] +b'net':b'outbound_message' [sema 0xd29bd0] 1 location(s) 6 argument(s) … diff --git a/libbitcoinkernel.pc.in b/libbitcoinkernel.pc.in index a2cb7d3..b8f9331 100644 --- a/libbitcoinkernel.pc.in +++ b/libbitcoinkernel.pc.in @@ -3,9 +3,9 @@ exec_prefix=${prefix} libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ -Name: @PACKAGE_NAME@ kernel library +Name: @CLIENT_NAME@ kernel library Description: Experimental library for the Bitcoin Core validation engine. -Version: @PACKAGE_VERSION@ +Version: @CLIENT_VERSION_STRING@ Libs: -L${libdir} -lbitcoinkernel Libs.private: -L${libdir} @LIBS_PRIVATE@ Cflags: -I${includedir} diff --git a/share/setup.nsi.in b/share/setup.nsi.in index f22e256..d1a85cd 100644 --- a/share/setup.nsi.in +++ b/share/setup.nsi.in @@ -1,4 +1,4 @@ -Name "@PACKAGE_NAME@ (64-bit)" +Name "@CLIENT_NAME@ (64-bit)" RequestExecutionLevel highest SetCompressor /SOLID lzma @@ -11,8 +11,8 @@ Unicode true # General Symbol Definitions !define REGKEY "SOFTWARE\$(^Name)" -!define COMPANY "@PACKAGE_NAME@ project" -!define URL @PACKAGE_URL@ +!define COMPANY "@CLIENT_NAME@ project" +!define URL @CLIENT_URL@ # MUI Symbol Definitions !define MUI_ICON "@abs_top_srcdir@/share/pixmaps/bitcoin.ico" @@ -24,7 +24,7 @@ Unicode true !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM !define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY} !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup -!define MUI_STARTMENUPAGE_DEFAULTFOLDER "@PACKAGE_NAME@" +!define MUI_STARTMENUPAGE_DEFAULTFOLDER "@CLIENT_NAME@" !define MUI_FINISHPAGE_RUN "$WINDIR\explorer.exe" !define MUI_FINISHPAGE_RUN_PARAMETERS $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@ !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" @@ -58,12 +58,12 @@ XPStyle on BrandingText " " ShowInstDetails show VIProductVersion @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_BUILD@.0 -VIAddVersionKey ProductName "@PACKAGE_NAME@" -VIAddVersionKey ProductVersion "@PACKAGE_VERSION@" +VIAddVersionKey ProductName "@CLIENT_NAME@" +VIAddVersionKey ProductVersion "@CLIENT_VERSION_STRING@" VIAddVersionKey CompanyName "${COMPANY}" VIAddVersionKey CompanyWebsite "${URL}" -VIAddVersionKey FileVersion "@PACKAGE_VERSION@" -VIAddVersionKey FileDescription "Installer for @PACKAGE_NAME@" +VIAddVersionKey FileVersion "@CLIENT_VERSION_STRING@" +VIAddVersionKey FileDescription "Installer for @CLIENT_NAME@" VIAddVersionKey LegalCopyright "Copyright (C) 2009-@COPYRIGHT_YEAR@ @COPYRIGHT_HOLDERS_FINAL@" InstallDirRegKey HKCU "${REGKEY}" Path ShowUninstDetails show @@ -95,23 +95,23 @@ Section -post SEC0001 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application CreateDirectory $SMPROGRAMS\$StartMenuGroup CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@ - CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (testnet).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-testnet" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 1 - CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (test signet).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-signet" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 2 - CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (testnet4).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-testnet4" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 3 + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (testnet).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-testnet" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 1 + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (test signet).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-signet" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 2 + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (testnet4).lnk" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "-testnet4" "$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" 3 CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe !insertmacro MUI_STARTMENU_WRITE_END WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)" - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "@PACKAGE_VERSION@" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "@CLIENT_VERSION_STRING@" WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}" WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}" WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\bitcoin-qt.exe WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1 WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1 - WriteRegStr HKCR "@PACKAGE_TARNAME@" "URL Protocol" "" - WriteRegStr HKCR "@PACKAGE_TARNAME@" "" "URL:Bitcoin" - WriteRegStr HKCR "@PACKAGE_TARNAME@\DefaultIcon" "" $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@ - WriteRegStr HKCR "@PACKAGE_TARNAME@\shell\open\command" "" '"$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "%1"' + WriteRegStr HKCR "@CLIENT_TARNAME@" "URL Protocol" "" + WriteRegStr HKCR "@CLIENT_TARNAME@" "" "URL:Bitcoin" + WriteRegStr HKCR "@CLIENT_TARNAME@\DefaultIcon" "" $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@ + WriteRegStr HKCR "@CLIENT_TARNAME@\shell\open\command" "" '"$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "%1"' SectionEnd # Macro for selecting uninstaller sections @@ -142,9 +142,9 @@ Section -un.post UNSEC0001 DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" - Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (testnet).lnk" - Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (testnet4).lnk" - Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@PACKAGE_NAME@ (test signet).lnk" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (testnet).lnk" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (testnet4).lnk" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@CLIENT_NAME@ (test signet).lnk" Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk" Delete /REBOOTOK $INSTDIR\uninstall.exe Delete /REBOOTOK $INSTDIR\debug.log @@ -153,7 +153,7 @@ Section -un.post UNSEC0001 DeleteRegValue HKCU "${REGKEY}" Path DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components" DeleteRegKey /IfEmpty HKCU "${REGKEY}" - DeleteRegKey HKCR "@PACKAGE_TARNAME@" + DeleteRegKey HKCR "@CLIENT_TARNAME@" RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup RmDir /REBOOTOK $INSTDIR Push $R0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9de66f2..544c8fe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,6 +38,7 @@ message("Configuring secp256k1 subtree...") set(SECP256K1_DISABLE_SHARED ON CACHE BOOL "" FORCE) set(SECP256K1_ENABLE_MODULE_ECDH OFF CACHE BOOL "" FORCE) set(SECP256K1_ENABLE_MODULE_RECOVERY ON CACHE BOOL "" FORCE) +set(SECP256K1_ENABLE_MODULE_MUSIG OFF CACHE BOOL "" FORCE) set(SECP256K1_BUILD_BENCHMARK OFF CACHE BOOL "" FORCE) set(SECP256K1_BUILD_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE) set(SECP256K1_BUILD_EXHAUSTIVE_TESTS ${BUILD_TESTS} CACHE BOOL "" FORCE) @@ -246,10 +247,12 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL node/psbt.cpp node/timeoffsets.cpp node/transaction.cpp + node/txdownloadman_impl.cpp node/txreconciliation.cpp node/utxo_snapshot.cpp node/warnings.cpp noui.cpp + policy/ephemeral_policy.cpp policy/fees.cpp policy/fees_args.cpp policy/packages.cpp @@ -288,14 +291,14 @@ target_link_libraries(bitcoin_node core_interface bitcoin_common bitcoin_util + $ leveldb minisketch univalue Boost::headers - $ + libevent::core + libevent::extra $ - $ - $ $ ) @@ -365,7 +368,8 @@ if(BUILD_CLI) bitcoin_cli bitcoin_common bitcoin_util - $ + libevent::core + libevent::extra ) list(APPEND installable_targets bitcoin-cli) endif() diff --git a/src/addrdb.cpp b/src/addrdb.cpp index 4637906..889f7b3 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -150,7 +150,7 @@ bool CBanDB::Write(const banmap_t& banSet) bool CBanDB::Read(banmap_t& banSet) { if (fs::exists(m_banlist_dat)) { - LogPrintf("banlist.dat ignored because it can only be read by " PACKAGE_NAME " version 22.x. Remove %s to silence this warning.\n", fs::quoted(fs::PathToString(m_banlist_dat))); + LogPrintf("banlist.dat ignored because it can only be read by " CLIENT_NAME " version 22.x. Remove %s to silence this warning.\n", fs::quoted(fs::PathToString(m_banlist_dat))); } // If the JSON banlist does not exist, then recreate it if (!fs::exists(m_banlist_json)) { @@ -215,7 +215,7 @@ util::Result> LoadAddrman(const NetGroupManager& netgro DumpPeerAddresses(args, *addrman); } catch (const std::exception& e) { return util::Error{strprintf(_("Invalid or corrupt peers.dat (%s). If you believe this is a bug, please report it to %s. As a workaround, you can move the file (%s) out of the way (rename, move, or delete) to have a new one created on the next start."), - e.what(), PACKAGE_BUGREPORT, fs::quoted(fs::PathToString(path_addr)))}; + e.what(), CLIENT_BUGREPORT, fs::quoted(fs::PathToString(path_addr)))}; } return addrman; } diff --git a/src/addrman.cpp b/src/addrman.cpp index 358d4fc..9c3a24d 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -253,7 +253,7 @@ void AddrManImpl::Unserialize(Stream& s_) throw InvalidAddrManVersionError(strprintf( "Unsupported format of addrman database: %u. It is compatible with formats >=%u, " "but the maximum supported by this version of %s is %u.", - uint8_t{format}, lowest_compatible, PACKAGE_NAME, uint8_t{FILE_FORMAT})); + uint8_t{format}, lowest_compatible, CLIENT_NAME, uint8_t{FILE_FORMAT})); } s >> nKey; @@ -812,9 +812,11 @@ nid_type AddrManImpl::GetEntry(bool use_tried, size_t bucket, size_t position) c std::vector AddrManImpl::GetAddr_(size_t max_addresses, size_t max_pct, std::optional network, const bool filtered) const { AssertLockHeld(cs); + Assume(max_pct <= 100); size_t nNodes = vRandom.size(); if (max_pct != 0) { + max_pct = std::min(max_pct, size_t{100}); nNodes = max_pct * nNodes / 100; } if (max_addresses != 0) { @@ -824,6 +826,7 @@ std::vector AddrManImpl::GetAddr_(size_t max_addresses, size_t max_pct // gather a list of random nodes, skipping those of low quality const auto now{Now()}; std::vector addresses; + addresses.reserve(nNodes); for (unsigned int n = 0; n < vRandom.size(); n++) { if (addresses.size() >= nNodes) break; diff --git a/src/addrman.h b/src/addrman.h index ba6e13b..2ddf146 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -166,7 +166,7 @@ class AddrMan * Return all or many randomly selected addresses, optionally by network. * * @param[in] max_addresses Maximum number of addresses to return (0 = all). - * @param[in] max_pct Maximum percentage of addresses to return (0 = all). + * @param[in] max_pct Maximum percentage of addresses to return (0 = all). Value must be from 0 to 100. * @param[in] network Select only addresses of this network (nullopt = all). * @param[in] filtered Select only addresses that are considered good quality (false = all). * diff --git a/src/bench/CMakeLists.txt b/src/bench/CMakeLists.txt index 8a52980..4589ef1 100644 --- a/src/bench/CMakeLists.txt +++ b/src/bench/CMakeLists.txt @@ -34,6 +34,7 @@ add_executable(bench_bitcoin load_external.cpp lockedpool.cpp logging.cpp + mempool_ephemeral_spends.cpp mempool_eviction.cpp mempool_stress.cpp merkle_root.cpp @@ -71,6 +72,7 @@ if(ENABLE_WALLET) wallet_create_tx.cpp wallet_loading.cpp wallet_ismine.cpp + wallet_migration.cpp ) target_link_libraries(bench_bitcoin bitcoin_wallet) endif() diff --git a/src/bench/bench.cpp b/src/bench/bench.cpp index a2dbb11..26daff5 100644 --- a/src/bench/bench.cpp +++ b/src/bench/bench.cpp @@ -27,9 +27,26 @@ using util::Join; const std::function G_TEST_LOG_FUN{}; -const std::function()> G_TEST_COMMAND_LINE_ARGUMENTS{}; +/** + * Retrieves the available test setup command line arguments that may be used + * in the benchmark. They will be used only if the benchmark utilizes a + * 'BasicTestingSetup' or any child of it. + */ +static std::function()> g_bench_command_line_args{}; +const std::function()> G_TEST_COMMAND_LINE_ARGUMENTS = []() { + return g_bench_command_line_args(); +}; -const std::function G_TEST_GET_FULL_NAME{}; +/** + * Retrieve the name of the currently in-use benchmark. + * This is applicable only to benchmarks that utilize the unit test + * framework context setup (e.g. ones using 'MakeNoLogFileContext()'). + * It places the datadir of each benchmark run within their respective benchmark name. + */ +static std::string g_running_benchmark_name; +const std::function G_TEST_GET_FULL_NAME = []() { + return g_running_benchmark_name; +}; namespace { @@ -94,6 +111,14 @@ void BenchRunner::RunAll(const Args& args) std::cout << "Running with -sanity-check option, output is being suppressed as benchmark results will be useless." << std::endl; } + // Load inner test setup args + g_bench_command_line_args = [&args]() { + std::vector ret; + ret.reserve(args.setup_args.size()); + for (const auto& arg : args.setup_args) ret.emplace_back(arg.c_str()); + return ret; + }; + std::vector benchmarkResults; for (const auto& [name, bench_func] : benchmarks()) { const auto& [func, priority_level] = bench_func; @@ -117,6 +142,7 @@ void BenchRunner::RunAll(const Args& args) bench.output(nullptr); } bench.name(name); + g_running_benchmark_name = name; if (args.min_time > 0ms) { // convert to nanos before dividing to reduce rounding errors std::chrono::nanoseconds min_time_ns = args.min_time; diff --git a/src/bench/bench.h b/src/bench/bench.h index f0705f4..2df203c 100644 --- a/src/bench/bench.h +++ b/src/bench/bench.h @@ -61,6 +61,7 @@ struct Args { fs::path output_json; std::string regex_filter; uint8_t priority; + std::vector setup_args; }; class BenchRunner diff --git a/src/bench/bench_bitcoin.cpp b/src/bench/bench_bitcoin.cpp index 555dca7..88afe68 100644 --- a/src/bench/bench_bitcoin.cpp +++ b/src/bench/bench_bitcoin.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -27,6 +28,7 @@ static const std::string DEFAULT_PRIORITY{"all"}; static void SetupBenchArgs(ArgsManager& argsman) { SetupHelpOptions(argsman); + SetupCommonTestArgs(argsman); argsman.AddArg("-asymptote=", "Test asymptotic growth of the runtime of an algorithm, if supported by the benchmark", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-filter=", strprintf("Regular expression filter to select benchmark by name (default: %s)", DEFAULT_BENCH_FILTER), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); @@ -60,6 +62,18 @@ static uint8_t parsePriorityLevel(const std::string& str) { return levels; } +static std::vector parseTestSetupArgs(const ArgsManager& argsman) +{ + // Parses unit test framework arguments supported by the benchmark framework. + std::vector args; + static std::vector AVAILABLE_ARGS = {"-testdatadir"}; + for (const std::string& arg_name : AVAILABLE_ARGS) { + auto op_arg = argsman.GetArg(arg_name); + if (op_arg) args.emplace_back(strprintf("%s=%s", arg_name, *op_arg)); + } + return args; +} + int main(int argc, char** argv) { ArgsManager argsman; @@ -131,6 +145,7 @@ int main(int argc, char** argv) args.regex_filter = argsman.GetArg("-filter", DEFAULT_BENCH_FILTER); args.sanity_check = argsman.GetBoolArg("-sanity-check", false); args.priority = parsePriorityLevel(argsman.GetArg("-priority-level", DEFAULT_PRIORITY)); + args.setup_args = parseTestSetupArgs(argsman); benchmark::BenchRunner::RunAll(args); diff --git a/src/bench/mempool_ephemeral_spends.cpp b/src/bench/mempool_ephemeral_spends.cpp new file mode 100644 index 0000000..e867c61 --- /dev/null +++ b/src/bench/mempool_ephemeral_spends.cpp @@ -0,0 +1,83 @@ +// Copyright (c) 2011-2022 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include +#include +#include +#include +#include +#include +#include