Skip to content

Commit a1c3afb

Browse files
ff1557b Merge bitcoin#22098: [test, init] DNS seed querying logic (fanquake) d2d66cf fix: inverted flag usage of IsFullOutboundConn for bitcoin#19316, fixes dns probe connections (Konstantin Akimov) bd60f04 Merge bitcoin#23036: test: use test_framework.p2p `P2P_SERVICES` constant in functional tests (fanquake) 18c4977 partial Merge bitcoin#22798: doc: Fix RPC result documentation (fanquake) c3e4afe Merge bitcoin-core/gui#420: Ensure translator comments end in full stop (Hennadii Stepanov) 935bf07 Merge bitcoin#22582: test: a test to check descendant limits (merge-script) cb7f29f Merge bitcoin#22922: ci: Fix and enable tests on Windows (MarcoFalke) b37c5a1 Merge bitcoin#21940: refactor: Mark CAddrMan::Select and GetAddr const (Konstantin Akimov) a3cde6b Merge bitcoin#22399: fuzz: Rework CTxDestination fuzzing (MarcoFalke) 437a0d2 Merge bitcoin#21941: fuzz: Call const member functions in addrman fuzz test only once (MarcoFalke) 0897cfd Merge bitcoin#21186: net/net processing: Move addr data into net_processing (fanquake) Pull request description: ## What was done? Some regular backports, mostly from Bitcoin Core v23 that has been missing by various reasons Also fixed conditions for DNS-seed requesting, as follow-up for bitcoin#19316 ## How Has This Been Tested? Run unit & functional tests ## Breaking Changes N/A Changes of RPC in src/rpc/external_signer.cpp are not breaking changes because it has not been released yet. ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: utACK ff1557b Tree-SHA512: 1d629e952d9d679284ed3871fe50b07a082a22ffe1fe5bb514d6f245f04d3cda8a89fa3e463774a75ece49f8e8b5b2cf68b2c57d642f544dbd33f4a82ddda73f
2 parents 8f71cc2 + ff1557b commit a1c3afb

25 files changed

+324
-120
lines changed

src/chainparams.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,8 @@ class CRegTestParams : public CChainParams {
855855
assert(genesis.hashMerkleRoot == uint256S("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"));
856856

857857
vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
858-
vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds.
858+
vSeeds.clear();
859+
vSeeds.emplace_back("dummySeed.invalid.");
859860

860861
fDefaultConsistencyChecks = true;
861862
fRequireStandard = true;

src/init.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,11 @@ bool AppInitParameterInteraction(const ArgsManager& args)
12261226

12271227
fAllowPrivateNet = args.GetBoolArg("-allowprivatenet", DEFAULT_ALLOWPRIVATENET);
12281228

1229+
// If -forcednsseed is set to true, ensure -dnsseed has not been set to false
1230+
if (args.GetBoolArg("-forcednsseed", DEFAULT_FORCEDNSSEED) && !args.GetBoolArg("-dnsseed", DEFAULT_DNSSEED)){
1231+
return InitError(_("Cannot set -forcednsseed to true when setting -dnsseed to false."));
1232+
}
1233+
12291234
// -bind and -whitebind can't be set when not listening
12301235
size_t nUserBind = args.GetArgs("-bind").size() + args.GetArgs("-whitebind").size();
12311236
if (nUserBind != 0 && !args.GetBoolArg("-listen", DEFAULT_LISTEN)) {

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2680,7 +2680,7 @@ void CConnman::ThreadDNSAddressSeed()
26802680
{
26812681
READ_LOCK(m_nodes_mutex);
26822682
for (const CNode* pnode : m_nodes) {
2683-
if (pnode->fSuccessfullyConnected && !pnode->IsFullOutboundConn() && !pnode->m_masternode_probe_connection) ++nRelevant;
2683+
if (pnode->fSuccessfullyConnected && pnode->IsFullOutboundConn() && !pnode->m_masternode_probe_connection) ++nRelevant;
26842684
}
26852685
}
26862686
if (nRelevant >= 2) {

src/net.h

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ static const int64_t DEFAULT_PEER_CONNECT_TIMEOUT = 60;
112112
/** Number of file descriptors required for message capture **/
113113
static const int NUM_FDS_MESSAGE_CAPTURE = 1;
114114

115-
static const bool DEFAULT_FORCEDNSSEED = false;
116-
static const bool DEFAULT_DNSSEED = true;
117-
static const bool DEFAULT_FIXEDSEEDS = true;
115+
static constexpr bool DEFAULT_FORCEDNSSEED{false};
116+
static constexpr bool DEFAULT_DNSSEED{true};
117+
static constexpr bool DEFAULT_FIXEDSEEDS{true};
118118
static const size_t DEFAULT_MAXRECEIVEBUFFER = 5 * 1000;
119119
static const size_t DEFAULT_MAXSENDBUFFER = 1 * 1000;
120120

@@ -1386,29 +1386,6 @@ friend class CNode;
13861386
ForEachNode(FullyConnectedOnly, fn);
13871387
}
13881388

1389-
template<typename Callable, typename CallableAfter>
1390-
void ForEachNodeThen(Callable&& pre, CallableAfter&& post) EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex)
1391-
{
1392-
ForEachNodeThen(FullyConnectedOnly, pre, post);
1393-
}
1394-
1395-
template<typename Condition, typename Callable, typename CallableAfter>
1396-
void ForEachNodeThen(const Condition& cond, Callable&& pre, CallableAfter&& post) const EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex)
1397-
{
1398-
READ_LOCK(m_nodes_mutex);
1399-
for (auto&& node : m_nodes) {
1400-
if (cond(node))
1401-
pre(node);
1402-
}
1403-
post();
1404-
};
1405-
1406-
template<typename Callable, typename CallableAfter>
1407-
void ForEachNodeThen(Callable&& pre, CallableAfter&& post) const EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex)
1408-
{
1409-
ForEachNodeThen(FullyConnectedOnly, pre, post);
1410-
}
1411-
14121389
// Addrman functions
14131390
/**
14141391
* Return all or many randomly selected addresses, optionally by network.

src/qt/rpcconsole.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_
733733

734734
// create peer table context menu
735735
peersTableContextMenu = new QMenu(this);
736-
//: Context menu action to copy the address of a peer
736+
//: Context menu action to copy the address of a peer.
737737
peersTableContextMenu->addAction(tr("&Copy address"), [this] {
738738
GUIUtil::copyEntryData(ui->peerWidget, PeerTableModel::Address, Qt::DisplayRole);
739739
});
@@ -767,7 +767,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_
767767
banTableContextMenu = new QMenu(this);
768768
/*: Context menu action to copy the IP/Netmask of a banned peer.
769769
IP/Netmask is the combination of a peer's IP address and its Netmask.
770-
For IP address see: https://en.wikipedia.org/wiki/IP_address */
770+
For IP address, see: https://en.wikipedia.org/wiki/IP_address. */
771771
banTableContextMenu->addAction(tr("&Copy IP/Netmask"), [this] {
772772
GUIUtil::copyEntryData(ui->banlistWidget, BanTableModel::Address, Qt::DisplayRole);
773773
});

src/qt/sendcoinsdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void SendCoinsDialog::setModel(WalletModel *_model)
227227
updateSmartFeeLabel();
228228

229229
if (model->wallet().hasExternalSigner()) {
230-
//: "device" usually means a hardware wallet
230+
//: "device" usually means a hardware wallet.
231231
ui->sendButton->setText(tr("Sign on device"));
232232
if (gArgs.GetArg("-signer", "") != "") {
233233
ui->sendButton->setEnabled(true);

src/rpc/external_signer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ static RPCHelpMan enumeratesigners()
2323
{
2424
{RPCResult::Type::ARR, "signers", /*optional=*/false, "",
2525
{
26-
{RPCResult::Type::STR_HEX, "masterkeyfingerprint", "Master key fingerprint"},
27-
{RPCResult::Type::STR, "name", "Device name"},
26+
{RPCResult::Type::OBJ, "", "",
27+
{
28+
{RPCResult::Type::STR_HEX, "fingerprint", "Master key fingerprint"},
29+
{RPCResult::Type::STR, "name", "Device name"},
30+
}},
2831
},
2932
}
3033
}

src/test/fuzz/addrman.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,6 @@ FUZZ_TARGET(addrman, .init = initialize_addrman)
259259
[&] {
260260
(void)addr_man.SelectTriedCollision();
261261
},
262-
[&] {
263-
(void)addr_man.Select(fuzzed_data_provider.ConsumeBool());
264-
},
265-
[&] {
266-
(void)addr_man.GetAddr(
267-
/*max_addresses=*/fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096),
268-
/*max_pct=*/fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096),
269-
/*network=*/std::nullopt);
270-
},
271262
[&] {
272263
std::vector<CAddress> addresses;
273264
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
@@ -288,9 +279,15 @@ FUZZ_TARGET(addrman, .init = initialize_addrman)
288279
addr_man.SetServices(ConsumeService(fuzzed_data_provider), ConsumeWeakEnum(fuzzed_data_provider, ALL_SERVICE_FLAGS));
289280
});
290281
}
291-
(void)addr_man.Size();
282+
const AddrMan& const_addr_man{addr_man};
283+
(void)const_addr_man.GetAddr(
284+
/* max_addresses */ fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096),
285+
/* max_pct */ fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096),
286+
/* network */ std::nullopt);
287+
(void)const_addr_man.Select(fuzzed_data_provider.ConsumeBool());
288+
(void)const_addr_man.Size();
292289
CDataStream data_stream(SER_NETWORK, PROTOCOL_VERSION);
293-
data_stream << addr_man;
290+
data_stream << const_addr_man;
294291
}
295292

296293
// Check that serialize followed by unserialize produces the same addrman.
@@ -309,4 +306,4 @@ FUZZ_TARGET(addrman_serdeser, .init = initialize_addrman)
309306
data_stream << addr_man1;
310307
data_stream >> addr_man2;
311308
assert(addr_man1 == addr_man2);
312-
}
309+
}

src/test/fuzz/connman.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ FUZZ_TARGET(connman, .init = initialize_connman)
8787
[&] {
8888
connman.ForEachNode([](auto) {});
8989
},
90-
[&] {
91-
connman.ForEachNodeThen([](auto) {}, []() {});
92-
},
9390
[&] {
9491
(void)connman.ForNode(fuzzed_data_provider.ConsumeIntegral<NodeId>(), [&](auto) { return fuzzed_data_provider.ConsumeBool(); });
9592
},

src/test/fuzz/integer.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <pow.h>
1818
#include <protocol.h>
1919
#include <pubkey.h>
20-
#include <rpc/util.h>
2120
#include <script/sign.h>
2221
#include <script/standard.h>
2322
#include <serialize.h>
@@ -150,14 +149,6 @@ FUZZ_TARGET(integer, .init = initialize_integer)
150149

151150
const PKHash key_id{u160};
152151
const ScriptHash script_id{u160};
153-
// CTxDestination = CNoDestination ∪ PKHash ∪ ScriptHash
154-
const std::vector<CTxDestination> destinations{key_id, script_id};
155-
for (const CTxDestination& destination : destinations) {
156-
(void)DescribeAddress(destination);
157-
(void)EncodeDestination(destination);
158-
(void)GetScriptForDestination(destination);
159-
(void)IsValidDestination(destination);
160-
}
161152

162153
{
163154
CDataStream stream(SER_NETWORK, INIT_PROTO_VERSION);

0 commit comments

Comments
 (0)