Skip to content

Commit a679f8b

Browse files
2 parents 0b8e501 + 2c9d41d commit a679f8b

26 files changed

+344
-175
lines changed

src/Makefile.test.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ BITCOIN_TESTS =\
164164
test/validation_chainstate_tests.cpp \
165165
test/validation_chainstatemanager_tests.cpp \
166166
test/validation_flush_tests.cpp \
167+
test/validationinterface_tests.cpp \
167168
test/versionbits_tests.cpp
168169

169170
if ENABLE_WALLET

src/net.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,8 +1129,8 @@ class CNode
11291129
std::vector<CAddress> vAddrToSend;
11301130
const std::unique_ptr<CRollingBloomFilter> m_addr_known;
11311131
bool fGetAddr{false};
1132-
int64_t nNextAddrSend GUARDED_BY(cs_sendProcessing){0};
1133-
int64_t nNextLocalAddrSend GUARDED_BY(cs_sendProcessing){0};
1132+
std::chrono::microseconds m_next_addr_send GUARDED_BY(cs_sendProcessing){0};
1133+
std::chrono::microseconds m_next_local_addr_send GUARDED_BY(cs_sendProcessing){0};
11341134

11351135
// Don't relay addr messages to peers that we connect to as block-relay-only
11361136
// peers (to prevent adversaries from inferring these links from addr

src/net_processing.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ static const int MAX_UNCONNECTING_HEADERS = 10;
138138
static const unsigned int NODE_NETWORK_LIMITED_MIN_BLOCKS = 288;
139139

140140
/** Average delay between local address broadcasts in seconds. */
141-
static constexpr unsigned int AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL = 24 * 60 * 60;
141+
static constexpr std::chrono::hours AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL{24};
142142
/** Average delay between peer address broadcasts in seconds. */
143-
static const unsigned int AVG_ADDRESS_BROADCAST_INTERVAL = 30;
143+
static constexpr std::chrono::seconds AVG_ADDRESS_BROADCAST_INTERVAL{30};
144144
/** Average delay between trickled inventory transmissions in seconds.
145145
* Blocks and peers with noban permission bypass this, regular outbound peers get half this delay,
146146
* Masternode outbound peers get quarter this delay. */
@@ -1889,13 +1889,13 @@ void RelayTransaction(const uint256& txid, const CConnman& connman)
18891889
});
18901890
}
18911891

1892-
static void RelayAddress(const CAddress& addr, bool fReachable, CConnman& connman)
1892+
static void RelayAddress(const CAddress& addr, bool fReachable, const CConnman& connman)
18931893
{
18941894
// Relay to a limited number of other nodes
18951895
// Use deterministic randomness to send to the same nodes for 24 hours
18961896
// at a time so the m_addr_knowns of the chosen nodes prevent repeats
18971897
uint64_t hashAddr = addr.GetHash();
1898-
const CSipHasher hasher = connman.GetDeterministicRandomizer(RANDOMIZER_ID_ADDRESS_RELAY).Write(hashAddr << 32).Write((GetTime() + hashAddr) / (24*60*60));
1898+
const CSipHasher hasher = connman.GetDeterministicRandomizer(RANDOMIZER_ID_ADDRESS_RELAY).Write(hashAddr << 32).Write((GetTime() + hashAddr) / (24 * 60 * 60));
18991899
FastRandomContext insecure_rand;
19001900

19011901
// Relay reachable addresses to 2 peers. Unreachable addresses are relayed randomly to 1 or 2 peers.
@@ -4678,16 +4678,16 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
46784678
int64_t nNow = GetTimeMicros();
46794679
auto current_time = GetTime<std::chrono::microseconds>();
46804680

4681-
if (pto->IsAddrRelayPeer() && !m_chainman.ActiveChainstate().IsInitialBlockDownload() && pto->nNextLocalAddrSend < nNow) {
4681+
if (pto->IsAddrRelayPeer() && !m_chainman.ActiveChainstate().IsInitialBlockDownload() && pto->m_next_local_addr_send < current_time) {
46824682
AdvertiseLocal(pto);
4683-
pto->nNextLocalAddrSend = PoissonNextSend(nNow, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
4683+
pto->m_next_local_addr_send = PoissonNextSend(current_time, AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL);
46844684
}
46854685

46864686
//
46874687
// Message: addr
46884688
//
4689-
if (pto->IsAddrRelayPeer() && pto->nNextAddrSend < nNow) {
4690-
pto->nNextAddrSend = PoissonNextSend(nNow, AVG_ADDRESS_BROADCAST_INTERVAL);
4689+
if (pto->IsAddrRelayPeer() && pto->m_next_addr_send < current_time) {
4690+
pto->m_next_addr_send = PoissonNextSend(current_time, AVG_ADDRESS_BROADCAST_INTERVAL);
46914691
std::vector<CAddress> vAddr;
46924692
vAddr.reserve(pto->vAddrToSend.size());
46934693

src/qt/walletmodel.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ class WalletModel : public QObject
151151
interfaces::Node& node() const { return m_node; }
152152
interfaces::Wallet& wallet() const { return *m_wallet; }
153153
void setClientModel(ClientModel* client_model);
154-
ClientModel& clientModel() const { return *m_client_model; }
155154
interfaces::CoinJoin::Client& coinJoin() const { return m_wallet->coinJoin(); }
156155

157156
QString getWalletName() const;

src/rpc/blockchain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2946,6 +2946,8 @@ UniValue CreateUTXOSnapshot(NodeContext& node, CChainState& chainstate, CAutoFil
29462946
return result;
29472947
}
29482948

2949+
void RegisterBlockchainRPCCommands(CRPCTable &t)
2950+
{
29492951
// clang-format off
29502952
static const CRPCCommand commands[] =
29512953
{ // category name actor (function) argNames
@@ -2991,8 +2993,6 @@ static const CRPCCommand commands[] =
29912993
};
29922994
// clang-format on
29932995

2994-
void RegisterBlockchainRPCCommands(CRPCTable &t)
2995-
{
29962996
for (const auto& command : commands) {
29972997
t.appendCommand(command.name, &command);
29982998
}

src/rpc/coinjoin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ static UniValue getcoinjoininfo(const JSONRPCRequest& request)
170170

171171
return obj;
172172
}
173+
void RegisterCoinJoinRPCCommands(CRPCTable &t)
174+
{
173175
// clang-format off
174176
static const CRPCCommand commands[] =
175177
{ // category name actor (function) argNames
@@ -181,8 +183,6 @@ static const CRPCCommand commands[] =
181183
#endif // ENABLE_WALLET
182184
};
183185
// clang-format on
184-
void RegisterCoinJoinRPCCommands(CRPCTable &t)
185-
{
186186
for (const auto& command : commands) {
187187
t.appendCommand(command.name, &command);
188188
}

src/rpc/evo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,6 +1755,8 @@ static UniValue _bls(const JSONRPCRequest& request)
17551755
bls_help();
17561756
}
17571757
}
1758+
void RegisterEvoRPCCommands(CRPCTable &tableRPC)
1759+
{
17581760
// clang-format off
17591761
static const CRPCCommand commands[] =
17601762
{ // category name actor (function)
@@ -1763,8 +1765,6 @@ static const CRPCCommand commands[] =
17631765
{ "evo", "protx", &protx, {} },
17641766
};
17651767
// clang-format on
1766-
void RegisterEvoRPCCommands(CRPCTable &tableRPC)
1767-
{
17681768
for (const auto& command : commands) {
17691769
tableRPC.appendCommand(command.name, &command);
17701770
}

src/rpc/governance.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,8 @@ static UniValue getsuperblockbudget(const JSONRPCRequest& request)
11911191

11921192
return ValueFromAmount(CSuperblock::GetPaymentsLimit(nBlockHeight));
11931193
}
1194+
void RegisterGovernanceRPCCommands(CRPCTable &t)
1195+
{
11941196
// clang-format off
11951197
static const CRPCCommand commands[] =
11961198
{ // category name actor (function) argNames
@@ -1203,8 +1205,6 @@ static const CRPCCommand commands[] =
12031205

12041206
};
12051207
// clang-format on
1206-
void RegisterGovernanceRPCCommands(CRPCTable &t)
1207-
{
12081208
for (const auto& command : commands) {
12091209
t.appendCommand(command.name, &command);
12101210
}

src/rpc/masternode.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,9 @@ static UniValue masternodelist(const JSONRPCRequest& request, ChainstateManager&
736736

737737
return obj;
738738
}
739+
740+
void RegisterMasternodeRPCCommands(CRPCTable &t)
741+
{
739742
// clang-format off
740743
static const CRPCCommand commands[] =
741744
{ // category name actor (function) argNames
@@ -744,8 +747,6 @@ static const CRPCCommand commands[] =
744747
{ "dash", "masternodelist", &masternode, {} },
745748
};
746749
// clang-format on
747-
void RegisterMasternodeRPCCommands(CRPCTable &t)
748-
{
749750
for (const auto& command : commands) {
750751
t.appendCommand(command.name, &command);
751752
}

src/rpc/mining.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,8 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
12491249
return result;
12501250
}
12511251

1252+
void RegisterMiningRPCCommands(CRPCTable &t)
1253+
{
12521254
// clang-format off
12531255
static const CRPCCommand commands[] =
12541256
{ // category name actor (function) argNames
@@ -1276,8 +1278,6 @@ static const CRPCCommand commands[] =
12761278
};
12771279
// clang-format on
12781280

1279-
void RegisterMiningRPCCommands(CRPCTable &t)
1280-
{
12811281
for (const auto& command : commands) {
12821282
t.appendCommand(command.name, &command);
12831283
}

0 commit comments

Comments
 (0)