mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge #9659: Net: Turn some methods and params/variables const
0729102Net: pass interruptMsgProc as const where possible (Jorge Timón)fc7f2ffNet: Make CNetMsgMaker more const (Jorge Timón)d45955fNet: CConnman: Make some methods const (Jorge Timón)
This commit is contained in:
@@ -778,7 +778,7 @@ static uint256 most_recent_block_hash;
|
||||
|
||||
void PeerLogicValidation::NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& pblock) {
|
||||
std::shared_ptr<const CBlockHeaderAndShortTxIDs> pcmpctblock = std::make_shared<const CBlockHeaderAndShortTxIDs> (*pblock, true);
|
||||
CNetMsgMaker msgMaker(PROTOCOL_VERSION);
|
||||
const CNetMsgMaker msgMaker(PROTOCOL_VERSION);
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
@@ -956,11 +956,11 @@ static void RelayAddress(const CAddress& addr, bool fReachable, CConnman& connma
|
||||
connman.ForEachNodeThen(std::move(sortfunc), std::move(pushfunc));
|
||||
}
|
||||
|
||||
void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParams, CConnman& connman, std::atomic<bool>& interruptMsgProc)
|
||||
void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParams, CConnman& connman, const std::atomic<bool>& interruptMsgProc)
|
||||
{
|
||||
std::deque<CInv>::iterator it = pfrom->vRecvGetData.begin();
|
||||
std::vector<CInv> vNotFound;
|
||||
CNetMsgMaker msgMaker(pfrom->GetSendVersion());
|
||||
const CNetMsgMaker msgMaker(pfrom->GetSendVersion());
|
||||
LOCK(cs_main);
|
||||
|
||||
while (it != pfrom->vRecvGetData.end()) {
|
||||
@@ -1153,12 +1153,12 @@ inline void static SendBlockTransactions(const CBlock& block, const BlockTransac
|
||||
resp.txn[i] = block.vtx[req.indexes[i]];
|
||||
}
|
||||
LOCK(cs_main);
|
||||
CNetMsgMaker msgMaker(pfrom->GetSendVersion());
|
||||
const CNetMsgMaker msgMaker(pfrom->GetSendVersion());
|
||||
int nSendFlags = State(pfrom->GetId())->fWantsCmpctWitness ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS;
|
||||
connman.PushMessage(pfrom, msgMaker.Make(nSendFlags, NetMsgType::BLOCKTXN, resp));
|
||||
}
|
||||
|
||||
bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vRecv, int64_t nTimeReceived, const CChainParams& chainparams, CConnman& connman, std::atomic<bool>& interruptMsgProc)
|
||||
bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, int64_t nTimeReceived, const CChainParams& chainparams, CConnman& connman, const std::atomic<bool>& interruptMsgProc)
|
||||
{
|
||||
LogPrint("net", "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id);
|
||||
if (IsArgSet("-dropmessagestest") && GetRand(GetArg("-dropmessagestest", 0)) == 0)
|
||||
@@ -1354,7 +1354,7 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
|
||||
}
|
||||
|
||||
// At this point, the outgoing message serialization version can't change.
|
||||
CNetMsgMaker msgMaker(pfrom->GetSendVersion());
|
||||
const CNetMsgMaker msgMaker(pfrom->GetSendVersion());
|
||||
|
||||
if (strCommand == NetMsgType::VERACK)
|
||||
{
|
||||
@@ -2588,7 +2588,7 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ProcessMessages(CNode* pfrom, CConnman& connman, std::atomic<bool>& interruptMsgProc)
|
||||
bool ProcessMessages(CNode* pfrom, CConnman& connman, const std::atomic<bool>& interruptMsgProc)
|
||||
{
|
||||
const CChainParams& chainparams = Params();
|
||||
//
|
||||
@@ -2721,7 +2721,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interruptMsgProc)
|
||||
bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interruptMsgProc)
|
||||
{
|
||||
const Consensus::Params& consensusParams = Params().GetConsensus();
|
||||
{
|
||||
@@ -2730,7 +2730,7 @@ bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interruptMsg
|
||||
return true;
|
||||
|
||||
// If we get here, the outgoing message serialization version is set and can't change.
|
||||
CNetMsgMaker msgMaker(pto->GetSendVersion());
|
||||
const CNetMsgMaker msgMaker(pto->GetSendVersion());
|
||||
|
||||
//
|
||||
// Message: ping
|
||||
|
||||
Reference in New Issue
Block a user