diff --git a/src/chainparams.cpp b/src/chainparams.cpp index be5b6110fa2f7..6537e4fd2a50d 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -855,7 +855,8 @@ class CRegTestParams : public CChainParams { assert(genesis.hashMerkleRoot == uint256S("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7")); vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds. - vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds. + vSeeds.clear(); + vSeeds.emplace_back("dummySeed.invalid."); fDefaultConsistencyChecks = true; fRequireStandard = true; diff --git a/src/init.cpp b/src/init.cpp index c831ed4986a81..b16bc62b6d7d3 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1223,6 +1223,11 @@ bool AppInitParameterInteraction(const ArgsManager& args) fAllowPrivateNet = args.GetBoolArg("-allowprivatenet", DEFAULT_ALLOWPRIVATENET); + // If -forcednsseed is set to true, ensure -dnsseed has not been set to false + if (args.GetBoolArg("-forcednsseed", DEFAULT_FORCEDNSSEED) && !args.GetBoolArg("-dnsseed", DEFAULT_DNSSEED)){ + return InitError(_("Cannot set -forcednsseed to true when setting -dnsseed to false.")); + } + // -bind and -whitebind can't be set when not listening size_t nUserBind = args.GetArgs("-bind").size() + args.GetArgs("-whitebind").size(); if (nUserBind != 0 && !args.GetBoolArg("-listen", DEFAULT_LISTEN)) { diff --git a/src/net.cpp b/src/net.cpp index 69c279eace73d..7dc92be426377 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2680,7 +2680,7 @@ void CConnman::ThreadDNSAddressSeed() { READ_LOCK(m_nodes_mutex); for (const CNode* pnode : m_nodes) { - if (pnode->fSuccessfullyConnected && !pnode->IsFullOutboundConn() && !pnode->m_masternode_probe_connection) ++nRelevant; + if (pnode->fSuccessfullyConnected && pnode->IsFullOutboundConn() && !pnode->m_masternode_probe_connection) ++nRelevant; } } if (nRelevant >= 2) { diff --git a/src/net.h b/src/net.h index f49f93c45449c..1a0a9f3f4ede6 100644 --- a/src/net.h +++ b/src/net.h @@ -112,9 +112,9 @@ static const int64_t DEFAULT_PEER_CONNECT_TIMEOUT = 60; /** Number of file descriptors required for message capture **/ static const int NUM_FDS_MESSAGE_CAPTURE = 1; -static const bool DEFAULT_FORCEDNSSEED = false; -static const bool DEFAULT_DNSSEED = true; -static const bool DEFAULT_FIXEDSEEDS = true; +static constexpr bool DEFAULT_FORCEDNSSEED{false}; +static constexpr bool DEFAULT_DNSSEED{true}; +static constexpr bool DEFAULT_FIXEDSEEDS{true}; static const size_t DEFAULT_MAXRECEIVEBUFFER = 5 * 1000; static const size_t DEFAULT_MAXSENDBUFFER = 1 * 1000; @@ -1386,29 +1386,6 @@ friend class CNode; ForEachNode(FullyConnectedOnly, fn); } - template - void ForEachNodeThen(Callable&& pre, CallableAfter&& post) EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex) - { - ForEachNodeThen(FullyConnectedOnly, pre, post); - } - - template - void ForEachNodeThen(const Condition& cond, Callable&& pre, CallableAfter&& post) const EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex) - { - READ_LOCK(m_nodes_mutex); - for (auto&& node : m_nodes) { - if (cond(node)) - pre(node); - } - post(); - }; - - template - void ForEachNodeThen(Callable&& pre, CallableAfter&& post) const EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex) - { - ForEachNodeThen(FullyConnectedOnly, pre, post); - } - // Addrman functions /** * Return all or many randomly selected addresses, optionally by network. diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index a384301cdfa92..eca6536c19661 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -733,7 +733,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_ // create peer table context menu peersTableContextMenu = new QMenu(this); - //: Context menu action to copy the address of a peer + //: Context menu action to copy the address of a peer. peersTableContextMenu->addAction(tr("&Copy address"), [this] { GUIUtil::copyEntryData(ui->peerWidget, PeerTableModel::Address, Qt::DisplayRole); }); @@ -767,7 +767,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_ banTableContextMenu = new QMenu(this); /*: Context menu action to copy the IP/Netmask of a banned peer. IP/Netmask is the combination of a peer's IP address and its Netmask. - For IP address see: https://en.wikipedia.org/wiki/IP_address */ + For IP address, see: https://en.wikipedia.org/wiki/IP_address. */ banTableContextMenu->addAction(tr("&Copy IP/Netmask"), [this] { GUIUtil::copyEntryData(ui->banlistWidget, BanTableModel::Address, Qt::DisplayRole); }); diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 146ed5cefe8cf..066984c219dbd 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -227,7 +227,7 @@ void SendCoinsDialog::setModel(WalletModel *_model) updateSmartFeeLabel(); if (model->wallet().hasExternalSigner()) { - //: "device" usually means a hardware wallet + //: "device" usually means a hardware wallet. ui->sendButton->setText(tr("Sign on device")); if (gArgs.GetArg("-signer", "") != "") { ui->sendButton->setEnabled(true); diff --git a/src/rpc/external_signer.cpp b/src/rpc/external_signer.cpp index 91a21f4e4d5ba..ece157c8b41f2 100644 --- a/src/rpc/external_signer.cpp +++ b/src/rpc/external_signer.cpp @@ -23,8 +23,11 @@ static RPCHelpMan enumeratesigners() { {RPCResult::Type::ARR, "signers", /*optional=*/false, "", { - {RPCResult::Type::STR_HEX, "masterkeyfingerprint", "Master key fingerprint"}, - {RPCResult::Type::STR, "name", "Device name"}, + {RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::STR_HEX, "fingerprint", "Master key fingerprint"}, + {RPCResult::Type::STR, "name", "Device name"}, + }}, }, } } diff --git a/src/test/fuzz/addrman.cpp b/src/test/fuzz/addrman.cpp index ba953d33c5e36..1a79febb8a705 100644 --- a/src/test/fuzz/addrman.cpp +++ b/src/test/fuzz/addrman.cpp @@ -259,15 +259,6 @@ FUZZ_TARGET(addrman, .init = initialize_addrman) [&] { (void)addr_man.SelectTriedCollision(); }, - [&] { - (void)addr_man.Select(fuzzed_data_provider.ConsumeBool()); - }, - [&] { - (void)addr_man.GetAddr( - /*max_addresses=*/fuzzed_data_provider.ConsumeIntegralInRange(0, 4096), - /*max_pct=*/fuzzed_data_provider.ConsumeIntegralInRange(0, 4096), - /*network=*/std::nullopt); - }, [&] { std::vector addresses; LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) { @@ -288,9 +279,15 @@ FUZZ_TARGET(addrman, .init = initialize_addrman) addr_man.SetServices(ConsumeService(fuzzed_data_provider), ConsumeWeakEnum(fuzzed_data_provider, ALL_SERVICE_FLAGS)); }); } - (void)addr_man.Size(); + const AddrMan& const_addr_man{addr_man}; + (void)const_addr_man.GetAddr( + /* max_addresses */ fuzzed_data_provider.ConsumeIntegralInRange(0, 4096), + /* max_pct */ fuzzed_data_provider.ConsumeIntegralInRange(0, 4096), + /* network */ std::nullopt); + (void)const_addr_man.Select(fuzzed_data_provider.ConsumeBool()); + (void)const_addr_man.Size(); CDataStream data_stream(SER_NETWORK, PROTOCOL_VERSION); - data_stream << addr_man; + data_stream << const_addr_man; } // Check that serialize followed by unserialize produces the same addrman. @@ -309,4 +306,4 @@ FUZZ_TARGET(addrman_serdeser, .init = initialize_addrman) data_stream << addr_man1; data_stream >> addr_man2; assert(addr_man1 == addr_man2); -} \ No newline at end of file +} diff --git a/src/test/fuzz/connman.cpp b/src/test/fuzz/connman.cpp index 2a923e482691d..54c0edbbd6ea8 100644 --- a/src/test/fuzz/connman.cpp +++ b/src/test/fuzz/connman.cpp @@ -87,9 +87,6 @@ FUZZ_TARGET(connman, .init = initialize_connman) [&] { connman.ForEachNode([](auto) {}); }, - [&] { - connman.ForEachNodeThen([](auto) {}, []() {}); - }, [&] { (void)connman.ForNode(fuzzed_data_provider.ConsumeIntegral(), [&](auto) { return fuzzed_data_provider.ConsumeBool(); }); }, diff --git a/src/test/fuzz/integer.cpp b/src/test/fuzz/integer.cpp index 608445e297565..eff53706f6cb8 100644 --- a/src/test/fuzz/integer.cpp +++ b/src/test/fuzz/integer.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include