From 1e69f8ec22b86d19dbb9cdab3b6c8979e8625243 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Wed, 11 Jan 2023 18:18:10 -0500 Subject: [PATCH 01/10] Merge bitcoin/bitcoin#26675: wallet: For feebump, ignore abandoned descendant spends f9ce0eadf4eb58d1e2207c27fabe69a5642482e7 For feebump, ignore abandoned descendant spends (John Moffett) Pull request description: Closes #26667 To be eligible for fee-bumping, a transaction must not have any of its outputs (eg - change) spent in other unconfirmed transactions in the wallet. This behavior is currently [enforced](https://github.com/bitcoin/bitcoin/blob/9e229a542ff2107be43eff2e4b992841367f0366/src/wallet/feebumper.cpp#L25-L28) and [tested](https://github.com/bitcoin/bitcoin/blob/9e229a542ff2107be43eff2e4b992841367f0366/test/functional/wallet_bumpfee.py#L270-L286). However, this check shouldn't apply to spends in abandoned descendant transactions, as explained by #26667. `CWallet::IsSpent` already carves out an exception for abandoned transactions, so we can just use that. I've also added a new test to cover this case. ACKs for top commit: Sjors: re-utACK f9ce0eadf4eb58d1e2207c27fabe69a5642482e7 achow101: ACK f9ce0eadf4eb58d1e2207c27fabe69a5642482e7 furszy: ACK f9ce0ead Tree-SHA512: 19d957d1cf6747668bb114e27a305027bfca5a9bed2b1d9cc9e1b0bd4666486c7c4b60b045a7fe677eb9734d746f5de76390781fb1e9e0bceb4a46d20acd1749 --- src/wallet/wallet.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a2de0adf5ecf..c86807f4f5ca 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -596,8 +596,7 @@ bool CWallet::HasWalletSpend(const CTransactionRef& tx) const AssertLockHeld(cs_wallet); const uint256& txid = tx->GetHash(); for (unsigned int i = 0; i < tx->vout.size(); ++i) { - auto iter = mapTxSpends.find(COutPoint(txid, i)); - if (iter != mapTxSpends.end()) { + if (IsSpent(COutPoint(txid, i))) { return true; } } From 931f6eb216761f270438f5c376dc07a78021aa08 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Thu, 13 Oct 2022 10:53:41 -0400 Subject: [PATCH 02/10] Merge bitcoin/bitcoin#26109: rpc, doc: getpeerinfo updates BACKPORT NOTE: bitcoin-cli.cpp is not changed due to bitcoin/bitcoin#26328 a3789c700b5a43efd4b366b4241ae840d63f2349 Improve getpeerinfo pingtime, minping, and pingwait help docs (Jon Atack) df660ddb1cce1ee330346fe1728d868f41ad0256 Update getpeerinfo/-netinfo/TxRelay#m_relay_txs relaytxes docs (for v24 backport) (Jon Atack) 1f448542e79452a48f93f53ebbcb3b6df45aeef0 Always return getpeerinfo "minfeefilter" field (for v24 backport) (Jon Atack) 9cd6682545e845277d2207654250d1ed78d0c695 Make getpeerinfo field order consistent with its help (for v24 backport) (Jon Atack) Pull request description: Various updates and fixups, mostly targeting v24. Please refer to the commit messages for details. ACKs for top commit: achow101: ACK a3789c700b5a43efd4b366b4241ae840d63f2349 brunoerg: ACK a3789c700b5a43efd4b366b4241ae840d63f2349 vasild: ACK a3789c700b5a43efd4b366b4241ae840d63f2349 Tree-SHA512: b8586a9b83c1b18786b5ac1fc1dba91573c13225fc2cfc8d078f4220967c95056354f6be13327f33b4fcf3e9d5310fa4e1bdc93102cbd6574f956698993a54bf --- src/net_processing.cpp | 16 ++++++---------- src/rpc/net.cpp | 12 +++++++----- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 9808fb9f646a..1b61cf1e7cab 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -285,12 +285,7 @@ struct Peer { struct TxRelay { mutable RecursiveMutex m_bloom_filter_mutex; - /** Whether the peer wishes to receive transaction announcements. - * - * This is initially set based on the fRelay flag in the received - * `version` message. If initially set to false, it can only be flipped - * to true if we have offered the peer NODE_BLOOM services and it sends - * us a `filterload` or `filterclear` message. See BIP37. */ + /** Whether we relay transactions to this peer. */ bool m_relay_txs GUARDED_BY(m_bloom_filter_mutex){false}; /** A bloom filter for which transactions to announce to the peer. See BIP37. */ std::unique_ptr m_bloom_filter PT_GUARDED_BY(m_bloom_filter_mutex) GUARDED_BY(m_bloom_filter_mutex){nullptr}; @@ -3817,11 +3812,12 @@ void PeerManagerImpl::ProcessMessage( } peer->m_starting_height = starting_height; - // We only initialize the m_tx_relay data structure if: - // - this isn't an outbound block-relay-only connection; and + // We only initialize the Peer::TxRelay m_relay_txs data structure if: + // - this isn't an outbound block-relay-only connection, and // - this isn't an outbound feeler connection, and - // - fRelay=true or we're offering NODE_BLOOM to this peer - // (NODE_BLOOM means that the peer may turn on tx relay later) + // - fRelay=true (the peer wishes to receive transaction announcements) + // or we're offering NODE_BLOOM to this peer. NODE_BLOOM means that + // the peer may turn on transaction relay later. if (!pfrom.IsBlockOnlyConn() && !pfrom.IsFeelerConn() && (fRelay || (peer->m_our_services & NODE_BLOOM))) { diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 266fc27672ca..882aef8610e5 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -124,7 +124,7 @@ static RPCHelpMan getpeerinfo() {RPCResult::Type::STR_HEX, "verified_pubkey_hash", "Only present when the peer is a masternode and successfully " "authenticated via MNAUTH. In this case, this field contains the " "hash of the masternode's operator public key"}, - {RPCResult::Type::BOOL, "relaytxes", /*optional=*/true, "Whether peer has asked us to relay transactions to it"}, + {RPCResult::Type::BOOL, "relaytxes", /*optional=*/true, "Whether we relay transactions to this peer"}, {RPCResult::Type::NUM_TIME, "lastsend", "The " + UNIX_EPOCH_TIME + " of the last send"}, {RPCResult::Type::NUM_TIME, "lastrecv", "The " + UNIX_EPOCH_TIME + " of the last receive"}, {RPCResult::Type::NUM_TIME, "last_transaction", "The " + UNIX_EPOCH_TIME + " of the last valid transaction received from this peer"}, @@ -133,9 +133,9 @@ static RPCHelpMan getpeerinfo() {RPCResult::Type::NUM, "bytesrecv", "The total bytes received"}, {RPCResult::Type::NUM_TIME, "conntime", "The " + UNIX_EPOCH_TIME + " of the connection"}, {RPCResult::Type::NUM, "timeoffset", "The time offset in seconds"}, - {RPCResult::Type::NUM, "pingtime", /*optional=*/true, "ping time (if available)"}, - {RPCResult::Type::NUM, "minping", /*optional=*/true, "minimum observed ping time (if any at all)"}, - {RPCResult::Type::NUM, "pingwait", /*optional=*/true, "ping wait (if non-zero)"}, + {RPCResult::Type::NUM, "pingtime", /*optional=*/true, "The last ping time in milliseconds (ms), if any"}, + {RPCResult::Type::NUM, "minping", /*optional=*/true, "The minimum observed ping time in milliseconds (ms), if any"}, + {RPCResult::Type::NUM, "pingwait", /*optional=*/true, "The duration in milliseconds (ms) of an outstanding ping (if non-zero)"}, {RPCResult::Type::NUM, "version", "The peer version, such as 70001"}, {RPCResult::Type::STR, "subver", "The string version"}, {RPCResult::Type::BOOL, "inbound", "Inbound (true) or Outbound (false)"}, @@ -219,7 +219,9 @@ static RPCHelpMan getpeerinfo() ServiceFlags services{statestats.their_services}; obj.pushKV("services", strprintf("%016x", services)); obj.pushKV("servicesnames", GetServicesNames(services)); - obj.pushKV("relaytxes", statestats.m_relay_txs); + if (fStateStats) { + obj.pushKV("relaytxes", statestats.m_relay_txs); + } if (!stats.verifiedProRegTxHash.IsNull()) { obj.pushKV("verified_proregtx_hash", stats.verifiedProRegTxHash.ToString()); } From 83da1a1e998a52dfd0ba76f6387ef4d2ea239314 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Thu, 13 Oct 2022 11:23:12 -0400 Subject: [PATCH 03/10] Merge bitcoin/bitcoin#25526: wallet: avoid double keypool TopUp() call on descriptor wallets bfb9b94ebefdb95ac7656836975b3d5afc428744 wallet: remove duplicate descriptor type check in GetNewDestination (furszy) 76b982a4a5328c1357dbc5361317f682db160876 wallet: remove unused `nAccountingEntryNumber` field (furszy) 599ff5adfc7e1227c6d97d861d0715aee57611dd wallet: avoid double TopUp() calls on descriptor wallets (furszy) Pull request description: Found it while was digging over a `getnewaddress` timeout on the functional test suite. ### Context: We are calling `TopUp()` twice in the following flows for descriptor wallets: A) `CWallet::GetNewDestination`: 1) Calls spk_man->TopUp() 2) Calls spk_man->GetNewDestination() --> which, after the basic script checks, calls TopUp() again. B) `CWallet::GetReservedDestination`: 1) Calls spk_man->TopUp() 2) Calls spk_man->GetReservedDestination() --> which calls to GetNewDestination (which calls to TopUp again). ### Changes: Move `TopUp()` responsibility from the wallet class to each scriptpubkeyman. So each spkm can decide to call it or not after perform the basic checks for the new destination request. Aside from that, remove the unused `nAccountingEntryNumber` wallet field. And a duplicated descriptor type check in `GetNewDestination` ACKs for top commit: aureleoules: re-ACK bfb9b94ebefdb95ac7656836975b3d5afc428744. achow101: ACK bfb9b94ebefdb95ac7656836975b3d5afc428744 theStack: Code-review ACK bfb9b94ebefdb95ac7656836975b3d5afc428744 Tree-SHA512: 3ab73f37729e50d6c6a4434f676855bc1fb404619d63c03e5b06ce61c292c09c59d64cb1aa3bd9277b06f26988956991d62c90f9d835884f41ed500b43a12058 --- src/wallet/scriptpubkeyman.cpp | 14 ++++++++------ src/wallet/wallet.cpp | 6 +----- src/wallet/wallet.h | 1 - 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index be71468f12ea..be9fc5d9b3b2 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -19,6 +19,9 @@ namespace wallet { util::Result LegacyScriptPubKeyMan::GetNewDestination() { + // Fill-up keypool if needed + TopUp(); + LOCK(cs_KeyStore); // Generate a new key that is added to wallet @@ -299,6 +302,9 @@ util::Result LegacyScriptPubKeyMan::GetReservedDestination(bool return util::Error{_("Error: Keypool ran out, please call keypoolrefill first")}; } + // Fill-up keypool if needed + TopUp(); + if (!ReserveKeyFromKeyPool(index, keypool, internal)) { return util::Error{_("Error: Keypool ran out, please call keypoolrefill first")}; } @@ -1824,13 +1830,9 @@ util::Result DescriptorScriptPubKeyMan::GetNewDestination() // We can't generate anymore keys return util::Error{_("Error: Keypool ran out, please call keypoolrefill first")}; } - const OutputType type{OutputType::LEGACY}; CTxDestination dest; - std::optional out_script_type = m_wallet_descriptor.descriptor->GetOutputType(); - if (out_script_type && out_script_type == type) { - ExtractDestination(scripts_temp[0], dest); - } else { - throw std::runtime_error(std::string(__func__) + ": Types are inconsistent. Stored type does not match type of newly generated address"); + if (!ExtractDestination(scripts_temp[0], dest)) { + return util::Error{_("Error: Cannot extract destination from the generated scriptpubkey")}; // shouldn't happen } m_wallet_descriptor.next_index++; WalletBatch(m_storage.GetDatabase()).WriteDescriptor(GetID(), m_wallet_descriptor); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index c86807f4f5ca..c70d9a2222b1 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2392,7 +2392,6 @@ util::Result CWallet::GetNewDestination(const std::string label) return util::Error{_("Error: No addresses available.")}; } - spk_man->TopUp(); auto op_dest = spk_man->GetNewDestination(); if (op_dest) { SetAddressBook(*op_dest, label, "receive"); @@ -2485,10 +2484,7 @@ util::Result ReserveDestination::GetReservedDestination(bool fIn return util::Error{_("Error: No addresses available.")}; } - if (nIndex == -1) - { - m_spk_man->TopUp(); - + if (nIndex == -1) { CKeyPool keypool; int64_t index; auto op_address = m_spk_man->GetReservedDestination(fInternalIn, index, keypool); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index bf427dd1b16a..e2f23828d502 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -479,7 +479,6 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati TxItems wtxOrdered; int64_t nOrderPosNext GUARDED_BY(cs_wallet) = 0; - uint64_t nAccountingEntryNumber = 0; std::map m_address_book GUARDED_BY(cs_wallet); const CAddressBookData* FindAddressBookEntry(const CTxDestination&, bool allow_change = false) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); From e011ce56ca9818acff44e6a0fa5e5f9130c73c19 Mon Sep 17 00:00:00 2001 From: MacroFake Date: Tue, 18 Oct 2022 13:42:22 +0200 Subject: [PATCH 04/10] Merge bitcoin/bitcoin#26313: doc: consolidate library documentation to libraries.md af781bf4b2998eb17e89b6b24d26a2590e548259 doc: fix typo in doc/libraries.md (fanquake) 9e9ae6101ff505b97a514148e86a5699acba20df doc: remove library commentary from src/Makefile.am (fanquake) Pull request description: Deduplicate the makefile comments, in favour of doc/libraries.md. I think a single, more comprehensive source of truth is preferable. Diagrams are also useful. Came up in https://github.com/bitcoin/bitcoin/pull/26292#issuecomment-1275094478. ACKs for top commit: ryanofsky: Code review ACK af781bf4b2998eb17e89b6b24d26a2590e548259, nice cleanups hebasto: ACK af781bf4b2998eb17e89b6b24d26a2590e548259, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: df61ed1394102221701ae2dfa42886dfabe9d9fd7f601b794e2195f93d8f7c2a1cd1c000a77d0a969b42328e8ebc0387755c57291837b283fdf376dbd98fdda1 --- doc/design/libraries.md | 2 +- src/Makefile.am | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/doc/design/libraries.md b/doc/design/libraries.md index 548e8c861847..d3c421a0d319 100644 --- a/doc/design/libraries.md +++ b/doc/design/libraries.md @@ -85,7 +85,7 @@ class dash-qt,dashd,dash-cli,dash-wallet bold -- The graph shows what _linker symbols_ (functions and variables) from each library other libraries can call and reference directly, but it is not a call graph. For example, there is no arrow connecting *libbitcoin_wallet* and *libbitcoin_node* libraries, because these libraries are intended to be modular and not depend on each other's internal implementation details. But wallet code still is still able to call node code indirectly through the `interfaces::Chain` abstract class in [`interfaces/chain.h`](../../src/interfaces/chain.h) and node code calls wallet code through the `interfaces::ChainClient` and `interfaces::Chain::Notifications` abstract classes in the same file. In general, defining abstract classes in [`src/interfaces/`](../../src/interfaces/) can be a convenient way of avoiding unwanted direct dependencies or circular dependencies between libraries. +- The graph shows what _linker symbols_ (functions and variables) from each library other libraries can call and reference directly, but it is not a call graph. For example, there is no arrow connecting *libbitcoin_wallet* and *libbitcoin_node* libraries, because these libraries are intended to be modular and not depend on each other's internal implementation details. But wallet code is still able to call node code indirectly through the `interfaces::Chain` abstract class in [`interfaces/chain.h`](../../src/interfaces/chain.h) and node code calls wallet code through the `interfaces::ChainClient` and `interfaces::Chain::Notifications` abstract classes in the same file. In general, defining abstract classes in [`src/interfaces/`](../../src/interfaces/) can be a convenient way of avoiding unwanted direct dependencies or circular dependencies between libraries. - *libdash_consensus* should be a standalone dependency that any library can depend on, and it should not depend on any other libraries itself. diff --git a/src/Makefile.am b/src/Makefile.am index f76c844973a4..29aa4c06a6ca 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -465,11 +465,7 @@ obj/build.h: FORCE "$(abs_top_srcdir)" libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h - -# server: shared between dashd and dash-qt -# Contains code accessing mempool and chain state that is meant to be separated -# from wallet and gui code (see node/README.md). Shared code should go in -# libbitcoin_common or libbitcoin_util libraries, instead. +# node # libbitcoin_node_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) $(MINIUPNPC_CPPFLAGS) $(NATPMP_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS) libbitcoin_node_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_node_a_SOURCES = \ @@ -619,7 +615,9 @@ endif if !ENABLE_WALLET libbitcoin_node_a_SOURCES += dummywallet.cpp endif +# +# zmq # if ENABLE_ZMQ libbitcoin_zmq_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) $(ZMQ_CFLAGS) libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) @@ -630,10 +628,9 @@ libbitcoin_zmq_a_SOURCES = \ zmq/zmqrpc.cpp \ zmq/zmqutil.cpp endif +# - -# wallet: shared between dashd and dash-qt, but only linked -# when wallet enabled +# wallet # libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) $(BDB_CPPFLAGS) $(SQLITE_CFLAGS) libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_wallet_a_SOURCES = \ @@ -677,18 +674,17 @@ endif if USE_BDB libbitcoin_wallet_a_SOURCES += wallet/bdb.cpp wallet/salvage.cpp endif +# +# wallet tool # libbitcoin_wallet_tool_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) libbitcoin_wallet_tool_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_wallet_tool_a_SOURCES = \ wallet/wallettool.cpp \ $(BITCOIN_CORE_H) +# -# crypto primitives library - -# crypto_base contains the unspecialized (unoptimized) versions of our -# crypto functions. Functions that require custom compiler flags and/or -# runtime opt-in are omitted. +# crypto # crypto_libbitcoin_crypto_base_la_CPPFLAGS = $(AM_CPPFLAGS) $(PIC_FLAGS) # Specify -static in both CXXFLAGS and LDFLAGS so libtool will only build a @@ -849,8 +845,9 @@ crypto_libbitcoin_crypto_arm_shani_la_CPPFLAGS = $(AM_CPPFLAGS) crypto_libbitcoin_crypto_arm_shani_la_CXXFLAGS += $(ARM_SHANI_CXXFLAGS) crypto_libbitcoin_crypto_arm_shani_la_CPPFLAGS += -DENABLE_ARM_SHANI crypto_libbitcoin_crypto_arm_shani_la_SOURCES = crypto/sha256_arm_shani.cpp +# -# consensus: shared between all executables that validate any consensus rules. +# consensus # libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_consensus_a_SOURCES = \ @@ -891,8 +888,9 @@ libbitcoin_consensus_a_SOURCES = \ util/strencodings.h \ util/string.cpp \ version.h +# -# common: shared between dashd, and dash-qt and non-server tools +# common # libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_common_a_SOURCES = \ @@ -937,8 +935,9 @@ libbitcoin_common_a_SOURCES = \ script/standard.cpp \ warnings.cpp \ $(BITCOIN_CORE_H) +# -# util: shared between all executables. +# util # libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_util_a_SOURCES = \ @@ -996,8 +995,9 @@ libbitcoin_util_a_SOURCES = \ if USE_LIBEVENT libbitcoin_util_a_SOURCES += util/url.cpp endif +# -# cli: shared between dash-cli and dash-qt +# cli # libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_cli_a_SOURCES = \ From d0391717ed978953cb70081bd9c1cec5f7b0bcf1 Mon Sep 17 00:00:00 2001 From: MacroFake Date: Wed, 19 Oct 2022 09:22:12 +0200 Subject: [PATCH 05/10] Merge bitcoin/bitcoin#26142: Use `PACKAGE_NAME` in messages rather than hardcoding "Bitcoin Core" b147322a7a387423164de5a7d91a33eacad51689 Use `PACKAGE_NAME` in messages rather than hardcoding "Bitcoin Core" (Hennadii Stepanov) Pull request description: Usually, we do not hardcode "Bitcoin Core" in the user-faced messages. See: - bitcoin/bitcoin#18646 - bitcoin/bitcoin#19282 Also grammar has been improved -- singular instead of plural. ACKs for top commit: jarolrod: ACK b147322a7a387423164de5a7d91a33eacad51689 Tree-SHA512: b135c18703dfdd7b63d4cb27d1ac48f6a9dbf69382142ae381f33bf561cbf57477a11d1c73263aa834f705206d7dd5716df2523d38ed0d4cfec8babc38bb017a --- src/init.cpp | 2 +- src/qt/forms/optionsdialog.ui | 2 +- src/qt/optionsdialog.cpp | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index c831ed4986a8..59bbc4ded6fe 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -2487,7 +2487,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) const auto BadPortWarning = [](const char* prefix, uint16_t port) { return strprintf(_("%s request to listen on port %u. This port is considered \"bad\" and " - "thus it is unlikely that any Dash Core peers connect to it. See " + "thus it is unlikely that any peer will connect to it. See " "doc/p2p-bad-ports.md for details and a full list."), prefix, port); diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index b46cf51b7ce1..49e06646e9c3 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -430,7 +430,7 @@ - Full path to a Dash Core compatible script (e.g. C:\Downloads\hwi.exe or /Users/you/Downloads/hwi.py). Beware: malware can steal your coins! + Full path to a %1 compatible script (e.g. C:\Downloads\hwi.exe or /Users/you/Downloads/hwi.py). Beware: malware can steal your coins! diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index da72b71b0675..91914c66e1b3 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -139,7 +139,9 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : showPage(0); -#ifndef ENABLE_EXTERNAL_SIGNER +#ifdef ENABLE_EXTERNAL_SIGNER + ui->externalSignerPath->setToolTip(ui->externalSignerPath->toolTip().arg(PACKAGE_NAME)); +#else //: "External signing" means using devices such as hardware wallets. ui->externalSignerPath->setToolTip(tr("Compiled without external signing support (required for external signing)")); ui->externalSignerPath->setEnabled(false); From 3d2ac6481a067766880922ebc0b464c5979f7b3b Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 10 Oct 2022 15:26:10 +0800 Subject: [PATCH 06/10] Merge bitcoin/bitcoin#26277: test: Remove confusing DUMMY_P2WPKH_SCRIPT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fa8a305ddde15abc0df03a3af0a03b92405d68f6 test: Remove confusing DUMMY_P2WPKH_SCRIPT (MacroFake) Pull request description: It is confusing because, it is *not* a P2WPKH script, and it is nonstandard. See also https://github.com/bitcoin/bitcoin/pull/26265/files#r989827855 Fix all issues by removing it, and also remove the no longer needed `-acceptnonstdtxn` setting from the test. ACKs for top commit: instagibbs: ACK https://github.com/bitcoin/bitcoin/pull/26277/commits/fa8a305ddde15abc0df03a3af0a03b92405d68f6 theStack: Code-review ACK fa8a305ddde15abc0df03a3af0a03b92405d68f6 📜 Tree-SHA512: 64f3e0009b055e4fd4428b20f3e85582e1608e9b06e500b8fbfeb91fc35ce510e69d051e8f48ce35d0320067793e12f4423b214cc1f68c217a5872e0ad97d211 --- test/functional/feature_bip68_sequence.py | 37 +++++++++++++++-------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/test/functional/feature_bip68_sequence.py b/test/functional/feature_bip68_sequence.py index 34cb66e893d5..a4fd088bb84d 100755 --- a/test/functional/feature_bip68_sequence.py +++ b/test/functional/feature_bip68_sequence.py @@ -16,6 +16,10 @@ CTxOut, tx_from_hex, ) +from test_framework.script import ( + CScript, + OP_TRUE, +) from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_equal, @@ -23,9 +27,11 @@ assert_raises_rpc_error, softfork_active, ) -from test_framework.script_util import DUMMY_P2SH_SCRIPT +from test_framework.script_util import script_to_p2sh_script from test_framework.wallet import MiniWallet +SCRIPT_SH_OP_TRUE = script_to_p2sh_script(CScript([OP_TRUE])) + SEQUENCE_LOCKTIME_DISABLE_FLAG = (1<<31) SEQUENCE_LOCKTIME_TYPE_FLAG = (1<<22) # this means use time (0 means height) SEQUENCE_LOCKTIME_GRANULARITY = 9 # this is a bit-shift @@ -40,11 +46,9 @@ def set_test_params(self): self.extra_args = [ [ '-testactivationheight=csv@432', - "-acceptnonstdtxn=1", ], [ '-testactivationheight=csv@432', - "-acceptnonstdtxn=0", ], ] @@ -90,7 +94,7 @@ def test_disable_flag(self): # input to mature. sequence_value = SEQUENCE_LOCKTIME_DISABLE_FLAG | 1 tx1.vin = [CTxIn(COutPoint(int(utxo["txid"], 16), utxo["vout"]), nSequence=sequence_value)] - tx1.vout = [CTxOut(value, DUMMY_P2SH_SCRIPT)] + tx1.vout = [CTxOut(value, SCRIPT_SH_OP_TRUE)] self.wallet.sign_tx(tx=tx1) tx1_id = self.wallet.sendrawtransaction(from_node=self.nodes[0], tx_hex=tx1.serialize().hex()) @@ -101,8 +105,8 @@ def test_disable_flag(self): tx2 = CTransaction() tx2.nVersion = 2 sequence_value = sequence_value & 0x7fffffff - tx2.vin = [CTxIn(COutPoint(tx1_id, 0), nSequence=sequence_value)] - tx2.vout = [CTxOut(int(value - self.relayfee * COIN), DUMMY_P2SH_SCRIPT)] + tx2.vin = [CTxIn(COutPoint(tx1_id, 0), scriptSig=CScript([CScript([OP_TRUE])]), nSequence=sequence_value)] + tx2.vout = [CTxOut(int(value - self.relayfee * COIN), SCRIPT_SH_OP_TRUE)] tx2.rehash() assert_raises_rpc_error(-26, NOT_FINAL_ERROR, self.wallet.sendrawtransaction, from_node=self.nodes[0], tx_hex=tx2.serialize().hex()) @@ -190,7 +194,7 @@ def test_sequence_lock_confirmed_inputs(self): value += utxos[j]["value"]*COIN # Overestimate the size of the tx - signatures should be less than 120 bytes, and leave 50 for the output tx_size = len(tx.serialize().hex())//2 + 120*num_inputs + 50 - tx.vout.append(CTxOut(int(value-self.relayfee*tx_size*COIN/1000), DUMMY_P2SH_SCRIPT)) + tx.vout.append(CTxOut(int(value - self.relayfee * tx_size * COIN / 1000), SCRIPT_SH_OP_TRUE)) self.wallet.sign_tx(tx=tx) if (using_sequence_locks and not should_pass): @@ -220,7 +224,7 @@ def test_sequence_lock_unconfirmed_inputs(self): tx2 = CTransaction() tx2.nVersion = 2 tx2.vin = [CTxIn(COutPoint(tx1.sha256, 0), nSequence=0)] - tx2.vout = [CTxOut(int(tx1.vout[0].nValue - self.relayfee*COIN), DUMMY_P2SH_SCRIPT)] + tx2.vout = [CTxOut(int(tx1.vout[0].nValue - self.relayfee * COIN), SCRIPT_SH_OP_TRUE)] self.wallet.sign_tx(tx=tx2) tx2_raw = tx2.serialize().hex() tx2.rehash() @@ -237,8 +241,8 @@ def test_nonzero_locks(orig_tx, node, relayfee, use_height_lock): tx = CTransaction() tx.nVersion = 2 - tx.vin = [CTxIn(COutPoint(orig_tx.sha256, 0), nSequence=sequence_value)] - tx.vout = [CTxOut(int(orig_tx.vout[0].nValue - relayfee * COIN), DUMMY_P2SH_SCRIPT)] + tx.vin = [CTxIn(COutPoint(orig_tx.sha256, 0), scriptSig=CScript([CScript([OP_TRUE])]), nSequence=sequence_value)] + tx.vout = [CTxOut(int(orig_tx.vout[0].nValue - relayfee * COIN), SCRIPT_SH_OP_TRUE)] tx.rehash() if (orig_tx.hash in node.getrawmempool()): @@ -294,10 +298,17 @@ def test_nonzero_locks(orig_tx, node, relayfee, use_height_lock): assert tx5.hash not in self.nodes[0].getrawmempool() utxo = self.wallet.get_utxo() + if tx4.hash == utxo['txid']: + # get_utxo returns the hash of tx4, but bitcoin's implementation of get_utxo() doesn't do it. + # Calling it second time helps to avoid `bad-txns-inputs-duplicate` error + # TODO: remove this workaround in the future if this behavior will be changed at some point + utxo = self.wallet.get_utxo() tx5.vin.append(CTxIn(COutPoint(int(utxo["txid"], 16), utxo["vout"]), nSequence=1)) tx5.vout[0].nValue += int(utxo["value"]*COIN) self.wallet.sign_tx(tx=tx5) + self.log.info(f"tx5: {tx5}") + self.log.info(f"tx5-vin: {tx5.vin}") assert_raises_rpc_error(-26, NOT_FINAL_ERROR, self.wallet.sendrawtransaction, from_node=self.nodes[0], tx_hex=tx5.serialize().hex()) # Test mempool-BIP68 consistency after reorg @@ -350,7 +361,7 @@ def test_bip68_not_consensus(self): tx2 = CTransaction() tx2.nVersion = 1 tx2.vin = [CTxIn(COutPoint(tx1.sha256, 0), nSequence=0)] - tx2.vout = [CTxOut(int(tx1.vout[0].nValue - self.relayfee*COIN), DUMMY_P2SH_SCRIPT)] + tx2.vout = [CTxOut(int(tx1.vout[0].nValue - self.relayfee * COIN), SCRIPT_SH_OP_TRUE)] # sign tx2 self.wallet.sign_tx(tx=tx2) @@ -365,8 +376,8 @@ def test_bip68_not_consensus(self): tx3 = CTransaction() tx3.nVersion = 2 - tx3.vin = [CTxIn(COutPoint(tx2.sha256, 0), nSequence=sequence_value)] - tx3.vout = [CTxOut(int(tx2.vout[0].nValue - self.relayfee * COIN), DUMMY_P2SH_SCRIPT)] + tx3.vin = [CTxIn(COutPoint(tx2.sha256, 0), scriptSig=CScript([CScript([OP_TRUE])]), nSequence=sequence_value)] + tx3.vout = [CTxOut(int(tx2.vout[0].nValue - self.relayfee * COIN), SCRIPT_SH_OP_TRUE)] tx3.rehash() assert_raises_rpc_error(-26, NOT_FINAL_ERROR, self.wallet.sendrawtransaction, from_node=self.nodes[0], tx_hex=tx3.serialize().hex()) From 83eaf94db199337f22a87f5657b8ca1db05a90b7 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Tue, 23 May 2023 15:40:30 -0400 Subject: [PATCH 07/10] partial Merge bitcoin/bitcoin#27177: test: fix intermittent issue in `feature_bip68_sequence` BACKPORT NOTE: Missing changes are: - test/functional/mempool_package_limits.py - test/functional/interface_usdt_mempool.py 272eb5561667482f8226bcf98eea00689dccefb8 test: fix `include_immature_coinbase` logic in `get_utxos` (brunoerg) a951c34f179dad0c7059b04a7f1e6b0804462168 test: fix `interface_usdt_mempool` by mining a block after each test (brunoerg) 1557bf1196bc2bdf00fd32f3b5d525796b4d194c test: fix mature utxos addition to wallet in `mempool_package_limits` (brunoerg) 60ced9007d518d542ce489b91076f9bbaf3312e3 test: fix intermittent issue in `feature_bip68_sequence` (brunoerg) Pull request description: Fixes #27129 To avoid `bad-txns-premature-spend-of-coinbase` error, when getting a utxo (using `get_utxo`) to create a new transaction `get_utxo` shouldn't return (if possible) by default immature coinbase. ACKs for top commit: achow101: ACK 272eb5561667482f8226bcf98eea00689dccefb8 pinheadmz: re-ACK 272eb5561667482f8226bcf98eea00689dccefb8 Tree-SHA512: eae821c7833bf084d8b907c94876ed010a7925d2177c3013a0c61b69d9571df006da83397a19487d93b0d1fa415951152f0b8ad0de2a55d86c39f6917934f050 --- test/functional/mempool_compatibility.py | 2 +- test/functional/mempool_persist.py | 1 + test/functional/test_framework/wallet.py | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/functional/mempool_compatibility.py b/test/functional/mempool_compatibility.py index b78aa3da91a6..b576385651e1 100755 --- a/test/functional/mempool_compatibility.py +++ b/test/functional/mempool_compatibility.py @@ -50,12 +50,12 @@ def run_test(self): # unbroadcasted_tx won't pass old_node's `MemPoolAccept::PreChecks`. self.connect_nodes(0, 1) self.sync_blocks() - self.stop_node(1) self.log.info("Add a transaction to mempool on old node and shutdown") old_tx_hash = new_wallet.send_self_transfer(from_node=old_node)["txid"] assert old_tx_hash in old_node.getrawmempool() self.stop_node(0) + self.stop_node(1) self.log.info("Move mempool.dat from old to new node") old_node_mempool = os.path.join(old_node.datadir, self.chain, 'mempool.dat') diff --git a/test/functional/mempool_persist.py b/test/functional/mempool_persist.py index 440639b85098..0bdc8c0a7636 100755 --- a/test/functional/mempool_persist.py +++ b/test/functional/mempool_persist.py @@ -179,6 +179,7 @@ def run_test(self): def test_persist_unbroadcast(self): node0 = self.nodes[0] self.start_node(0) + self.start_node(2) # clear out mempool self.generate(node0, 1, sync_fun=self.no_op) diff --git a/test/functional/test_framework/wallet.py b/test/functional/test_framework/wallet.py index 99cd11c7a812..494552d04ec3 100644 --- a/test/functional/test_framework/wallet.py +++ b/test/functional/test_framework/wallet.py @@ -186,10 +186,12 @@ def get_utxo(self, *, txid: str = '', vout: Optional[int] = None, mark_as_spent= txid: get the first utxo we find from a specific transaction """ self._utxos = sorted(self._utxos, key=lambda k: (k['value'], -k['height'])) # Put the largest utxo last + blocks_height = self._test_node.getblockchaininfo()['blocks'] + mature_coins = list(filter(lambda utxo: not utxo['coinbase'] or COINBASE_MATURITY - 1 <= blocks_height - utxo['height'], self._utxos)) if txid: utxo_filter: Any = filter(lambda utxo: txid == utxo['txid'], self._utxos) else: - utxo_filter = reversed(self._utxos) # By default the largest utxo + utxo_filter = reversed(mature_coins) # By default the largest utxo if vout is not None: utxo_filter = filter(lambda utxo: vout == utxo['vout'], utxo_filter) index = self._utxos.index(next(utxo_filter)) @@ -201,7 +203,8 @@ def get_utxo(self, *, txid: str = '', vout: Optional[int] = None, mark_as_spent= def get_utxos(self, *, include_immature_coinbase=False, mark_as_spent=True): """Returns the list of all utxos and optionally mark them as spent""" if not include_immature_coinbase: - utxo_filter = filter(lambda utxo: not utxo['coinbase'] or COINBASE_MATURITY <= utxo['confirmations'], self._utxos) + blocks_height = self._test_node.getblockchaininfo()['blocks'] + utxo_filter = filter(lambda utxo: not utxo['coinbase'] or COINBASE_MATURITY - 1 <= blocks_height - utxo['height'], self._utxos) else: utxo_filter = self._utxos utxos = deepcopy(list(utxo_filter)) From 50786664dc2d2239e4281ae4cbb9ea433b220ad5 Mon Sep 17 00:00:00 2001 From: merge-script Date: Thu, 19 Jun 2025 15:03:58 +0100 Subject: [PATCH 08/10] Merge bitcoin/bitcoin#32765: test: Fix list index out of range error in feature_bip68_sequence.py e285e691b7a311e278f89e9fe423716de1ee268b test: Fix list index out of range error in feature_bip68_sequence.py (zaidmstrr) Pull request description: Fixes [#32334](https://github.com/bitcoin/bitcoin/issues/32334) The test `feature_bip68_sequence.py` fails with `IndexError: list index out of range` error due to a mismatch between the number of inputs requested (at random) and the number of UTXOs available. The error is reproducible with the randomseed: ``` $ ./build/test/functional/feature_bip68_sequence.py --randomseed 6169832640268785903 ``` This PR adds a valid upper bound to randomly select the inputs. ACKs for top commit: maflcko: lgtm ACK e285e691b7a311e278f89e9fe423716de1ee268b Prabhat1308: re-ACK [`e285e69`](https://github.com/bitcoin/bitcoin/pull/32765/commits/e285e691b7a311e278f89e9fe423716de1ee268b) theStack: ACK e285e691b7a311e278f89e9fe423716de1ee268b Tree-SHA512: 2e5e19d5db2880915f556ed4444abed94e9ceb1ecee5f857df5616040c850dae682aaa4ade3060c48acb16676df92ba81c3af078c1958965e9e874e7bb489388 --- test/functional/feature_bip68_sequence.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/functional/feature_bip68_sequence.py b/test/functional/feature_bip68_sequence.py index a4fd088bb84d..be8811e9eb53 100755 --- a/test/functional/feature_bip68_sequence.py +++ b/test/functional/feature_bip68_sequence.py @@ -142,8 +142,10 @@ def test_sequence_lock_confirmed_inputs(self): # between height/time locking). Small random chance of making the locks # all pass. for _ in range(400): + available_utxos = len(utxos) + # Randomly choose up to 10 inputs - num_inputs = random.randint(1, 10) + num_inputs = random.randint(1, min(10, available_utxos)) random.shuffle(utxos) # Track whether any sequence locks used should fail From 020cdb8af2b8009f218979792089b8b2787b1272 Mon Sep 17 00:00:00 2001 From: MacroFake Date: Tue, 20 Sep 2022 09:52:51 +0200 Subject: [PATCH 09/10] Merge bitcoin/bitcoin#26067: util: improve bitcoin-wallet exit codes fa2b8ae0a225fa45f43b32058aeb5856a1028bf0 util: improve bitcoin-wallet exit codes (MacroFake) Pull request description: Refactors `bitcoin-wallet` so that it doesn't return a non-zero exit code by default, and makes the option handling more inline with the other binaries. i.e outputting `Error: too few parameters` if you don't pass any options. Fixing this means we can check the process output in `gen-manpages.py`; which addresses the remaining [review comment](https://github.com/bitcoin/bitcoin/pull/24263#discussion_r806126705) from #24263. Top commit has no ACKs. Tree-SHA512: 80bd8098faefb4401ca1e4d49937ef6c960cf60ce0e7fb9dc38904fbc2fd92e319ec04570381da84943b7477845bf6be00e977f4c0451b247a6698662ce8f1bf --- contrib/devtools/gen-manpages.py | 2 +- src/bitcoin-wallet.cpp | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/contrib/devtools/gen-manpages.py b/contrib/devtools/gen-manpages.py index d3233e748ec0..ba77db7e1ae0 100755 --- a/contrib/devtools/gen-manpages.py +++ b/contrib/devtools/gen-manpages.py @@ -36,7 +36,7 @@ for relpath in BINARIES: abspath = os.path.join(builddir, relpath) try: - r = subprocess.run([abspath, '--version'], stdout=subprocess.PIPE, universal_newlines=True) + r = subprocess.run([abspath, "--version"], stdout=subprocess.PIPE, check=True, universal_newlines=True) except IOError: print(f'{abspath} not found or not an executable', file=sys.stderr) sys.exit(1) diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp index 36ccfc2c3d14..7bc14502a3f1 100644 --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -49,15 +49,16 @@ static void SetupWalletToolArgs(ArgsManager& argsman) argsman.AddCommand("createfromdump", "Create new wallet file from dumped records", OptionsCategory::COMMANDS); } -static bool WalletAppInit(ArgsManager& args, int argc, char* argv[]) +static std::optional WalletAppInit(ArgsManager& args, int argc, char* argv[]) { SetupWalletToolArgs(args); std::string error_message; if (!args.ParseParameters(argc, argv, error_message)) { tfm::format(std::cerr, "Error parsing command line arguments: %s\n", error_message); - return false; + return EXIT_FAILURE; } - if (argc < 2 || HelpRequested(args) || args.IsArgSet("-version")) { + const bool missing_args{argc < 2}; + if (missing_args || HelpRequested(args) || args.IsArgSet("-version")) { std::string strUsage = strprintf("%s dash-wallet version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n"; if (args.IsArgSet("-version")) { @@ -72,7 +73,11 @@ static bool WalletAppInit(ArgsManager& args, int argc, char* argv[]) strUsage += "\n" + args.GetHelpMessage(); } tfm::format(std::cout, "%s", strUsage); - return false; + if (missing_args) { + tfm::format(std::cerr, "Error: too few parameters\n"); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } // check for printtoconsole, allow -debug @@ -80,12 +85,12 @@ static bool WalletAppInit(ArgsManager& args, int argc, char* argv[]) if (!CheckDataDirOption()) { tfm::format(std::cerr, "Error: Specified data directory \"%s\" does not exist.\n", args.GetArg("-datadir", "")); - return false; + return EXIT_FAILURE; } // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause) SelectParams(args.GetChainName()); - return true; + return std::nullopt; } MAIN_FUNCTION @@ -98,7 +103,7 @@ MAIN_FUNCTION SetupEnvironment(); RandomInit(); try { - if (!WalletAppInit(args, argc, argv)) return EXIT_FAILURE; + if (const auto maybe_exit{WalletAppInit(args, argc, argv)}) return *maybe_exit; } catch (...) { PrintExceptionContinue(std::current_exception(), "WalletAppInit()"); return EXIT_FAILURE; From f0fa6dee1599e358750c4f3d98748d35e4d74531 Mon Sep 17 00:00:00 2001 From: MacroFake Date: Wed, 19 Oct 2022 09:41:40 +0200 Subject: [PATCH 10/10] Merge bitcoin/bitcoin#26286: test: Remove unused txmempool include from tests BACKPORT NOTE: some extra changes are from bitcoin/bitcoin#26376 which is already backported 1c48dae76fc808bf7154aca976e7303364c56509 test: Use C++11 member initializers for TestMemPoolEntryHelper (MacroFake) fad7f2239c74a4db31b3023f2bcaf1f0852453f8 test: Remove unused txmempool include from tests (MacroFake) Pull request description: Seems odd to include this heavy header in all tests despite it only being used in a few tests. Can be reviewed with `--color-moved=dimmed-zebra --ignore-all-space` ACKs for top commit: aureleoules: reACK 1c48dae76fc808bf7154aca976e7303364c56509 hebasto: ACK 1c48dae76fc808bf7154aca976e7303364c56509, I have reviewed the code and it looks OK, I agree it can be merged. w0xlt: ACK https://github.com/bitcoin/bitcoin/pull/26286/commits/1c48dae76fc808bf7154aca976e7303364c56509 Tree-SHA512: 31f2808d04ec33bfc2409832b8e59e6c870eaa98fbcf879e1c786492c7d07134711b30f8290bdb34e1b8f7b8f2f11dae8e10c64e7eb31f584b2f5c58fcc7743b --- src/Makefile.test_util.include | 36 +++++++++++---------- src/test/blockencodings_tests.cpp | 1 + src/test/evo_deterministicmns_tests.cpp | 1 + src/test/fuzz/tx_pool.cpp | 1 + src/test/fuzz/validation_load_mempool.cpp | 1 + src/test/mempool_tests.cpp | 1 + src/test/miner_tests.cpp | 1 + src/test/policyestimator_tests.cpp | 1 + src/test/sigopcount_tests.cpp | 1 + src/test/util/setup_common.cpp | 12 +------ src/test/util/setup_common.h | 32 +++---------------- src/test/util/txmempool.cpp | 38 +++++++++++++++++++++++ src/test/util/txmempool.h | 34 ++++++++++++++++++++ src/test/util_tests.cpp | 1 + 14 files changed, 105 insertions(+), 56 deletions(-) create mode 100644 src/test/util/txmempool.cpp create mode 100644 src/test/util/txmempool.h diff --git a/src/Makefile.test_util.include b/src/Makefile.test_util.include index cb44b9fa8995..749d3a5f1d62 100644 --- a/src/Makefile.test_util.include +++ b/src/Makefile.test_util.include @@ -5,25 +5,26 @@ LIBTEST_UTIL=libtest_util.a EXTRA_LIBRARIES += \ - $(LIBTEST_UTIL) + $(LIBTEST_UTIL) TEST_UTIL_H = \ - test/util/blockfilter.h \ - test/util/chainstate.h \ - test/util/json.h \ - test/util/index.h \ - test/util/llmq_tests.h \ - test/util/logging.h \ - test/util/mining.h \ - test/util/net.h \ - test/util/poolresourcetester.h \ - test/util/script.h \ - test/util/setup_common.h \ - test/util/str.h \ - test/util/transaction_utils.h \ - test/util/wallet.h \ - test/util/validation.h \ - test/util/xoroshiro128plusplus.h + test/util/blockfilter.h \ + test/util/chainstate.h \ + test/util/json.h \ + test/util/index.h \ + test/util/llmq_tests.h \ + test/util/logging.h \ + test/util/mining.h \ + test/util/net.h \ + test/util/poolresourcetester.h \ + test/util/script.h \ + test/util/setup_common.h \ + test/util/str.h \ + test/util/transaction_utils.h \ + test/util/txmempool.h \ + test/util/wallet.h \ + test/util/validation.h \ + test/util/xoroshiro128plusplus.h libtest_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) libtest_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) @@ -38,6 +39,7 @@ libtest_util_a_SOURCES = \ test/util/setup_common.cpp \ test/util/str.cpp \ test/util/transaction_utils.cpp \ + test/util/txmempool.cpp \ test/util/validation.cpp \ test/util/wallet.cpp \ $(TEST_UTIL_H) diff --git a/src/test/blockencodings_tests.cpp b/src/test/blockencodings_tests.cpp index 91db81ed5f19..c7ed320cf9d2 100644 --- a/src/test/blockencodings_tests.cpp +++ b/src/test/blockencodings_tests.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include diff --git a/src/test/evo_deterministicmns_tests.cpp b/src/test/evo_deterministicmns_tests.cpp index d90bbe92b31f..f741811d0e74 100644 --- a/src/test/evo_deterministicmns_tests.cpp +++ b/src/test/evo_deterministicmns_tests.cpp @@ -20,6 +20,7 @@ #include