Merge #13946: p2p: Clarify control flow in ProcessMessage
fa6c3dea420b6c50c164ccc34f4e9e8a7d9a8022 p2p: Clarify control flow in ProcessMessage() (MarcoFalke) Pull request description: `ProcessMessage` is effectively a massive switch case construct. In the past there were attempts to clarify the control flow in `ProcessMessage()` by moving each case into a separate static function (see #9608). It was closed because it wasn't clear if moving each case into a function was the right approach. Though, we can quasi treat each case as a function by adding a return statement to each case. (Can be seen as a continuation of bugfix #13162) This patch does exactly that. Also note that this patch is a subset of previous approaches such as #9608 and #10145. Review suggestion: `git diff HEAD~ --function-context` Tree-SHA512: 91f6106840de2f29bb4f10d27bae0616b03a91126e6c6013479e1dd79bee53f22a78902b631fe85517dd5dc0fa7239939b4fefc231851a13c819458559f6c201
This commit is contained in:
parent
dbbc51121c
commit
e5e3572e9d
@ -1791,8 +1791,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strCommand == NetMsgType::VERSION)
|
if (strCommand == NetMsgType::VERSION) {
|
||||||
{
|
|
||||||
// Each connection can only send one version message
|
// Each connection can only send one version message
|
||||||
if (pfrom->nVersion != 0)
|
if (pfrom->nVersion != 0)
|
||||||
{
|
{
|
||||||
@ -1962,9 +1961,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pfrom->nVersion == 0) {
|
||||||
else if (pfrom->nVersion == 0)
|
|
||||||
{
|
|
||||||
// Must have a version message before anything else
|
// Must have a version message before anything else
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
Misbehaving(pfrom->GetId(), 1);
|
Misbehaving(pfrom->GetId(), 1);
|
||||||
@ -2029,18 +2026,17 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
}
|
}
|
||||||
|
|
||||||
pfrom->fSuccessfullyConnected = true;
|
pfrom->fSuccessfullyConnected = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!pfrom->fSuccessfullyConnected)
|
if (!pfrom->fSuccessfullyConnected) {
|
||||||
{
|
|
||||||
// Must have a verack message before anything else
|
// Must have a verack message before anything else
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
Misbehaving(pfrom->GetId(), 1);
|
Misbehaving(pfrom->GetId(), 1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strCommand == NetMsgType::ADDR)
|
if (strCommand == NetMsgType::ADDR) {
|
||||||
{
|
|
||||||
std::vector<CAddress> vAddr;
|
std::vector<CAddress> vAddr;
|
||||||
vRecv >> vAddr;
|
vRecv >> vAddr;
|
||||||
|
|
||||||
@ -2086,17 +2082,16 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
pfrom->fGetAddr = false;
|
pfrom->fGetAddr = false;
|
||||||
if (pfrom->fOneShot)
|
if (pfrom->fOneShot)
|
||||||
pfrom->fDisconnect = true;
|
pfrom->fDisconnect = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strCommand == NetMsgType::SENDHEADERS)
|
if (strCommand == NetMsgType::SENDHEADERS) {
|
||||||
{
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
State(pfrom->GetId())->fPreferHeaders = true;
|
State(pfrom->GetId())->fPreferHeaders = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::SENDCMPCT) {
|
||||||
else if (strCommand == NetMsgType::SENDCMPCT)
|
|
||||||
{
|
|
||||||
bool fAnnounceUsingCMPCTBLOCK = false;
|
bool fAnnounceUsingCMPCTBLOCK = false;
|
||||||
uint64_t nCMPCTBLOCKVersion = 1;
|
uint64_t nCMPCTBLOCKVersion = 1;
|
||||||
vRecv >> fAnnounceUsingCMPCTBLOCK >> nCMPCTBLOCKVersion;
|
vRecv >> fAnnounceUsingCMPCTBLOCK >> nCMPCTBLOCKVersion;
|
||||||
@ -2106,6 +2101,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
State(pfrom->GetId())->fPreferHeaderAndIDs = fAnnounceUsingCMPCTBLOCK;
|
State(pfrom->GetId())->fPreferHeaderAndIDs = fAnnounceUsingCMPCTBLOCK;
|
||||||
State(pfrom->GetId())->fSupportsDesiredCmpctVersion = true;
|
State(pfrom->GetId())->fSupportsDesiredCmpctVersion = true;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2123,9 +2119,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
pfrom->fSendRecSigs = b;
|
pfrom->fSendRecSigs = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::INV) {
|
||||||
else if (strCommand == NetMsgType::INV)
|
|
||||||
{
|
|
||||||
std::vector<CInv> vInv;
|
std::vector<CInv> vInv;
|
||||||
vRecv >> vInv;
|
vRecv >> vInv;
|
||||||
if (vInv.size() > MAX_INV_SZ)
|
if (vInv.size() > MAX_INV_SZ)
|
||||||
@ -2219,11 +2213,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
// Track requests for our stuff
|
// Track requests for our stuff
|
||||||
GetMainSignals().Inventory(inv.hash);
|
GetMainSignals().Inventory(inv.hash);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::GETDATA) {
|
||||||
else if (strCommand == NetMsgType::GETDATA)
|
|
||||||
{
|
|
||||||
std::vector<CInv> vInv;
|
std::vector<CInv> vInv;
|
||||||
vRecv >> vInv;
|
vRecv >> vInv;
|
||||||
if (vInv.size() > MAX_INV_SZ)
|
if (vInv.size() > MAX_INV_SZ)
|
||||||
@ -2241,11 +2234,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
|
|
||||||
pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end());
|
pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end());
|
||||||
ProcessGetData(pfrom, chainparams.GetConsensus(), connman, interruptMsgProc);
|
ProcessGetData(pfrom, chainparams.GetConsensus(), connman, interruptMsgProc);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::GETBLOCKS) {
|
||||||
else if (strCommand == NetMsgType::GETBLOCKS)
|
|
||||||
{
|
|
||||||
CBlockLocator locator;
|
CBlockLocator locator;
|
||||||
uint256 hashStop;
|
uint256 hashStop;
|
||||||
vRecv >> locator >> hashStop;
|
vRecv >> locator >> hashStop;
|
||||||
@ -2302,11 +2294,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::GETBLOCKTXN) {
|
||||||
else if (strCommand == NetMsgType::GETBLOCKTXN)
|
|
||||||
{
|
|
||||||
BlockTransactionsRequest req;
|
BlockTransactionsRequest req;
|
||||||
vRecv >> req;
|
vRecv >> req;
|
||||||
|
|
||||||
@ -2352,11 +2343,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
SendBlockTransactions(block, req, pfrom, connman);
|
SendBlockTransactions(block, req, pfrom, connman);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::GETHEADERS) {
|
||||||
else if (strCommand == NetMsgType::GETHEADERS)
|
|
||||||
{
|
|
||||||
CBlockLocator locator;
|
CBlockLocator locator;
|
||||||
uint256 hashStop;
|
uint256 hashStop;
|
||||||
vRecv >> locator >> hashStop;
|
vRecv >> locator >> hashStop;
|
||||||
@ -2414,11 +2404,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
// in the SendMessages logic.
|
// in the SendMessages logic.
|
||||||
nodestate->pindexBestHeaderSent = pindex ? pindex : chainActive.Tip();
|
nodestate->pindexBestHeaderSent = pindex ? pindex : chainActive.Tip();
|
||||||
connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::HEADERS, vHeaders));
|
connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::HEADERS, vHeaders));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::TX || strCommand == NetMsgType::DSTX || strCommand == NetMsgType::LEGACYTXLOCKREQUEST) {
|
||||||
else if (strCommand == NetMsgType::TX || strCommand == NetMsgType::DSTX || strCommand == NetMsgType::LEGACYTXLOCKREQUEST)
|
|
||||||
{
|
|
||||||
// Stop processing the transaction early if
|
// Stop processing the transaction early if
|
||||||
// We are in blocks only mode and peer is either not whitelisted or whitelistrelay is off
|
// We are in blocks only mode and peer is either not whitelisted or whitelistrelay is off
|
||||||
if (!fRelayTxes && (!pfrom->fWhitelisted || !gArgs.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)))
|
if (!fRelayTxes && (!pfrom->fWhitelisted || !gArgs.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)))
|
||||||
@ -2606,9 +2595,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
Misbehaving(pfrom->GetId(), nDoS);
|
Misbehaving(pfrom->GetId(), nDoS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strCommand == NetMsgType::CMPCTBLOCK && !fImporting && !fReindex) // Ignore blocks received while importing
|
if (strCommand == NetMsgType::CMPCTBLOCK && !fImporting && !fReindex) // Ignore blocks received while importing
|
||||||
{
|
{
|
||||||
CBlockHeaderAndShortTxIDs cmpctblock;
|
CBlockHeaderAndShortTxIDs cmpctblock;
|
||||||
vRecv >> cmpctblock;
|
vRecv >> cmpctblock;
|
||||||
@ -2820,10 +2810,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
MarkBlockAsReceived(pblock->GetHash());
|
MarkBlockAsReceived(pblock->GetHash());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strCommand == NetMsgType::BLOCKTXN && !fImporting && !fReindex) // Ignore blocks received while importing
|
if (strCommand == NetMsgType::BLOCKTXN && !fImporting && !fReindex) // Ignore blocks received while importing
|
||||||
{
|
{
|
||||||
BlockTransactions resp;
|
BlockTransactions resp;
|
||||||
vRecv >> resp;
|
vRecv >> resp;
|
||||||
@ -2896,10 +2886,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
mapBlockSource.erase(pblock->GetHash());
|
mapBlockSource.erase(pblock->GetHash());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::HEADERS && !fImporting && !fReindex) // Ignore headers received while importing
|
||||||
else if (strCommand == NetMsgType::HEADERS && !fImporting && !fReindex) // Ignore headers received while importing
|
|
||||||
{
|
{
|
||||||
std::vector<CBlockHeader> headers;
|
std::vector<CBlockHeader> headers;
|
||||||
|
|
||||||
@ -2924,7 +2914,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
return ProcessHeadersMessage(pfrom, connman, headers, chainparams, should_punish);
|
return ProcessHeadersMessage(pfrom, connman, headers, chainparams, should_punish);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strCommand == NetMsgType::BLOCK && !fImporting && !fReindex) // Ignore blocks received while importing
|
if (strCommand == NetMsgType::BLOCK && !fImporting && !fReindex) // Ignore blocks received while importing
|
||||||
{
|
{
|
||||||
std::shared_ptr<CBlock> pblock = std::make_shared<CBlock>();
|
std::shared_ptr<CBlock> pblock = std::make_shared<CBlock>();
|
||||||
vRecv >> *pblock;
|
vRecv >> *pblock;
|
||||||
@ -2950,11 +2940,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
mapBlockSource.erase(pblock->GetHash());
|
mapBlockSource.erase(pblock->GetHash());
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::GETADDR) {
|
||||||
else if (strCommand == NetMsgType::GETADDR)
|
|
||||||
{
|
|
||||||
// This asymmetric behavior for inbound and outbound connections was introduced
|
// This asymmetric behavior for inbound and outbound connections was introduced
|
||||||
// to prevent a fingerprinting attack: an attacker can send specific fake addresses
|
// to prevent a fingerprinting attack: an attacker can send specific fake addresses
|
||||||
// to users' AddrMan and later request them by sending getaddr messages.
|
// to users' AddrMan and later request them by sending getaddr messages.
|
||||||
@ -2978,11 +2967,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
FastRandomContext insecure_rand;
|
FastRandomContext insecure_rand;
|
||||||
for (const CAddress &addr : vAddr)
|
for (const CAddress &addr : vAddr)
|
||||||
pfrom->PushAddress(addr, insecure_rand);
|
pfrom->PushAddress(addr, insecure_rand);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::MEMPOOL) {
|
||||||
else if (strCommand == NetMsgType::MEMPOOL)
|
|
||||||
{
|
|
||||||
if (!(pfrom->GetLocalServices() & NODE_BLOOM) && !pfrom->fWhitelisted)
|
if (!(pfrom->GetLocalServices() & NODE_BLOOM) && !pfrom->fWhitelisted)
|
||||||
{
|
{
|
||||||
LogPrint(BCLog::NET, "mempool request with bloom filters disabled, disconnect peer=%d\n", pfrom->GetId());
|
LogPrint(BCLog::NET, "mempool request with bloom filters disabled, disconnect peer=%d\n", pfrom->GetId());
|
||||||
@ -2999,11 +2987,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
|
|
||||||
LOCK(pfrom->cs_inventory);
|
LOCK(pfrom->cs_inventory);
|
||||||
pfrom->fSendMempool = true;
|
pfrom->fSendMempool = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::PING) {
|
||||||
else if (strCommand == NetMsgType::PING)
|
|
||||||
{
|
|
||||||
if (pfrom->nVersion > BIP0031_VERSION)
|
if (pfrom->nVersion > BIP0031_VERSION)
|
||||||
{
|
{
|
||||||
uint64_t nonce = 0;
|
uint64_t nonce = 0;
|
||||||
@ -3021,11 +3008,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
// return very quickly.
|
// return very quickly.
|
||||||
connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::PONG, nonce));
|
connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::PONG, nonce));
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::PONG) {
|
||||||
else if (strCommand == NetMsgType::PONG)
|
|
||||||
{
|
|
||||||
int64_t pingUsecEnd = nTimeReceived;
|
int64_t pingUsecEnd = nTimeReceived;
|
||||||
uint64_t nonce = 0;
|
uint64_t nonce = 0;
|
||||||
size_t nAvail = vRecv.in_avail();
|
size_t nAvail = vRecv.in_avail();
|
||||||
@ -3078,11 +3064,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
if (bPingFinished) {
|
if (bPingFinished) {
|
||||||
pfrom->nPingNonceSent = 0;
|
pfrom->nPingNonceSent = 0;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::FILTERLOAD) {
|
||||||
else if (strCommand == NetMsgType::FILTERLOAD)
|
|
||||||
{
|
|
||||||
CBloomFilter filter;
|
CBloomFilter filter;
|
||||||
vRecv >> filter;
|
vRecv >> filter;
|
||||||
|
|
||||||
@ -3100,11 +3085,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
pfrom->pfilter->UpdateEmptyFull();
|
pfrom->pfilter->UpdateEmptyFull();
|
||||||
pfrom->fRelayTxes = true;
|
pfrom->fRelayTxes = true;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::FILTERADD) {
|
||||||
else if (strCommand == NetMsgType::FILTERADD)
|
|
||||||
{
|
|
||||||
std::vector<unsigned char> vData;
|
std::vector<unsigned char> vData;
|
||||||
vRecv >> vData;
|
vRecv >> vData;
|
||||||
|
|
||||||
@ -3125,21 +3109,21 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
Misbehaving(pfrom->GetId(), 100);
|
Misbehaving(pfrom->GetId(), 100);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == NetMsgType::FILTERCLEAR) {
|
||||||
else if (strCommand == NetMsgType::FILTERCLEAR)
|
|
||||||
{
|
|
||||||
LOCK(pfrom->cs_filter);
|
LOCK(pfrom->cs_filter);
|
||||||
if (pfrom->GetLocalServices() & NODE_BLOOM) {
|
if (pfrom->GetLocalServices() & NODE_BLOOM) {
|
||||||
delete pfrom->pfilter;
|
delete pfrom->pfilter;
|
||||||
pfrom->pfilter = new CBloomFilter();
|
pfrom->pfilter = new CBloomFilter();
|
||||||
}
|
}
|
||||||
pfrom->fRelayTxes = true;
|
pfrom->fRelayTxes = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (strCommand == NetMsgType::GETMNLISTDIFF) {
|
if (strCommand == NetMsgType::GETMNLISTDIFF) {
|
||||||
CGetSimplifiedMNListDiff cmd;
|
CGetSimplifiedMNListDiff cmd;
|
||||||
vRecv >> cmd;
|
vRecv >> cmd;
|
||||||
|
|
||||||
@ -3153,57 +3137,57 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|||||||
LogPrint(BCLog::NET, "getmnlistdiff failed for baseBlockHash=%s, blockHash=%s. error=%s\n", cmd.baseBlockHash.ToString(), cmd.blockHash.ToString(), strError);
|
LogPrint(BCLog::NET, "getmnlistdiff failed for baseBlockHash=%s, blockHash=%s. error=%s\n", cmd.baseBlockHash.ToString(), cmd.blockHash.ToString(), strError);
|
||||||
Misbehaving(pfrom->GetId(), 1);
|
Misbehaving(pfrom->GetId(), 1);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (strCommand == NetMsgType::MNLISTDIFF) {
|
if (strCommand == NetMsgType::MNLISTDIFF) {
|
||||||
// we have never requested this
|
// we have never requested this
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
Misbehaving(pfrom->GetId(), 100);
|
Misbehaving(pfrom->GetId(), 100);
|
||||||
LogPrint(BCLog::NET, "received not-requested mnlistdiff. peer=%d\n", pfrom->GetId());
|
LogPrint(BCLog::NET, "received not-requested mnlistdiff. peer=%d\n", pfrom->GetId());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (strCommand == NetMsgType::NOTFOUND) {
|
if (strCommand == NetMsgType::NOTFOUND) {
|
||||||
// We do not care about the NOTFOUND message, but logging an Unknown Command
|
// We do not care about the NOTFOUND message, but logging an Unknown Command
|
||||||
// message would be undesirable as we transmit it ourselves.
|
// message would be undesirable as we transmit it ourselves.
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
bool found = false;
|
||||||
bool found = false;
|
const std::vector<std::string> &allMessages = getAllNetMessageTypes();
|
||||||
const std::vector<std::string> &allMessages = getAllNetMessageTypes();
|
for (const std::string msg : allMessages) {
|
||||||
for (const std::string msg : allMessages) {
|
if(msg == strCommand) {
|
||||||
if(msg == strCommand) {
|
found = true;
|
||||||
found = true;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
//probably one the extensions
|
//probably one the extensions
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
privateSendClient.ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
privateSendClient.ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
||||||
#endif // ENABLE_WALLET
|
#endif // ENABLE_WALLET
|
||||||
privateSendServer.ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
privateSendServer.ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
||||||
sporkManager.ProcessSpork(pfrom, strCommand, vRecv, *connman);
|
sporkManager.ProcessSpork(pfrom, strCommand, vRecv, *connman);
|
||||||
masternodeSync.ProcessMessage(pfrom, strCommand, vRecv);
|
masternodeSync.ProcessMessage(pfrom, strCommand, vRecv);
|
||||||
governance.ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
governance.ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
||||||
CMNAuth::ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
CMNAuth::ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
||||||
llmq::quorumBlockProcessor->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
llmq::quorumBlockProcessor->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
||||||
llmq::quorumDKGSessionManager->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
llmq::quorumDKGSessionManager->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
||||||
llmq::quorumSigSharesManager->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
llmq::quorumSigSharesManager->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
||||||
llmq::quorumSigningManager->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
llmq::quorumSigningManager->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
||||||
llmq::chainLocksHandler->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
llmq::chainLocksHandler->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
||||||
llmq::quorumInstantSendManager->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
llmq::quorumInstantSendManager->ProcessMessage(pfrom, strCommand, vRecv, *connman);
|
||||||
}
|
return true;
|
||||||
else
|
|
||||||
{
|
|
||||||
// Ignore unknown commands for extensibility
|
|
||||||
LogPrint(BCLog::NET, "Unknown command \"%s\" from peer=%d\n", SanitizeString(strCommand), pfrom->GetId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ignore unknown commands for extensibility
|
||||||
|
LogPrint(BCLog::NET, "Unknown command \"%s\" from peer=%d\n", SanitizeString(strCommand), pfrom->GetId());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user