Skip to content

Commit 588c04c

Browse files
committed
Missing from commit ab14f19 cherrypick
1 parent 1f73868 commit 588c04c

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

src/llmq/quorums_signing_shares.cpp

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,25 +1231,6 @@ bool CSigSharesManager::SendMessages()
12311231
}
12321232
}
12331233

1234-
auto lt = sigSharesToSend.find(pnode->GetId());
1235-
if (lt != sigSharesToSend.end()) {
1236-
std::vector<CSigShare> msgs;
1237-
for (auto& sigShare : lt->second) {
1238-
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::SendMessages -- QSIGSHARE signHash=%s, node=%d\n",
1239-
sigShare.GetSignHash().ToString(), pnode->GetId());
1240-
msgs.emplace_back(std::move(sigShare));
1241-
if (msgs.size() == MAX_MSGS_SIG_SHARES) {
1242-
g_connman->PushMessage(pnode, msgMaker.Make(NetMsgType::QSIGSHARE, msgs));
1243-
msgs.clear();
1244-
didSend = true;
1245-
}
1246-
}
1247-
if (!msgs.empty()) {
1248-
g_connman->PushMessage(pnode, msgMaker.Make(NetMsgType::QSIGSHARE, msgs));
1249-
didSend = true;
1250-
}
1251-
}
1252-
12531234
auto lt = sigSharesToSend.find(pnode->GetId());
12541235
if (lt != sigSharesToSend.end()) {
12551236
std::vector<CSigShare> msgs;
@@ -1258,13 +1239,13 @@ bool CSigSharesManager::SendMessages()
12581239
sigShare.GetSignHash().ToString(), pnode->GetId());
12591240
msgs.emplace_back(std::move(sigShare));
12601241
if (msgs.size() == MAX_MSGS_SIG_SHARES) {
1261-
g_connman->PushMessage(pnode, msgMaker.Make(NetMsgType::QSIGSHARE, msgs), false);
1242+
g_connman->PushMessage(pnode, msgMaker.Make(NetMsgType::QSIGSHARE, msgs));
12621243
msgs.clear();
12631244
didSend = true;
12641245
}
12651246
}
12661247
if (!msgs.empty()) {
1267-
g_connman->PushMessage(pnode, msgMaker.Make(NetMsgType::QSIGSHARE, msgs), false);
1248+
g_connman->PushMessage(pnode, msgMaker.Make(NetMsgType::QSIGSHARE, msgs));
12681249
didSend = true;
12691250
}
12701251
}

src/net.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,10 +1193,10 @@ void CConnman::DisconnectNodes()
11931193

11941194
if (fLogIPs) {
11951195
LogPrintf("ThreadSocketHandler -- removing node: peer=%d addr=%s nRefCount=%d fInbound=%d fMasternode=%d\n",
1196-
pnode->GetId(), pnode->addr.ToString(), pnode->GetRefCount(), pnode->fInbound, pnode->fMasternode);
1196+
pnode->GetId(), pnode->addr.ToString(), pnode->GetRefCount(), pnode->fInbound, fMasterNode);
11971197
} else {
11981198
LogPrintf("ThreadSocketHandler -- removing node: peer=%d nRefCount=%d fInbound=%d fMasternode=%d\n",
1199-
pnode->GetId(), pnode->GetRefCount(), pnode->fInbound, pnode->fMasternode);
1199+
pnode->GetId(), pnode->GetRefCount(), pnode->fInbound, fMasterNode);
12001200
}
12011201

12021202
// remove from vNodes

src/net.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class CConnman
215215
bool ForNode(NodeId id, std::function<bool(CNode* pnode)> func);
216216
bool ForNode(const CService& addr, const std::function<bool(const CNode* pnode)>& cond, const std::function<bool(CNode* pnode)>& func);
217217

218-
void PushMessage(CNode* pnode, CSerializedNetMsg&& msg, bool allowOptimisticSend = DEFAULT_ALLOW_OPTIMISTIC_SEND);
218+
void PushMessage(CNode* pnode, CSerializedNetMsg&& msg);
219219

220220
template<typename Callable>
221221
bool ForEachNodeContinueIf(Callable&& func)
@@ -264,6 +264,16 @@ class CConnman
264264
}
265265
};
266266

267+
template<typename Condition, typename Callable>
268+
void ForEachNode(const Condition& cond, Callable&& func) const
269+
{
270+
LOCK(cs_vNodes);
271+
for (auto&& node : vNodes) {
272+
if (cond(node))
273+
func(node);
274+
}
275+
};
276+
267277
template<typename Callable, typename CallableAfter>
268278
void ForEachNodeThen(Callable&& pre, CallableAfter&& post)
269279
{

src/net_processing.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@ class CNodeBlocks
191191
size_t maxAvg;
192192
};
193193

194-
194+
struct CBlockReject {
195+
unsigned char chRejectCode;
196+
std::string strRejectReason;
197+
uint256 hashBlock;
198+
};
195199

196200
/**
197201
* Maintain validation-specific state about nodes, protected by cs_main, instead
@@ -210,6 +214,8 @@ struct CNodeState {
210214
bool fShouldBan;
211215
//! String name of this peer (debugging/logging purposes).
212216
const std::string name;
217+
//! List of asynchronously-determined block rejections to notify this peer about.
218+
std::vector<CBlockReject> rejects;
213219
//! The best known block we know this peer has announced.
214220
const CBlockIndex* pindexBestKnownBlock;
215221
//! The hash of the last unknown block this peer has announced.

src/protocol.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace NetMsgType
1818
{
1919
const char* VERSION = "version";
2020
const char* VERACK = "verack";
21+
const char* REJECT = "reject";
2122
const char* ADDR = "addr";
2223
const char* ADDRV2="addrv2";
2324
const char* SENDADDRV2="sendaddrv2";
@@ -76,6 +77,7 @@ const char* CLSIG = "clsig";
7677
const static std::string allNetMessageTypes[] = {
7778
NetMsgType::VERSION,
7879
NetMsgType::VERACK,
80+
NetMsgType::REJECT,
7981
NetMsgType::ADDR,
8082
NetMsgType::ADDRV2,
8183
NetMsgType::SENDADDRV2,

src/protocol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ extern const char* VERSION;
7575
* @see https://bitcoin.org/en/developer-reference#verack
7676
*/
7777
extern const char* VERACK;
78+
extern const char* REJECT;
7879
/**
7980
* The addr (IP address) message relays connection information for peers on the
8081
* network.

0 commit comments

Comments
 (0)