Merge #10189: devtools/net: add a verifier for scriptable changes. Use it to make CNode::id private.
0f3471f net: make CNode's id private (Cory Fields) 9ff0a51 scripted-diff: net: Use accessor rather than node's id directly (Cory Fields) e50c33e devtools: add script to verify scriptable changes (Cory Fields) skipped travis changes Tree-SHA512: a0ff50f4e1d38a2b63109b4996546c91b3e02e00d92c0bf04f48792948f78b1f6d9227a15d25c823fd4723a0277fc6a32c2c1287c7abbb7e50fd82ffb0f8d994 pnode->id to pnode->GetId() Signed-off-by: Pasta <pasta@dashboost.org>
This commit is contained in:
parent
d6e83980da
commit
2edd094a21
39
contrib/devtools/commit-script-check.sh
Executable file
39
contrib/devtools/commit-script-check.sh
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2017 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
# This simple script checks for commits beginning with: scripted-diff:
|
||||
# If found, looks for a script between the lines -BEGIN VERIFY SCRIPT- and
|
||||
# -END VERIFY SCRIPT-. If no ending is found, it reads until the end of the
|
||||
# commit message.
|
||||
|
||||
# The resulting script should exactly transform the previous commit into the current
|
||||
# one. Any remaining diff signals an error.
|
||||
|
||||
if test "x$1" = "x"; then
|
||||
echo "Usage: $0 <commit>..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RET=0
|
||||
PREV_BRANCH=`git name-rev --name-only HEAD`
|
||||
PREV_HEAD=`git rev-parse HEAD`
|
||||
for i in `git rev-list --reverse $1`; do
|
||||
git rev-list -n 1 --pretty="%s" $i | grep -q "^scripted-diff:" || continue
|
||||
git checkout --quiet $i^ || exit
|
||||
SCRIPT="`git rev-list --format=%b -n1 $i | sed '/^-BEGIN VERIFY SCRIPT-$/,/^-END VERIFY SCRIPT-$/{//!b};d'`"
|
||||
if test "x$SCRIPT" = "x"; then
|
||||
echo "Error: missing script for: $i"
|
||||
echo "Failed"
|
||||
RET=1
|
||||
else
|
||||
echo "Running script for: $i"
|
||||
echo "$SCRIPT"
|
||||
eval "$SCRIPT"
|
||||
git --no-pager diff --exit-code $i && echo "OK" || (echo "Failed"; false) || RET=1
|
||||
fi
|
||||
git reset --quiet --hard HEAD
|
||||
done
|
||||
git checkout --quiet $PREV_BRANCH 2>/dev/null || git checkout --quiet $PREV_HEAD
|
||||
exit $RET
|
@ -39,7 +39,7 @@ void CMNAuth::PushMNAUTH(CNode* pnode, CConnman& connman)
|
||||
mnauth.proRegTxHash = activeMasternodeInfo.proTxHash;
|
||||
mnauth.sig = activeMasternodeInfo.blsKeyOperator->Sign(signHash);
|
||||
|
||||
LogPrint(BCLog::NET, "CMNAuth::%s -- Sending MNAUTH, peer=%d\n", __func__, pnode->id);
|
||||
LogPrint(BCLog::NET, "CMNAuth::%s -- Sending MNAUTH, peer=%d\n", __func__, pnode->GetId());
|
||||
|
||||
connman.PushMessage(pnode, CNetMsgMaker(pnode->GetSendVersion()).Make(NetMsgType::MNAUTH, mnauth));
|
||||
}
|
||||
@ -60,14 +60,14 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS
|
||||
// only one MNAUTH allowed
|
||||
if (!pnode->verifiedProRegTxHash.IsNull()) {
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pnode->id, 100);
|
||||
Misbehaving(pnode->GetId(), 100);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mnauth.proRegTxHash.IsNull() || !mnauth.sig.IsValid()) {
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pnode->id, 100);
|
||||
Misbehaving(pnode->GetId(), 100);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS
|
||||
// in case he was unlucky and not up to date, just let him be connected as a regular node, which gives him
|
||||
// a chance to get up-to-date and thus realize by himself that he's not a MN anymore. We still give him a
|
||||
// low DoS score.
|
||||
Misbehaving(pnode->id, 10);
|
||||
Misbehaving(pnode->GetId(), 10);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -93,14 +93,14 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS
|
||||
LOCK(cs_main);
|
||||
// Same as above, MN seems to not know about his fate yet, so give him a chance to update. If this is a
|
||||
// malicious actor (DoSing us), we'll ban him soon.
|
||||
Misbehaving(pnode->id, 10);
|
||||
Misbehaving(pnode->GetId(), 10);
|
||||
return;
|
||||
}
|
||||
|
||||
connman.ForEachNode([&](CNode* pnode2) {
|
||||
if (pnode2->verifiedProRegTxHash == mnauth.proRegTxHash) {
|
||||
LogPrint(BCLog::NET, "CMNAuth::ProcessMessage -- Masternode %s has already verified as peer %d, dropping old connection. peer=%d\n",
|
||||
mnauth.proRegTxHash.ToString(), pnode2->id, pnode->id);
|
||||
mnauth.proRegTxHash.ToString(), pnode2->GetId(), pnode->GetId());
|
||||
pnode2->fDisconnect = true;
|
||||
}
|
||||
});
|
||||
@ -111,7 +111,7 @@ void CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataS
|
||||
pnode->verifiedPubKeyHash = dmn->pdmnState->pubKeyOperator.GetHash();
|
||||
}
|
||||
|
||||
LogPrint(BCLog::NET, "CMNAuth::%s -- Valid MNAUTH for %s, peer=%d\n", __func__, mnauth.proRegTxHash.ToString(), pnode->id);
|
||||
LogPrint(BCLog::NET, "CMNAuth::%s -- Valid MNAUTH for %s, peer=%d\n", __func__, mnauth.proRegTxHash.ToString(), pnode->GetId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ void CMNAuth::NotifyMasternodeListChanged(bool undo, const CDeterministicMNList&
|
||||
|
||||
if (doRemove) {
|
||||
LogPrint(BCLog::NET, "CMNAuth::NotifyMasternodeListChanged -- Disconnecting MN %s due to key changed/removed, peer=%d\n",
|
||||
pnode->verifiedProRegTxHash.ToString(), pnode->id);
|
||||
pnode->verifiedProRegTxHash.ToString(), pnode->GetId());
|
||||
pnode->fDisconnect = true;
|
||||
}
|
||||
});
|
||||
|
@ -94,7 +94,7 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
// ANOTHER USER IS ASKING US TO HELP THEM SYNC GOVERNANCE OBJECT DATA
|
||||
if (strCommand == NetMsgType::MNGOVERNANCESYNC) {
|
||||
if (pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) {
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCESYNC -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCESYNC -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_GOVERNANCE_PEER_PROTO_VERSION)));
|
||||
return;
|
||||
}
|
||||
@ -139,7 +139,7 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
}
|
||||
|
||||
if (pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) {
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECT -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECT -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_GOVERNANCE_PEER_PROTO_VERSION)));
|
||||
return;
|
||||
}
|
||||
@ -214,7 +214,7 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
}
|
||||
|
||||
if (pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) {
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECTVOTE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECTVOTE -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_GOVERNANCE_PEER_PROTO_VERSION)));
|
||||
}
|
||||
|
||||
@ -613,24 +613,24 @@ void CGovernanceManager::SyncSingleObjVotes(CNode* pnode, const uint256& nProp,
|
||||
|
||||
// SYNC GOVERNANCE OBJECTS WITH OTHER CLIENT
|
||||
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- syncing single object to peer=%d, nProp = %s\n", __func__, pnode->id, nProp.ToString());
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- syncing single object to peer=%d, nProp = %s\n", __func__, pnode->GetId(), nProp.ToString());
|
||||
|
||||
LOCK2(cs_main, cs);
|
||||
|
||||
// single valid object and its valid votes
|
||||
object_m_it it = mapObjects.find(nProp);
|
||||
if (it == mapObjects.end()) {
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- no matching object for hash %s, peer=%d\n", __func__, nProp.ToString(), pnode->id);
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- no matching object for hash %s, peer=%d\n", __func__, nProp.ToString(), pnode->GetId());
|
||||
return;
|
||||
}
|
||||
CGovernanceObject& govobj = it->second;
|
||||
std::string strHash = it->first.ToString();
|
||||
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- attempting to sync govobj: %s, peer=%d\n", __func__, strHash, pnode->id);
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- attempting to sync govobj: %s, peer=%d\n", __func__, strHash, pnode->GetId());
|
||||
|
||||
if (govobj.IsSetCachedDelete() || govobj.IsSetExpired()) {
|
||||
LogPrintf("CGovernanceManager::%s -- not syncing deleted/expired govobj: %s, peer=%d\n", __func__,
|
||||
strHash, pnode->id);
|
||||
strHash, pnode->GetId());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -650,7 +650,7 @@ void CGovernanceManager::SyncSingleObjVotes(CNode* pnode, const uint256& nProp,
|
||||
|
||||
CNetMsgMaker msgMaker(pnode->GetSendVersion());
|
||||
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::SYNCSTATUSCOUNT, MASTERNODE_SYNC_GOVOBJ_VOTE, nVoteCount));
|
||||
LogPrintf("CGovernanceManager::%s -- sent %d votes to peer=%d\n", __func__, nVoteCount, pnode->id);
|
||||
LogPrintf("CGovernanceManager::%s -- sent %d votes to peer=%d\n", __func__, nVoteCount, pnode->GetId());
|
||||
}
|
||||
|
||||
void CGovernanceManager::SyncObjects(CNode* pnode, CConnman& connman) const
|
||||
@ -671,7 +671,7 @@ void CGovernanceManager::SyncObjects(CNode* pnode, CConnman& connman) const
|
||||
|
||||
// SYNC GOVERNANCE OBJECTS WITH OTHER CLIENT
|
||||
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- syncing all objects to peer=%d\n", __func__, pnode->id);
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- syncing all objects to peer=%d\n", __func__, pnode->GetId());
|
||||
|
||||
LOCK2(cs_main, cs);
|
||||
|
||||
@ -681,23 +681,23 @@ void CGovernanceManager::SyncObjects(CNode* pnode, CConnman& connman) const
|
||||
const CGovernanceObject& govobj = objPair.second;
|
||||
std::string strHash = nHash.ToString();
|
||||
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- attempting to sync govobj: %s, peer=%d\n", __func__, strHash, pnode->id);
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- attempting to sync govobj: %s, peer=%d\n", __func__, strHash, pnode->GetId());
|
||||
|
||||
if (govobj.IsSetCachedDelete() || govobj.IsSetExpired()) {
|
||||
LogPrintf("CGovernanceManager::%s -- not syncing deleted/expired govobj: %s, peer=%d\n", __func__,
|
||||
strHash, pnode->id);
|
||||
strHash, pnode->GetId());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Push the inventory budget proposal message over to the other client
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- syncing govobj: %s, peer=%d\n", __func__, strHash, pnode->id);
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s -- syncing govobj: %s, peer=%d\n", __func__, strHash, pnode->GetId());
|
||||
pnode->PushInventory(CInv(MSG_GOVERNANCE_OBJECT, nHash));
|
||||
++nObjCount;
|
||||
}
|
||||
|
||||
CNetMsgMaker msgMaker(pnode->GetSendVersion());
|
||||
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::SYNCSTATUSCOUNT, MASTERNODE_SYNC_GOVOBJ, nObjCount));
|
||||
LogPrintf("CGovernanceManager::%s -- sent %d objects to peer=%d\n", __func__, nObjCount, pnode->id);
|
||||
LogPrintf("CGovernanceManager::%s -- sent %d objects to peer=%d\n", __func__, nObjCount, pnode->GetId());
|
||||
}
|
||||
|
||||
void CGovernanceManager::MasternodeRateUpdate(const CGovernanceObject& govobj)
|
||||
@ -944,7 +944,7 @@ void CGovernanceManager::RequestGovernanceObject(CNode* pfrom, const uint256& nH
|
||||
}
|
||||
}
|
||||
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::RequestGovernanceObject -- nHash %s nVoteCount %d peer=%d\n", nHash.ToString(), nVoteCount, pfrom->id);
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::RequestGovernanceObject -- nHash %s nVoteCount %d peer=%d\n", nHash.ToString(), nVoteCount, pfrom->GetId());
|
||||
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::MNGOVERNANCESYNC, nHash, filter));
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ void CInstantSend::ProcessMessage(CNode* pfrom, const std::string& strCommand, C
|
||||
|
||||
if (strCommand == NetMsgType::TXLOCKVOTE) { // InstantSend Transaction Lock Consensus Votes
|
||||
if(pfrom->nVersion < MIN_INSTANTSEND_PROTO_VERSION) {
|
||||
LogPrint(BCLog::INSTANTSEND, "TXLOCKVOTE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::INSTANTSEND, "TXLOCKVOTE -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE,
|
||||
strprintf("Version must be %d or greater", MIN_INSTANTSEND_PROTO_VERSION)));
|
||||
return;
|
||||
@ -364,7 +364,7 @@ bool CInstantSend::ProcessNewTxLockVote(CNode* pfrom, const CTxLockVote& vote, C
|
||||
if (itMnOV->second > GetTime() && itMnOV->second > GetAverageMasternodeOrphanVoteTime()) {
|
||||
LogPrint(BCLog::INSTANTSEND, "CInstantSend::%s -- masternode is spamming orphan Transaction Lock Votes: txid=%s masternode=%s\n",
|
||||
__func__, txHash.ToString(), vote.GetMasternodeOutpoint().ToStringShort());
|
||||
// Misbehaving(pfrom->id, 1);
|
||||
// Misbehaving(pfrom->GetId(), 1);
|
||||
return false;
|
||||
}
|
||||
// not spamming, refresh
|
||||
|
@ -41,16 +41,16 @@ void CQuorumBlockProcessor::ProcessMessage(CNode* pfrom, const std::string& strC
|
||||
|
||||
if (qc.IsNull()) {
|
||||
LOCK(cs_main);
|
||||
LogPrintf("CQuorumBlockProcessor::%s -- null commitment from peer=%d\n", __func__, pfrom->id);
|
||||
Misbehaving(pfrom->id, 100);
|
||||
LogPrintf("CQuorumBlockProcessor::%s -- null commitment from peer=%d\n", __func__, pfrom->GetId());
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Params().GetConsensus().llmqs.count((Consensus::LLMQType)qc.llmqType)) {
|
||||
LOCK(cs_main);
|
||||
LogPrintf("llmq""CQuorumBlockProcessor::%s -- invalid commitment type %d from peer=%d\n", __func__,
|
||||
qc.llmqType, pfrom->id);
|
||||
Misbehaving(pfrom->id, 100);
|
||||
qc.llmqType, pfrom->GetId());
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
return;
|
||||
}
|
||||
auto type = (Consensus::LLMQType)qc.llmqType;
|
||||
@ -61,7 +61,7 @@ void CQuorumBlockProcessor::ProcessMessage(CNode* pfrom, const std::string& strC
|
||||
LOCK(cs_main);
|
||||
if (!mapBlockIndex.count(qc.quorumHash)) {
|
||||
LogPrintf("CQuorumBlockProcessor::%s -- unknown block %s in commitment, peer=%d\n", __func__,
|
||||
qc.quorumHash.ToString(), pfrom->id);
|
||||
qc.quorumHash.ToString(), pfrom->GetId());
|
||||
// can't really punish the node here, as we might simply be the one that is on the wrong chain or not
|
||||
// fully synced
|
||||
return;
|
||||
@ -69,15 +69,15 @@ void CQuorumBlockProcessor::ProcessMessage(CNode* pfrom, const std::string& strC
|
||||
auto pquorumIndex = mapBlockIndex[qc.quorumHash];
|
||||
if (chainActive.Tip()->GetAncestor(pquorumIndex->nHeight) != pquorumIndex) {
|
||||
LogPrintf("CQuorumBlockProcessor::%s -- block %s not in active chain, peer=%d\n", __func__,
|
||||
qc.quorumHash.ToString(), pfrom->id);
|
||||
qc.quorumHash.ToString(), pfrom->GetId());
|
||||
// same, can't punish
|
||||
return;
|
||||
}
|
||||
int quorumHeight = pquorumIndex->nHeight - (pquorumIndex->nHeight % params.dkgInterval);
|
||||
if (quorumHeight != pquorumIndex->nHeight) {
|
||||
LogPrintf("CQuorumBlockProcessor::%s -- block %s is not the first block in the DKG interval, peer=%d\n", __func__,
|
||||
qc.quorumHash.ToString(), pfrom->id);
|
||||
Misbehaving(pfrom->id, 100);
|
||||
qc.quorumHash.ToString(), pfrom->GetId());
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -103,13 +103,13 @@ void CQuorumBlockProcessor::ProcessMessage(CNode* pfrom, const std::string& strC
|
||||
if (!qc.Verify(members, true)) {
|
||||
LOCK(cs_main);
|
||||
LogPrintf("CQuorumBlockProcessor::%s -- commitment for quorum %s:%d is not valid, peer=%d\n", __func__,
|
||||
qc.quorumHash.ToString(), qc.llmqType, pfrom->id);
|
||||
Misbehaving(pfrom->id, 100);
|
||||
qc.quorumHash.ToString(), qc.llmqType, pfrom->GetId());
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
return;
|
||||
}
|
||||
|
||||
LogPrint(BCLog::LLMQ, "CQuorumBlockProcessor::%s -- received commitment for quorum %s:%d, validMembers=%d, signers=%d, peer=%d\n", __func__,
|
||||
qc.quorumHash.ToString(), qc.llmqType, qc.CountValidMembers(), qc.CountSigners(), pfrom->id);
|
||||
qc.quorumHash.ToString(), qc.llmqType, qc.CountValidMembers(), qc.CountSigners(), pfrom->GetId());
|
||||
|
||||
AddMinableCommitment(qc);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ void CChainLocksHandler::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
|
||||
auto hash = ::SerializeHash(clsig);
|
||||
|
||||
ProcessNewChainLock(pfrom->id, clsig, hash);
|
||||
ProcessNewChainLock(pfrom->GetId(), clsig, hash);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,13 +129,13 @@ void CDKGSessionHandler::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
{
|
||||
// We don't handle messages in the calling thread as deserialization/processing of these would block everything
|
||||
if (strCommand == NetMsgType::QCONTRIB) {
|
||||
pendingContributions.PushPendingMessage(pfrom->id, vRecv);
|
||||
pendingContributions.PushPendingMessage(pfrom->GetId(), vRecv);
|
||||
} else if (strCommand == NetMsgType::QCOMPLAINT) {
|
||||
pendingComplaints.PushPendingMessage(pfrom->id, vRecv);
|
||||
pendingComplaints.PushPendingMessage(pfrom->GetId(), vRecv);
|
||||
} else if (strCommand == NetMsgType::QJUSTIFICATION) {
|
||||
pendingJustifications.PushPendingMessage(pfrom->id, vRecv);
|
||||
pendingJustifications.PushPendingMessage(pfrom->GetId(), vRecv);
|
||||
} else if (strCommand == NetMsgType::QPCOMMITMENT) {
|
||||
pendingPrematureCommitments.PushPendingMessage(pfrom->id, vRecv);
|
||||
pendingPrematureCommitments.PushPendingMessage(pfrom->GetId(), vRecv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ void CDKGSessionManager::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
|
||||
if (vRecv.size() < 1) {
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->id, 100);
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ void CDKGSessionManager::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
Consensus::LLMQType llmqType = (Consensus::LLMQType)*vRecv.begin();
|
||||
if (!dkgSessionHandlers.count(llmqType)) {
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->id, 100);
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -688,10 +688,10 @@ void CInstantSendManager::ProcessMessage(CNode* pfrom, const std::string& strCom
|
||||
void CInstantSendManager::ProcessMessageInstantSendLock(CNode* pfrom, const llmq::CInstantSendLock& islock, CConnman& connman)
|
||||
{
|
||||
bool ban = false;
|
||||
if (!PreVerifyInstantSendLock(pfrom->id, islock, ban)) {
|
||||
if (!PreVerifyInstantSendLock(pfrom->GetId(), islock, ban)) {
|
||||
if (ban) {
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->id, 100);
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -707,9 +707,9 @@ void CInstantSendManager::ProcessMessageInstantSendLock(CNode* pfrom, const llmq
|
||||
}
|
||||
|
||||
LogPrint(BCLog::INSTANTSEND, "CInstantSendManager::%s -- txid=%s, islock=%s: received islock, peer=%d\n", __func__,
|
||||
islock.txid.ToString(), hash.ToString(), pfrom->id);
|
||||
islock.txid.ToString(), hash.ToString(), pfrom->GetId());
|
||||
|
||||
pendingInstantSendLocks.emplace(hash, std::make_pair(pfrom->id, std::move(islock)));
|
||||
pendingInstantSendLocks.emplace(hash, std::make_pair(pfrom->GetId(), std::move(islock)));
|
||||
}
|
||||
|
||||
bool CInstantSendManager::PreVerifyInstantSendLock(NodeId nodeId, const llmq::CInstantSendLock& islock, bool& retBan)
|
||||
@ -1300,7 +1300,7 @@ void CInstantSendManager::AskNodesForLockedTx(const uint256& txid)
|
||||
LOCK(cs_main);
|
||||
for (CNode* pnode : nodesToAskFor) {
|
||||
LogPrintf("CInstantSendManager::%s -- txid=%s: asking other peer %d for correct TX\n", __func__,
|
||||
txid.ToString(), pnode->id);
|
||||
txid.ToString(), pnode->GetId());
|
||||
|
||||
CInv inv(MSG_TX, txid);
|
||||
pnode->AskFor(inv);
|
||||
|
@ -430,10 +430,10 @@ void CSigningManager::ProcessMessage(CNode* pfrom, const std::string& strCommand
|
||||
void CSigningManager::ProcessMessageRecoveredSig(CNode* pfrom, const CRecoveredSig& recoveredSig, CConnman& connman)
|
||||
{
|
||||
bool ban = false;
|
||||
if (!PreVerifyRecoveredSig(pfrom->id, recoveredSig, ban)) {
|
||||
if (!PreVerifyRecoveredSig(pfrom->GetId(), recoveredSig, ban)) {
|
||||
if (ban) {
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->id, 100);
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -444,10 +444,10 @@ void CSigningManager::ProcessMessageRecoveredSig(CNode* pfrom, const CRecoveredS
|
||||
return;
|
||||
}
|
||||
|
||||
LogPrint(BCLog::LLMQ, "CSigningManager::%s -- signHash=%s, node=%d\n", __func__, CLLMQUtils::BuildSignHash(recoveredSig).ToString(), pfrom->id);
|
||||
LogPrint(BCLog::LLMQ, "CSigningManager::%s -- signHash=%s, node=%d\n", __func__, CLLMQUtils::BuildSignHash(recoveredSig).ToString(), pfrom->GetId());
|
||||
|
||||
LOCK(cs);
|
||||
pendingRecoveredSigs[pfrom->id].emplace_back(recoveredSig);
|
||||
pendingRecoveredSigs[pfrom->GetId()].emplace_back(recoveredSig);
|
||||
}
|
||||
|
||||
bool CSigningManager::PreVerifyRecoveredSig(NodeId nodeId, const CRecoveredSig& recoveredSig, bool& retBan)
|
||||
|
@ -234,13 +234,13 @@ void CSigSharesManager::ProcessMessage(CNode* pfrom, const std::string& strComma
|
||||
std::vector<CSigSesAnn> msgs;
|
||||
vRecv >> msgs;
|
||||
if (msgs.size() > MAX_MSGS_CNT_QSIGSESANN) {
|
||||
LogPrintf("CSigSharesManager::%s -- too many announcements in QSIGSESANN message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QSIGSESANN, pfrom->id);
|
||||
BanNode(pfrom->id);
|
||||
LogPrintf("CSigSharesManager::%s -- too many announcements in QSIGSESANN message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QSIGSESANN, pfrom->GetId());
|
||||
BanNode(pfrom->GetId());
|
||||
return;
|
||||
}
|
||||
for (auto& ann : msgs) {
|
||||
if (!ProcessMessageSigSesAnn(pfrom, ann, connman)) {
|
||||
BanNode(pfrom->id);
|
||||
BanNode(pfrom->GetId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -248,13 +248,13 @@ void CSigSharesManager::ProcessMessage(CNode* pfrom, const std::string& strComma
|
||||
std::vector<CSigSharesInv> msgs;
|
||||
vRecv >> msgs;
|
||||
if (msgs.size() > MAX_MSGS_CNT_QSIGSHARESINV) {
|
||||
LogPrintf("CSigSharesManager::%s -- too many invs in QSIGSHARESINV message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QSIGSHARESINV, pfrom->id);
|
||||
BanNode(pfrom->id);
|
||||
LogPrintf("CSigSharesManager::%s -- too many invs in QSIGSHARESINV message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QSIGSHARESINV, pfrom->GetId());
|
||||
BanNode(pfrom->GetId());
|
||||
return;
|
||||
}
|
||||
for (auto& inv : msgs) {
|
||||
if (!ProcessMessageSigSharesInv(pfrom, inv, connman)) {
|
||||
BanNode(pfrom->id);
|
||||
BanNode(pfrom->GetId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -262,13 +262,13 @@ void CSigSharesManager::ProcessMessage(CNode* pfrom, const std::string& strComma
|
||||
std::vector<CSigSharesInv> msgs;
|
||||
vRecv >> msgs;
|
||||
if (msgs.size() > MAX_MSGS_CNT_QGETSIGSHARES) {
|
||||
LogPrintf("CSigSharesManager::%s -- too many invs in QGETSIGSHARES message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QGETSIGSHARES, pfrom->id);
|
||||
BanNode(pfrom->id);
|
||||
LogPrintf("CSigSharesManager::%s -- too many invs in QGETSIGSHARES message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QGETSIGSHARES, pfrom->GetId());
|
||||
BanNode(pfrom->GetId());
|
||||
return;
|
||||
}
|
||||
for (auto& inv : msgs) {
|
||||
if (!ProcessMessageGetSigShares(pfrom, inv, connman)) {
|
||||
BanNode(pfrom->id);
|
||||
BanNode(pfrom->GetId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -280,13 +280,13 @@ void CSigSharesManager::ProcessMessage(CNode* pfrom, const std::string& strComma
|
||||
totalSigsCount += bs.sigShares.size();
|
||||
}
|
||||
if (totalSigsCount > MAX_MSGS_TOTAL_BATCHED_SIGS) {
|
||||
LogPrintf("CSigSharesManager::%s -- too many sigs in QBSIGSHARES message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_TOTAL_BATCHED_SIGS, pfrom->id);
|
||||
BanNode(pfrom->id);
|
||||
LogPrintf("CSigSharesManager::%s -- too many sigs in QBSIGSHARES message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_TOTAL_BATCHED_SIGS, pfrom->GetId());
|
||||
BanNode(pfrom->GetId());
|
||||
return;
|
||||
}
|
||||
for (auto& bs : msgs) {
|
||||
if (!ProcessMessageBatchedSigShares(pfrom, bs, connman)) {
|
||||
BanNode(pfrom->id);
|
||||
BanNode(pfrom->GetId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -303,20 +303,20 @@ bool CSigSharesManager::ProcessMessageSigSesAnn(CNode* pfrom, const CSigSesAnn&
|
||||
return false;
|
||||
}
|
||||
|
||||
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- ann={%s}, node=%d\n", __func__, ann.ToString(), pfrom->id);
|
||||
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- ann={%s}, node=%d\n", __func__, ann.ToString(), pfrom->GetId());
|
||||
|
||||
auto quorum = quorumManager->GetQuorum(llmqType, ann.quorumHash);
|
||||
if (!quorum) {
|
||||
// TODO should we ban here?
|
||||
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- quorum %s not found, node=%d\n", __func__,
|
||||
ann.quorumHash.ToString(), pfrom->id);
|
||||
ann.quorumHash.ToString(), pfrom->GetId());
|
||||
return true; // let's still try other announcements from the same message
|
||||
}
|
||||
|
||||
auto signHash = CLLMQUtils::BuildSignHash(llmqType, ann.quorumHash, ann.id, ann.msgHash);
|
||||
|
||||
LOCK(cs);
|
||||
auto& nodeState = nodeStates[pfrom->id];
|
||||
auto& nodeState = nodeStates[pfrom->GetId()];
|
||||
auto& session = nodeState.GetOrCreateSessionFromAnn(ann);
|
||||
nodeState.sessionByRecvId.erase(session.recvSessionId);
|
||||
nodeState.sessionByRecvId.erase(ann.sessionId);
|
||||
@ -340,11 +340,11 @@ bool CSigSharesManager::VerifySigSharesInv(NodeId from, Consensus::LLMQType llmq
|
||||
bool CSigSharesManager::ProcessMessageSigSharesInv(CNode* pfrom, const CSigSharesInv& inv, CConnman& connman)
|
||||
{
|
||||
CSigSharesNodeState::SessionInfo sessionInfo;
|
||||
if (!GetSessionInfoByRecvId(pfrom->id, inv.sessionId, sessionInfo)) {
|
||||
if (!GetSessionInfoByRecvId(pfrom->GetId(), inv.sessionId, sessionInfo)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!VerifySigSharesInv(pfrom->id, sessionInfo.llmqType, inv)) {
|
||||
if (!VerifySigSharesInv(pfrom->GetId(), sessionInfo.llmqType, inv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -354,17 +354,17 @@ bool CSigSharesManager::ProcessMessageSigSharesInv(CNode* pfrom, const CSigShare
|
||||
}
|
||||
|
||||
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- signHash=%s, inv={%s}, node=%d\n", __func__,
|
||||
sessionInfo.signHash.ToString(), inv.ToString(), pfrom->id);
|
||||
sessionInfo.signHash.ToString(), inv.ToString(), pfrom->GetId());
|
||||
|
||||
if (sessionInfo.quorum->quorumVvec == nullptr) {
|
||||
// TODO we should allow to ask other nodes for the quorum vvec if we missed it in the DKG
|
||||
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- we don't have the quorum vvec for %s, not requesting sig shares. node=%d\n", __func__,
|
||||
sessionInfo.quorumHash.ToString(), pfrom->id);
|
||||
sessionInfo.quorumHash.ToString(), pfrom->GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
LOCK(cs);
|
||||
auto& nodeState = nodeStates[pfrom->id];
|
||||
auto& nodeState = nodeStates[pfrom->GetId()];
|
||||
auto session = nodeState.GetSessionByRecvId(inv.sessionId);
|
||||
if (!session) {
|
||||
return true;
|
||||
@ -377,11 +377,11 @@ bool CSigSharesManager::ProcessMessageSigSharesInv(CNode* pfrom, const CSigShare
|
||||
bool CSigSharesManager::ProcessMessageGetSigShares(CNode* pfrom, const CSigSharesInv& inv, CConnman& connman)
|
||||
{
|
||||
CSigSharesNodeState::SessionInfo sessionInfo;
|
||||
if (!GetSessionInfoByRecvId(pfrom->id, inv.sessionId, sessionInfo)) {
|
||||
if (!GetSessionInfoByRecvId(pfrom->GetId(), inv.sessionId, sessionInfo)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!VerifySigSharesInv(pfrom->id, sessionInfo.llmqType, inv)) {
|
||||
if (!VerifySigSharesInv(pfrom->GetId(), sessionInfo.llmqType, inv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -391,10 +391,10 @@ bool CSigSharesManager::ProcessMessageGetSigShares(CNode* pfrom, const CSigShare
|
||||
}
|
||||
|
||||
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- signHash=%s, inv={%s}, node=%d\n", __func__,
|
||||
sessionInfo.signHash.ToString(), inv.ToString(), pfrom->id);
|
||||
sessionInfo.signHash.ToString(), inv.ToString(), pfrom->GetId());
|
||||
|
||||
LOCK(cs);
|
||||
auto& nodeState = nodeStates[pfrom->id];
|
||||
auto& nodeState = nodeStates[pfrom->GetId()];
|
||||
auto session = nodeState.GetSessionByRecvId(inv.sessionId);
|
||||
if (!session) {
|
||||
return true;
|
||||
@ -407,12 +407,12 @@ bool CSigSharesManager::ProcessMessageGetSigShares(CNode* pfrom, const CSigShare
|
||||
bool CSigSharesManager::ProcessMessageBatchedSigShares(CNode* pfrom, const CBatchedSigShares& batchedSigShares, CConnman& connman)
|
||||
{
|
||||
CSigSharesNodeState::SessionInfo sessionInfo;
|
||||
if (!GetSessionInfoByRecvId(pfrom->id, batchedSigShares.sessionId, sessionInfo)) {
|
||||
if (!GetSessionInfoByRecvId(pfrom->GetId(), batchedSigShares.sessionId, sessionInfo)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ban = false;
|
||||
if (!PreVerifyBatchedSigShares(pfrom->id, sessionInfo, batchedSigShares, ban)) {
|
||||
if (!PreVerifyBatchedSigShares(pfrom->GetId(), sessionInfo, batchedSigShares, ban)) {
|
||||
return !ban;
|
||||
}
|
||||
|
||||
@ -421,7 +421,7 @@ bool CSigSharesManager::ProcessMessageBatchedSigShares(CNode* pfrom, const CBatc
|
||||
|
||||
{
|
||||
LOCK(cs);
|
||||
auto& nodeState = nodeStates[pfrom->id];
|
||||
auto& nodeState = nodeStates[pfrom->GetId()];
|
||||
|
||||
for (size_t i = 0; i < batchedSigShares.sigShares.size(); i++) {
|
||||
CSigShare sigShare = RebuildSigShare(sessionInfo, batchedSigShares, i);
|
||||
@ -445,14 +445,14 @@ bool CSigSharesManager::ProcessMessageBatchedSigShares(CNode* pfrom, const CBatc
|
||||
}
|
||||
|
||||
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- signHash=%s, shares=%d, new=%d, inv={%s}, node=%d\n", __func__,
|
||||
sessionInfo.signHash.ToString(), batchedSigShares.sigShares.size(), sigShares.size(), batchedSigShares.ToInvString(), pfrom->id);
|
||||
sessionInfo.signHash.ToString(), batchedSigShares.sigShares.size(), sigShares.size(), batchedSigShares.ToInvString(), pfrom->GetId());
|
||||
|
||||
if (sigShares.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LOCK(cs);
|
||||
auto& nodeState = nodeStates[pfrom->id];
|
||||
auto& nodeState = nodeStates[pfrom->GetId()];
|
||||
for (auto& s : sigShares) {
|
||||
nodeState.pendingIncomingSigShares.Add(s.GetKey(), s);
|
||||
}
|
||||
@ -1038,13 +1038,13 @@ bool CSigSharesManager::SendMessages()
|
||||
for (auto& pnode : vNodesCopy) {
|
||||
CNetMsgMaker msgMaker(pnode->GetSendVersion());
|
||||
|
||||
auto it1 = sigSessionAnnouncements.find(pnode->id);
|
||||
auto it1 = sigSessionAnnouncements.find(pnode->GetId());
|
||||
if (it1 != sigSessionAnnouncements.end()) {
|
||||
std::vector<CSigSesAnn> msgs;
|
||||
msgs.reserve(it1->second.size());
|
||||
for (auto& sigSesAnn : it1->second) {
|
||||
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::SendMessages -- QSIGSESANN signHash=%s, sessionId=%d, node=%d\n",
|
||||
CLLMQUtils::BuildSignHash(sigSesAnn).ToString(), sigSesAnn.sessionId, pnode->id);
|
||||
CLLMQUtils::BuildSignHash(sigSesAnn).ToString(), sigSesAnn.sessionId, pnode->GetId());
|
||||
msgs.emplace_back(sigSesAnn);
|
||||
if (msgs.size() == MAX_MSGS_CNT_QSIGSESANN) {
|
||||
g_connman->PushMessage(pnode, msgMaker.Make(NetMsgType::QSIGSESANN, msgs), false);
|
||||
@ -1058,13 +1058,13 @@ bool CSigSharesManager::SendMessages()
|
||||
}
|
||||
}
|
||||
|
||||
auto it = sigSharesToRequest.find(pnode->id);
|
||||
auto it = sigSharesToRequest.find(pnode->GetId());
|
||||
if (it != sigSharesToRequest.end()) {
|
||||
std::vector<CSigSharesInv> msgs;
|
||||
for (auto& p : it->second) {
|
||||
assert(p.second.CountSet() != 0);
|
||||
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::SendMessages -- QGETSIGSHARES signHash=%s, inv={%s}, node=%d\n",
|
||||
p.first.ToString(), p.second.ToString(), pnode->id);
|
||||
p.first.ToString(), p.second.ToString(), pnode->GetId());
|
||||
msgs.emplace_back(std::move(p.second));
|
||||
if (msgs.size() == MAX_MSGS_CNT_QGETSIGSHARES) {
|
||||
g_connman->PushMessage(pnode, msgMaker.Make(NetMsgType::QGETSIGSHARES, msgs), false);
|
||||
@ -1078,14 +1078,14 @@ bool CSigSharesManager::SendMessages()
|
||||
}
|
||||
}
|
||||
|
||||
auto jt = sigSharesToSend.find(pnode->id);
|
||||
auto jt = sigSharesToSend.find(pnode->GetId());
|
||||
if (jt != sigSharesToSend.end()) {
|
||||
size_t totalSigsCount = 0;
|
||||
std::vector<CBatchedSigShares> msgs;
|
||||
for (auto& p : jt->second) {
|
||||
assert(!p.second.sigShares.empty());
|
||||
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::SendMessages -- QBSIGSHARES signHash=%s, inv={%s}, node=%d\n",
|
||||
p.first.ToString(), p.second.ToInvString(), pnode->id);
|
||||
p.first.ToString(), p.second.ToInvString(), pnode->GetId());
|
||||
if (totalSigsCount + p.second.sigShares.size() > MAX_MSGS_TOTAL_BATCHED_SIGS) {
|
||||
g_connman->PushMessage(pnode, msgMaker.Make(NetMsgType::QBSIGSHARES, msgs), false);
|
||||
msgs.clear();
|
||||
@ -1102,13 +1102,13 @@ bool CSigSharesManager::SendMessages()
|
||||
}
|
||||
}
|
||||
|
||||
auto kt = sigSharesToAnnounce.find(pnode->id);
|
||||
auto kt = sigSharesToAnnounce.find(pnode->GetId());
|
||||
if (kt != sigSharesToAnnounce.end()) {
|
||||
std::vector<CSigSharesInv> msgs;
|
||||
for (auto& p : kt->second) {
|
||||
assert(p.second.CountSet() != 0);
|
||||
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::SendMessages -- QSIGSHARESINV signHash=%s, inv={%s}, node=%d\n",
|
||||
p.first.ToString(), p.second.ToString(), pnode->id);
|
||||
p.first.ToString(), p.second.ToString(), pnode->GetId());
|
||||
msgs.emplace_back(std::move(p.second));
|
||||
if (msgs.size() == MAX_MSGS_CNT_QSIGSHARESINV) {
|
||||
g_connman->PushMessage(pnode, msgMaker.Make(NetMsgType::QSIGSHARESINV, msgs), false);
|
||||
@ -1261,7 +1261,7 @@ void CSigSharesManager::Cleanup()
|
||||
nodeStatesToDelete.emplace(p.first);
|
||||
}
|
||||
g_connman->ForEachNode([&](CNode* pnode) {
|
||||
nodeStatesToDelete.erase(pnode->id);
|
||||
nodeStatesToDelete.erase(pnode->GetId());
|
||||
});
|
||||
|
||||
// Now delete these node states
|
||||
|
@ -107,7 +107,7 @@ void CMasternodeSync::ProcessMessage(CNode* pfrom, const std::string& strCommand
|
||||
int nCount;
|
||||
vRecv >> nItemID >> nCount;
|
||||
|
||||
LogPrintf("SYNCSTATUSCOUNT -- got inventory count: nItemID=%d nCount=%d peer=%d\n", nItemID, nCount, pfrom->id);
|
||||
LogPrintf("SYNCSTATUSCOUNT -- got inventory count: nItemID=%d nCount=%d peer=%d\n", nItemID, nCount, pfrom->GetId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ void CMasternodeSync::ProcessTick(CConnman& connman)
|
||||
// We already fully synced from this node recently,
|
||||
// disconnect to free this connection slot for another peer.
|
||||
pnode->fDisconnect = true;
|
||||
LogPrintf("CMasternodeSync::ProcessTick -- disconnecting from recently synced peer=%d\n", pnode->id);
|
||||
LogPrintf("CMasternodeSync::ProcessTick -- disconnecting from recently synced peer=%d\n", pnode->GetId());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ void CMasternodeSync::ProcessTick(CConnman& connman)
|
||||
netfulfilledman.AddFulfilledRequest(pnode->addr, "spork-sync");
|
||||
// get current network sporks
|
||||
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::GETSPORKS));
|
||||
LogPrintf("CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d -- requesting sporks from peer=%d\n", nTick, nCurrentAsset, pnode->id);
|
||||
LogPrintf("CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d -- requesting sporks from peer=%d\n", nTick, nCurrentAsset, pnode->GetId());
|
||||
}
|
||||
|
||||
// INITIAL TIMEOUT
|
||||
|
@ -84,7 +84,7 @@ void CMasternodeUtils::ProcessMasternodeConnections(CConnman& connman)
|
||||
}
|
||||
if (fFound) return; // do NOT disconnect mixing masternodes
|
||||
#endif // ENABLE_WALLET
|
||||
LogPrintf("Closing Masternode connection: peer=%d, addr=%s\n", pnode->id, pnode->addr.ToString());
|
||||
LogPrintf("Closing Masternode connection: peer=%d, addr=%s\n", pnode->GetId(), pnode->addr.ToString());
|
||||
pnode->fDisconnect = true;
|
||||
}
|
||||
});
|
||||
|
18
src/net.cpp
18
src/net.cpp
@ -997,7 +997,7 @@ bool CConnman::AttemptToEvictConnection()
|
||||
}
|
||||
}
|
||||
|
||||
NodeEvictionCandidate candidate = {node->id, node->nTimeConnected, node->nMinPingUsecTime,
|
||||
NodeEvictionCandidate candidate = {node->GetId(), node->nTimeConnected, node->nMinPingUsecTime,
|
||||
node->nLastBlockTime, node->nLastTXTime,
|
||||
(node->nServices & nRelevantServices) == nRelevantServices,
|
||||
node->fRelayTxes, node->pfilter != NULL, node->nKeyedNetGroup};
|
||||
@ -1197,7 +1197,7 @@ void CConnman::ThreadSocketHandler()
|
||||
if (pnode->fDisconnect)
|
||||
{
|
||||
LogPrintf("ThreadSocketHandler -- removing node: peer=%d addr=%s nRefCount=%d fInbound=%d fMasternode=%d\n",
|
||||
pnode->id, pnode->addr.ToString(), pnode->GetRefCount(), pnode->fInbound, pnode->fMasternode);
|
||||
pnode->GetId(), pnode->addr.ToString(), pnode->GetRefCount(), pnode->fInbound, pnode->fMasternode);
|
||||
|
||||
// remove from vNodes
|
||||
vNodes.erase(remove(vNodes.begin(), vNodes.end(), pnode), vNodes.end());
|
||||
@ -1469,7 +1469,7 @@ void CConnman::ThreadSocketHandler()
|
||||
{
|
||||
if (pnode->nLastRecv == 0 || pnode->nLastSend == 0)
|
||||
{
|
||||
LogPrint(BCLog::NET, "socket no message in first 60 seconds, %d %d from %d\n", pnode->nLastRecv != 0, pnode->nLastSend != 0, pnode->id);
|
||||
LogPrint(BCLog::NET, "socket no message in first 60 seconds, %d %d from %d\n", pnode->nLastRecv != 0, pnode->nLastSend != 0, pnode->GetId());
|
||||
pnode->fDisconnect = true;
|
||||
}
|
||||
else if (nTime - pnode->nLastSend > TIMEOUT_INTERVAL)
|
||||
@ -1489,7 +1489,7 @@ void CConnman::ThreadSocketHandler()
|
||||
}
|
||||
else if (!pnode->fSuccessfullyConnected)
|
||||
{
|
||||
LogPrintf("version handshake timeout from %d\n", pnode->id);
|
||||
LogPrintf("version handshake timeout from %d\n", pnode->GetId());
|
||||
pnode->fDisconnect = true;
|
||||
}
|
||||
}
|
||||
@ -2779,7 +2779,7 @@ std::set<NodeId> CConnman::GetMasternodeQuorumNodes(Consensus::LLMQType llmqType
|
||||
if (!pnode->qwatch && (pnode->verifiedProRegTxHash.IsNull() || !proRegTxHashes.count(pnode->verifiedProRegTxHash))) {
|
||||
continue;
|
||||
}
|
||||
nodes.emplace(pnode->id);
|
||||
nodes.emplace(pnode->GetId());
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
@ -2859,7 +2859,7 @@ bool CConnman::DisconnectNode(NodeId id)
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
for(CNode* pnode : vNodes) {
|
||||
if (id == pnode->id) {
|
||||
if (id == pnode->GetId()) {
|
||||
pnode->fDisconnect = true;
|
||||
return true;
|
||||
}
|
||||
@ -3069,10 +3069,10 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
|
||||
fFirstMessageIsMNAUTH(false),
|
||||
addr(addrIn),
|
||||
fInbound(fInboundIn),
|
||||
id(idIn),
|
||||
nKeyedNetGroup(nKeyedNetGroupIn),
|
||||
addrKnown(5000, 0.001),
|
||||
filterInventoryKnown(50000, 0.000001),
|
||||
id(idIn),
|
||||
nLocalHostNonce(nLocalHostNonceIn),
|
||||
nLocalServices(nLocalServicesIn),
|
||||
nMyStartingHeight(nMyStartingHeightIn),
|
||||
@ -3209,7 +3209,7 @@ void CConnman::PushMessage(CNode* pnode, CSerializedNetMsg&& msg, bool allowOpti
|
||||
{
|
||||
size_t nMessageSize = msg.data.size();
|
||||
size_t nTotalSize = nMessageSize + CMessageHeader::HEADER_SIZE;
|
||||
LogPrint(BCLog::NET, "sending %s (%d bytes) peer=%d\n", SanitizeString(msg.command.c_str()), nMessageSize, pnode->id);
|
||||
LogPrint(BCLog::NET, "sending %s (%d bytes) peer=%d\n", SanitizeString(msg.command.c_str()), nMessageSize, pnode->GetId());
|
||||
|
||||
std::vector<unsigned char> serializedHeader;
|
||||
serializedHeader.reserve(CMessageHeader::HEADER_SIZE);
|
||||
@ -3264,7 +3264,7 @@ bool CConnman::ForNode(NodeId id, std::function<bool(const CNode* pnode)> cond,
|
||||
CNode* found = nullptr;
|
||||
LOCK(cs_vNodes);
|
||||
for (auto&& pnode : vNodes) {
|
||||
if(pnode->id == id) {
|
||||
if(pnode->GetId() == id) {
|
||||
found = pnode;
|
||||
break;
|
||||
}
|
||||
|
@ -771,7 +771,6 @@ public:
|
||||
CCriticalSection cs_filter;
|
||||
CBloomFilter* pfilter;
|
||||
std::atomic<int> nRefCount;
|
||||
const NodeId id;
|
||||
|
||||
const uint64_t nKeyedNetGroup;
|
||||
|
||||
@ -854,6 +853,7 @@ public:
|
||||
private:
|
||||
CNode(const CNode&);
|
||||
void operator=(const CNode&);
|
||||
const NodeId id;
|
||||
|
||||
|
||||
const uint64_t nLocalHostNonce;
|
||||
|
@ -874,7 +874,7 @@ void PeerLogicValidation::NewPoWValidBlock(const CBlockIndex *pindex, const std:
|
||||
!PeerHasHeader(&state, pindex) && PeerHasHeader(&state, pindex->pprev)) {
|
||||
|
||||
LogPrint(BCLog::NET, "%s sending header-and-ids %s to peer=%d\n", "PeerLogicValidation::NewPoWValidBlock",
|
||||
hashBlock.ToString(), pnode->id);
|
||||
hashBlock.ToString(), pnode->GetId());
|
||||
connman->PushMessage(pnode, msgMaker.Make(NetMsgType::CMPCTBLOCK, *pcmpctblock));
|
||||
state.pindexBestHeaderSent = pindex;
|
||||
}
|
||||
@ -1046,7 +1046,7 @@ static void RelayAddress(const CAddress& addr, bool fReachable, CConnman& connma
|
||||
|
||||
auto sortfunc = [&best, &hasher, nRelayNodes](CNode* pnode) {
|
||||
if (pnode->nVersion >= CADDR_TIME_VERSION) {
|
||||
uint64_t hashKey = CSipHasher(hasher).Write(pnode->id).Finalize();
|
||||
uint64_t hashKey = CSipHasher(hasher).Write(pnode->GetId()).Finalize();
|
||||
for (unsigned int i = 0; i < nRelayNodes; i++) {
|
||||
if (hashKey > best[i].first) {
|
||||
std::copy(best.begin() + i, best.begin() + nRelayNodes - 1, best.begin() + i + 1);
|
||||
@ -1400,7 +1400,7 @@ inline void static SendBlockTransactions(const CBlock& block, const BlockTransac
|
||||
if (req.indexes[i] >= block.vtx.size()) {
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
LogPrintf("Peer %d sent us a getblocktxn with out-of-bounds tx indices", pfrom->id);
|
||||
LogPrintf("Peer %d sent us a getblocktxn with out-of-bounds tx indices", pfrom->GetId());
|
||||
return;
|
||||
}
|
||||
resp.txn[i] = block.vtx[req.indexes[i]];
|
||||
@ -1412,7 +1412,7 @@ inline void static SendBlockTransactions(const CBlock& block, const BlockTransac
|
||||
|
||||
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(BCLog::NET, "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id);
|
||||
LogPrint(BCLog::NET, "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->GetId());
|
||||
if (IsArgSet("-dropmessagestest") && GetRand(GetArg("-dropmessagestest", 0)) == 0)
|
||||
{
|
||||
LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n");
|
||||
@ -1452,7 +1452,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// on rules which are incompatible to ours. Better to ban him after some time as it might otherwise keep
|
||||
// asking for the same block (if -addnode/-connect was used on the other side).
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->id, 1);
|
||||
Misbehaving(pfrom->GetId(), 1);
|
||||
}
|
||||
|
||||
if (LogAcceptCategory(BCLog::NET)) {
|
||||
@ -1499,7 +1499,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
}
|
||||
if (pfrom->nServicesExpected & ~nServices)
|
||||
{
|
||||
LogPrint(BCLog::NET, "peer=%d does not offer the expected services (%08x offered, %08x expected); disconnecting\n", pfrom->id, nServices, pfrom->nServicesExpected);
|
||||
LogPrint(BCLog::NET, "peer=%d does not offer the expected services (%08x offered, %08x expected); disconnecting\n", pfrom->GetId(), nServices, pfrom->nServicesExpected);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_NONSTANDARD,
|
||||
strprintf("Expected to offer services %08x", pfrom->nServicesExpected)));
|
||||
pfrom->fDisconnect = true;
|
||||
@ -1509,7 +1509,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
if (nVersion < MIN_PEER_PROTO_VERSION)
|
||||
{
|
||||
// disconnect from peers older than this proto version
|
||||
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, nVersion);
|
||||
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->GetId(), nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE,
|
||||
strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION)));
|
||||
pfrom->fDisconnect = true;
|
||||
@ -1629,7 +1629,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
|
||||
LogPrintf("receive version message: %s: version %d, blocks=%d, us=%s, peer=%d%s\n",
|
||||
cleanSubVer, pfrom->nVersion,
|
||||
pfrom->nStartingHeight, addrMe.ToString(), pfrom->id,
|
||||
pfrom->nStartingHeight, addrMe.ToString(), pfrom->GetId(),
|
||||
remoteAddr);
|
||||
|
||||
int64_t nTimeOffset = nTime - GetTime();
|
||||
@ -1827,7 +1827,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
const CInv &inv = vInv[nInv];
|
||||
|
||||
if(!inv.IsKnownType()) {
|
||||
LogPrint(BCLog::NET, "got inv of unknown type %d: %s peer=%d\n", inv.type, inv.hash.ToString(), pfrom->id);
|
||||
LogPrint(BCLog::NET, "got inv of unknown type %d: %s peer=%d\n", inv.type, inv.hash.ToString(), pfrom->GetId());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1835,7 +1835,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
return true;
|
||||
|
||||
bool fAlreadyHave = AlreadyHave(inv);
|
||||
LogPrint(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom->id);
|
||||
LogPrint(BCLog::NET, "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom->GetId());
|
||||
|
||||
if (inv.type == MSG_BLOCK) {
|
||||
UpdateBlockAvailability(pfrom->GetId(), inv.hash);
|
||||
@ -1844,7 +1844,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
continue;
|
||||
}
|
||||
|
||||
CNodeState *state = State(pfrom->id);
|
||||
CNodeState *state = State(pfrom->GetId());
|
||||
if (!state) {
|
||||
continue;
|
||||
}
|
||||
@ -1863,7 +1863,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// we now only provide a getheaders response here. When we receive the headers, we will
|
||||
// then ask for the blocks we need.
|
||||
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::GETHEADERS, chainActive.GetLocator(pindexBestHeader), inv.hash));
|
||||
LogPrint(BCLog::NET, "getheaders (%d) %s to peer=%d\n", pindexBestHeader->nHeight, inv.hash.ToString(), pfrom->id);
|
||||
LogPrint(BCLog::NET, "getheaders (%d) %s to peer=%d\n", pindexBestHeader->nHeight, inv.hash.ToString(), pfrom->GetId());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1875,7 +1875,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
pfrom->AddInventoryKnown(inv);
|
||||
if (fBlocksOnly) {
|
||||
LogPrint(BCLog::NET, "transaction (%s) inv sent in violation of protocol peer=%d\n", inv.hash.ToString(),
|
||||
pfrom->id);
|
||||
pfrom->GetId());
|
||||
} else if (!fAlreadyHave) {
|
||||
bool allowWhileInIBD = allowWhileInIBDObjs.count(inv.type);
|
||||
if (allowWhileInIBD || (!fImporting && !fReindex && !IsInitialBlockDownload())) {
|
||||
@ -1914,10 +1914,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
return error("message getdata size() = %u", vInv.size());
|
||||
}
|
||||
|
||||
LogPrint(BCLog::NET, "received getdata (%u invsz) peer=%d\n", vInv.size(), pfrom->id);
|
||||
LogPrint(BCLog::NET, "received getdata (%u invsz) peer=%d\n", vInv.size(), pfrom->GetId());
|
||||
|
||||
if (vInv.size() > 0) {
|
||||
LogPrint(BCLog::NET, "received getdata for: %s peer=%d\n", vInv[0].ToString(), pfrom->id);
|
||||
LogPrint(BCLog::NET, "received getdata for: %s peer=%d\n", vInv[0].ToString(), pfrom->GetId());
|
||||
}
|
||||
|
||||
pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end());
|
||||
@ -1957,7 +1957,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
if (pindex)
|
||||
pindex = chainActive.Next(pindex);
|
||||
int nLimit = 500;
|
||||
LogPrint(BCLog::NET, "getblocks %d to %s limit %d from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.IsNull() ? "end" : hashStop.ToString(), nLimit, pfrom->id);
|
||||
LogPrint(BCLog::NET, "getblocks %d to %s limit %d from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.IsNull() ? "end" : hashStop.ToString(), nLimit, pfrom->GetId());
|
||||
for (; pindex; pindex = chainActive.Next(pindex))
|
||||
{
|
||||
if (pindex->GetBlockHash() == hashStop)
|
||||
@ -2007,7 +2007,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
|
||||
BlockMap::iterator it = mapBlockIndex.find(req.blockhash);
|
||||
if (it == mapBlockIndex.end() || !(it->second->nStatus & BLOCK_HAVE_DATA)) {
|
||||
LogPrintf("Peer %d sent us a getblocktxn for a block we don't have", pfrom->id);
|
||||
LogPrintf("Peer %d sent us a getblocktxn for a block we don't have", pfrom->GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2019,7 +2019,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// might maliciously send lots of getblocktxn requests to trigger
|
||||
// expensive disk reads, because it will require the peer to
|
||||
// actually receive all the data read from disk over the network.
|
||||
LogPrint(BCLog::NET, "Peer %d sent us a getblocktxn for a block > %i deep", pfrom->id, MAX_BLOCKTXN_DEPTH);
|
||||
LogPrint(BCLog::NET, "Peer %d sent us a getblocktxn for a block > %i deep", pfrom->GetId(), MAX_BLOCKTXN_DEPTH);
|
||||
CInv inv;
|
||||
inv.type = MSG_BLOCK;
|
||||
inv.hash = req.blockhash;
|
||||
@ -2044,7 +2044,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
|
||||
LOCK(cs_main);
|
||||
if (IsInitialBlockDownload() && !pfrom->fWhitelisted) {
|
||||
LogPrint(BCLog::NET, "Ignoring getheaders from peer=%d because node is in initial block download\n", pfrom->id);
|
||||
LogPrint(BCLog::NET, "Ignoring getheaders from peer=%d because node is in initial block download\n", pfrom->GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2074,7 +2074,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end
|
||||
std::vector<CBlock> vHeaders;
|
||||
int nLimit = MAX_HEADERS_RESULTS;
|
||||
LogPrint(BCLog::NET, "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.IsNull() ? "end" : hashStop.ToString(), pfrom->id);
|
||||
LogPrint(BCLog::NET, "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.IsNull() ? "end" : hashStop.ToString(), pfrom->GetId());
|
||||
for (; pindex; pindex = chainActive.Next(pindex))
|
||||
{
|
||||
vHeaders.push_back(pindex->GetBlockHeader());
|
||||
@ -2104,7 +2104,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// We are in blocks only mode and peer is either not whitelisted or whitelistrelay is off
|
||||
if (!fRelayTxes && (!pfrom->fWhitelisted || !GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY)))
|
||||
{
|
||||
LogPrint(BCLog::NET, "transaction sent in violation of protocol peer=%d\n", pfrom->id);
|
||||
LogPrint(BCLog::NET, "transaction sent in violation of protocol peer=%d\n", pfrom->GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2199,11 +2199,11 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// Process custom txes, this changes AlreadyHave to "true"
|
||||
if (nInvType == MSG_DSTX) {
|
||||
LogPrintf("DSTX -- Masternode transaction accepted, txid=%s, peer=%d\n",
|
||||
tx.GetHash().ToString(), pfrom->id);
|
||||
tx.GetHash().ToString(), pfrom->GetId());
|
||||
CPrivateSend::AddDSTX(dstx);
|
||||
} else if (nInvType == MSG_TXLOCK_REQUEST || fCanAutoLock) {
|
||||
LogPrintf("TXLOCKREQUEST -- Transaction Lock Request accepted, txid=%s, peer=%d\n",
|
||||
tx.GetHash().ToString(), pfrom->id);
|
||||
tx.GetHash().ToString(), pfrom->GetId());
|
||||
instantsend.AcceptLockRequest(txLockRequest);
|
||||
instantsend.Vote(tx.GetHash(), connman);
|
||||
}
|
||||
@ -2217,7 +2217,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
pfrom->nLastTXTime = GetTime();
|
||||
|
||||
LogPrint(BCLog::MEMPOOL, "AcceptToMemoryPool: peer=%d: accepted %s (poolsz %u txn, %u kB)\n",
|
||||
pfrom->id,
|
||||
pfrom->GetId(),
|
||||
tx.GetHash().ToString(),
|
||||
mempool.size(), mempool.DynamicMemoryUsage() / 1000);
|
||||
|
||||
@ -2341,10 +2341,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// case.
|
||||
int nDoS = 0;
|
||||
if (!state.IsInvalid(nDoS) || nDoS == 0) {
|
||||
LogPrintf("Force relaying tx %s from whitelisted peer=%d\n", tx.GetHash().ToString(), pfrom->id);
|
||||
LogPrintf("Force relaying tx %s from whitelisted peer=%d\n", tx.GetHash().ToString(), pfrom->GetId());
|
||||
connman.RelayTransaction(tx);
|
||||
} else {
|
||||
LogPrintf("Not relaying invalid transaction %s from whitelisted peer=%d (%s)\n", tx.GetHash().ToString(), pfrom->id, FormatStateMessage(state));
|
||||
LogPrintf("Not relaying invalid transaction %s from whitelisted peer=%d (%s)\n", tx.GetHash().ToString(), pfrom->GetId(), FormatStateMessage(state));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2353,7 +2353,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
if (state.IsInvalid(nDoS))
|
||||
{
|
||||
LogPrint(BCLog::MEMPOOLREJ, "%s from peer=%d was not accepted: %s\n", tx.GetHash().ToString(),
|
||||
pfrom->id,
|
||||
pfrom->GetId(),
|
||||
FormatStateMessage(state));
|
||||
if (state.GetRejectCode() > 0 && state.GetRejectCode() < REJECT_INTERNAL) // Never send AcceptToMemoryPool's internal codes over P2P
|
||||
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::REJECT, strCommand, (unsigned char)state.GetRejectCode(),
|
||||
@ -2389,7 +2389,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->GetId(), nDoS);
|
||||
}
|
||||
LogPrintf("Peer %d sent us invalid header via cmpctblock\n", pfrom->id);
|
||||
LogPrintf("Peer %d sent us invalid header via cmpctblock\n", pfrom->GetId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -2462,7 +2462,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
if (status == READ_STATUS_INVALID) {
|
||||
MarkBlockAsReceived(pindex->GetBlockHash()); // Reset in-flight state in case of whitelist
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
LogPrintf("Peer %d sent us invalid compact block\n", pfrom->id);
|
||||
LogPrintf("Peer %d sent us invalid compact block\n", pfrom->GetId());
|
||||
return true;
|
||||
} else if (status == READ_STATUS_FAILED) {
|
||||
// Duplicate txindexes, the block is now in-flight, so just request it
|
||||
@ -2567,7 +2567,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator it = mapBlocksInFlight.find(resp.blockhash);
|
||||
if (it == mapBlocksInFlight.end() || !it->second.second->partialBlock ||
|
||||
it->second.first != pfrom->GetId()) {
|
||||
LogPrint(BCLog::NET, "Peer %d sent us block transactions for block we weren't expecting\n", pfrom->id);
|
||||
LogPrint(BCLog::NET, "Peer %d sent us block transactions for block we weren't expecting\n", pfrom->GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2576,7 +2576,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
if (status == READ_STATUS_INVALID) {
|
||||
MarkBlockAsReceived(resp.blockhash); // Reset in-flight state in case of whitelist
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
LogPrintf("Peer %d sent us invalid compact block/non-matching block transactions\n", pfrom->id);
|
||||
LogPrintf("Peer %d sent us invalid compact block/non-matching block transactions\n", pfrom->GetId());
|
||||
return true;
|
||||
} else if (status == READ_STATUS_FAILED) {
|
||||
// Might have collided, fall back to getdata now :(
|
||||
@ -2664,7 +2664,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
headers[0].GetHash().ToString(),
|
||||
headers[0].hashPrevBlock.ToString(),
|
||||
pindexBestHeader->nHeight,
|
||||
pfrom->id, nodestate->nUnconnectingHeaders);
|
||||
pfrom->GetId(), nodestate->nUnconnectingHeaders);
|
||||
// Set hashLastUnknownBlock for this peer, so that if we
|
||||
// eventually get the headers - even from a different peer -
|
||||
// we can use this peer to download.
|
||||
@ -2702,7 +2702,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
LOCK(cs_main);
|
||||
CNodeState *nodestate = State(pfrom->GetId());
|
||||
if (nodestate->nUnconnectingHeaders > 0) {
|
||||
LogPrint(BCLog::NET, "peer=%d: resetting nUnconnectingHeaders (%d -> 0)\n", pfrom->id, nodestate->nUnconnectingHeaders);
|
||||
LogPrint(BCLog::NET, "peer=%d: resetting nUnconnectingHeaders (%d -> 0)\n", pfrom->GetId(), nodestate->nUnconnectingHeaders);
|
||||
}
|
||||
nodestate->nUnconnectingHeaders = 0;
|
||||
|
||||
@ -2713,7 +2713,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// Headers message had its maximum size; the peer may have more headers.
|
||||
// TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue
|
||||
// from there instead.
|
||||
LogPrint(BCLog::NET, "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight);
|
||||
LogPrint(BCLog::NET, "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->GetId(), pfrom->nStartingHeight);
|
||||
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::GETHEADERS, chainActive.GetLocator(pindexLast), uint256()));
|
||||
}
|
||||
|
||||
@ -2751,7 +2751,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
vGetData.push_back(CInv(MSG_BLOCK, pindex->GetBlockHash()));
|
||||
MarkBlockAsInFlight(pfrom->GetId(), pindex->GetBlockHash(), chainparams.GetConsensus(), pindex);
|
||||
LogPrint(BCLog::NET, "Requesting block %s from peer=%d\n",
|
||||
pindex->GetBlockHash().ToString(), pfrom->id);
|
||||
pindex->GetBlockHash().ToString(), pfrom->GetId());
|
||||
}
|
||||
if (vGetData.size() > 1) {
|
||||
LogPrint(BCLog::NET, "Downloading blocks toward %s (%d) via headers direct fetch\n",
|
||||
@ -2774,7 +2774,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
std::shared_ptr<CBlock> pblock = std::make_shared<CBlock>();
|
||||
vRecv >> *pblock;
|
||||
|
||||
LogPrint(BCLog::NET, "received block %s peer=%d\n", pblock->GetHash().ToString(), pfrom->id);
|
||||
LogPrint(BCLog::NET, "received block %s peer=%d\n", pblock->GetHash().ToString(), pfrom->GetId());
|
||||
|
||||
// Process all blocks from whitelisted peers, even if not requested,
|
||||
// unless we're still syncing with the network.
|
||||
@ -2806,14 +2806,14 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// Making nodes which are behind NAT and can only make outgoing connections ignore
|
||||
// the getaddr message mitigates the attack.
|
||||
if (!pfrom->fInbound) {
|
||||
LogPrint(BCLog::NET, "Ignoring \"getaddr\" from outbound connection. peer=%d\n", pfrom->id);
|
||||
LogPrint(BCLog::NET, "Ignoring \"getaddr\" from outbound connection. peer=%d\n", pfrom->GetId());
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only send one GetAddr response per connection to reduce resource waste
|
||||
// and discourage addr stamping of INV announcements.
|
||||
if (pfrom->fSentAddr) {
|
||||
LogPrint(BCLog::NET, "Ignoring repeated \"getaddr\". peer=%d\n", pfrom->id);
|
||||
LogPrint(BCLog::NET, "Ignoring repeated \"getaddr\". peer=%d\n", pfrom->GetId());
|
||||
return true;
|
||||
}
|
||||
pfrom->fSentAddr = true;
|
||||
@ -2914,7 +2914,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
|
||||
if (!(sProblem.empty())) {
|
||||
LogPrint(BCLog::NET, "pong peer=%d: %s, %x expected, %x received, %u bytes\n",
|
||||
pfrom->id,
|
||||
pfrom->GetId(),
|
||||
sProblem,
|
||||
pfrom->nPingNonceSent,
|
||||
nonce,
|
||||
@ -3027,7 +3027,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::MNLISTDIFF, mnListDiff));
|
||||
} else {
|
||||
LogPrint(BCLog::NET, "getmnlistdiff failed for baseBlockHash=%s, blockHash=%s. error=%s\n", cmd.baseBlockHash.ToString(), cmd.blockHash.ToString(), strError);
|
||||
Misbehaving(pfrom->id, 1);
|
||||
Misbehaving(pfrom->GetId(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3035,8 +3035,8 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
else if (strCommand == NetMsgType::MNLISTDIFF) {
|
||||
// we have never requested this
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->id, 100);
|
||||
LogPrint(BCLog::NET, "received not-requested mnlistdiff. peer=%d\n", pfrom->id);
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
LogPrint(BCLog::NET, "received not-requested mnlistdiff. peer=%d\n", pfrom->GetId());
|
||||
}
|
||||
|
||||
|
||||
@ -3077,7 +3077,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
else
|
||||
{
|
||||
// Ignore unknown commands for extensibility
|
||||
LogPrint(BCLog::NET, "Unknown command \"%s\" from peer=%d\n", SanitizeString(strCommand), pfrom->id);
|
||||
LogPrint(BCLog::NET, "Unknown command \"%s\" from peer=%d\n", SanitizeString(strCommand), pfrom->GetId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3156,7 +3156,7 @@ bool ProcessMessages(CNode* pfrom, CConnman& connman, const std::atomic<bool>& i
|
||||
msg.SetVersion(pfrom->GetRecvVersion());
|
||||
// Scan for message start
|
||||
if (memcmp(msg.hdr.pchMessageStart, chainparams.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) {
|
||||
LogPrintf("PROCESSMESSAGE: INVALID MESSAGESTART %s peer=%d\n", SanitizeString(msg.hdr.GetCommand()), pfrom->id);
|
||||
LogPrintf("PROCESSMESSAGE: INVALID MESSAGESTART %s peer=%d\n", SanitizeString(msg.hdr.GetCommand()), pfrom->GetId());
|
||||
pfrom->fDisconnect = true;
|
||||
return false;
|
||||
}
|
||||
@ -3165,7 +3165,7 @@ bool ProcessMessages(CNode* pfrom, CConnman& connman, const std::atomic<bool>& i
|
||||
CMessageHeader& hdr = msg.hdr;
|
||||
if (!hdr.IsValid(chainparams.MessageStart()))
|
||||
{
|
||||
LogPrintf("PROCESSMESSAGE: ERRORS IN HEADER %s peer=%d\n", SanitizeString(hdr.GetCommand()), pfrom->id);
|
||||
LogPrintf("PROCESSMESSAGE: ERRORS IN HEADER %s peer=%d\n", SanitizeString(hdr.GetCommand()), pfrom->GetId());
|
||||
return fMoreWork;
|
||||
}
|
||||
std::string strCommand = hdr.GetCommand();
|
||||
@ -3222,7 +3222,7 @@ bool ProcessMessages(CNode* pfrom, CConnman& connman, const std::atomic<bool>& i
|
||||
}
|
||||
|
||||
if (!fRet) {
|
||||
LogPrintf("%s(%s, %u bytes) FAILED peer=%d\n", __func__, SanitizeString(strCommand), nMessageSize, pfrom->id);
|
||||
LogPrintf("%s(%s, %u bytes) FAILED peer=%d\n", __func__, SanitizeString(strCommand), nMessageSize, pfrom->GetId());
|
||||
}
|
||||
|
||||
LOCK(cs_main);
|
||||
@ -3352,7 +3352,7 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
|
||||
got back an empty response. */
|
||||
if (pindexStart->pprev)
|
||||
pindexStart = pindexStart->pprev;
|
||||
LogPrint(BCLog::NET, "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->nHeight, pto->id, pto->nStartingHeight);
|
||||
LogPrint(BCLog::NET, "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->nHeight, pto->GetId(), pto->nStartingHeight);
|
||||
connman.PushMessage(pto, msgMaker.Make(NetMsgType::GETHEADERS, chainActive.GetLocator(pindexStart), uint256()));
|
||||
}
|
||||
}
|
||||
@ -3382,7 +3382,7 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
|
||||
(!state.fPreferHeaderAndIDs || pto->vBlockHashesToAnnounce.size() > 1)) ||
|
||||
pto->vBlockHashesToAnnounce.size() > MAX_BLOCKS_TO_ANNOUNCE);
|
||||
const CBlockIndex *pBestIndex = NULL; // last header queued for delivery
|
||||
ProcessBlockAvailability(pto->id); // ensure pindexBestKnownBlock is up-to-date
|
||||
ProcessBlockAvailability(pto->GetId()); // ensure pindexBestKnownBlock is up-to-date
|
||||
|
||||
if (!fRevertToInv) {
|
||||
bool fFoundStartingHeader = false;
|
||||
@ -3446,7 +3446,7 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
|
||||
// We only send up to 1 block as header-and-ids, as otherwise
|
||||
// probably means we're doing an initial-ish-sync or they're slow
|
||||
LogPrint(BCLog::NET, "%s sending header-and-ids %s to peer=%d\n", __func__,
|
||||
vHeaders.front().GetHash().ToString(), pto->id);
|
||||
vHeaders.front().GetHash().ToString(), pto->GetId());
|
||||
|
||||
bool fGotBlockFromCache = false;
|
||||
{
|
||||
@ -3469,10 +3469,10 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
|
||||
LogPrint(BCLog::NET, "%s: %u headers, range (%s, %s), to peer=%d\n", __func__,
|
||||
vHeaders.size(),
|
||||
vHeaders.front().GetHash().ToString(),
|
||||
vHeaders.back().GetHash().ToString(), pto->id);
|
||||
vHeaders.back().GetHash().ToString(), pto->GetId());
|
||||
} else {
|
||||
LogPrint(BCLog::NET, "%s: sending header %s to peer=%d\n", __func__,
|
||||
vHeaders.front().GetHash().ToString(), pto->id);
|
||||
vHeaders.front().GetHash().ToString(), pto->GetId());
|
||||
}
|
||||
connman.PushMessage(pto, msgMaker.Make(NetMsgType::HEADERS, vHeaders));
|
||||
state.pindexBestHeaderSent = pBestIndex;
|
||||
@ -3501,7 +3501,7 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
|
||||
if (!PeerHasHeader(&state, pindex)) {
|
||||
pto->PushInventory(CInv(MSG_BLOCK, hashToAnnounce));
|
||||
LogPrint(BCLog::NET, "%s: sending inv peer=%d hash=%s\n", __func__,
|
||||
pto->id, hashToAnnounce.ToString());
|
||||
pto->GetId(), hashToAnnounce.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3559,10 +3559,10 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
|
||||
}
|
||||
pto->filterInventoryKnown.insert(hash);
|
||||
|
||||
LogPrint(BCLog::NET, "SendMessages -- queued inv: %s index=%d peer=%d\n", inv.ToString(), vInv.size(), pto->id);
|
||||
LogPrint(BCLog::NET, "SendMessages -- queued inv: %s index=%d peer=%d\n", inv.ToString(), vInv.size(), pto->GetId());
|
||||
vInv.push_back(inv);
|
||||
if (vInv.size() == MAX_INV_SZ) {
|
||||
LogPrint(BCLog::NET, "SendMessages -- pushing inv's: count=%d peer=%d\n", vInv.size(), pto->id);
|
||||
LogPrint(BCLog::NET, "SendMessages -- pushing inv's: count=%d peer=%d\n", vInv.size(), pto->GetId());
|
||||
connman.PushMessage(pto, msgMaker.Make(NetMsgType::INV, vInv));
|
||||
vInv.clear();
|
||||
}
|
||||
@ -3651,7 +3651,7 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
|
||||
// Stalling only triggers when the block download window cannot move. During normal steady state,
|
||||
// the download window should be much larger than the to-be-downloaded set of blocks, so disconnection
|
||||
// should only happen during initial block download.
|
||||
LogPrintf("Peer=%d is stalling block download, disconnecting\n", pto->id);
|
||||
LogPrintf("Peer=%d is stalling block download, disconnecting\n", pto->GetId());
|
||||
pto->fDisconnect = true;
|
||||
return true;
|
||||
}
|
||||
@ -3664,7 +3664,7 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
|
||||
QueuedBlock &queuedBlock = state.vBlocksInFlight.front();
|
||||
int nOtherPeersWithValidatedDownloads = nPeersWithValidatedDownloads - (state.nBlocksInFlightValidHeaders > 0);
|
||||
if (nNow > state.nDownloadingSince + consensusParams.nPowTargetSpacing * (BLOCK_DOWNLOAD_TIMEOUT_BASE + BLOCK_DOWNLOAD_TIMEOUT_PER_PEER * nOtherPeersWithValidatedDownloads)) {
|
||||
LogPrintf("Timeout downloading block %s from peer=%d, disconnecting\n", queuedBlock.hash.ToString(), pto->id);
|
||||
LogPrintf("Timeout downloading block %s from peer=%d, disconnecting\n", queuedBlock.hash.ToString(), pto->GetId());
|
||||
pto->fDisconnect = true;
|
||||
return true;
|
||||
}
|
||||
@ -3715,7 +3715,7 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
|
||||
vGetData.push_back(CInv(MSG_BLOCK, pindex->GetBlockHash()));
|
||||
MarkBlockAsInFlight(pto->GetId(), pindex->GetBlockHash(), consensusParams, pindex);
|
||||
LogPrint(BCLog::NET, "Requesting block %s (%d) peer=%d\n", pindex->GetBlockHash().ToString(),
|
||||
pindex->nHeight, pto->id);
|
||||
pindex->nHeight, pto->GetId());
|
||||
}
|
||||
if (state.nBlocksInFlight == 0 && staller != -1) {
|
||||
if (State(staller)->nStallingSince == 0) {
|
||||
@ -3735,17 +3735,17 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
|
||||
const CInv& inv = it->second;
|
||||
if (!AlreadyHave(inv))
|
||||
{
|
||||
LogPrint(BCLog::NET, "SendMessages -- GETDATA -- requesting inv = %s peer=%d\n", inv.ToString(), pto->id);
|
||||
LogPrint(BCLog::NET, "SendMessages -- GETDATA -- requesting inv = %s peer=%d\n", inv.ToString(), pto->GetId());
|
||||
vGetData.push_back(inv);
|
||||
if (vGetData.size() >= 1000)
|
||||
{
|
||||
connman.PushMessage(pto, msgMaker.Make(NetMsgType::GETDATA, vGetData));
|
||||
LogPrint(BCLog::NET, "SendMessages -- GETDATA -- pushed size = %lu peer=%d\n", vGetData.size(), pto->id);
|
||||
LogPrint(BCLog::NET, "SendMessages -- GETDATA -- pushed size = %lu peer=%d\n", vGetData.size(), pto->GetId());
|
||||
vGetData.clear();
|
||||
}
|
||||
} else {
|
||||
//If we're not going to ask, don't expect a response.
|
||||
LogPrint(BCLog::NET, "SendMessages -- GETDATA -- already have inv = %s peer=%d\n", inv.ToString(), pto->id);
|
||||
LogPrint(BCLog::NET, "SendMessages -- GETDATA -- already have inv = %s peer=%d\n", inv.ToString(), pto->GetId());
|
||||
pto->setAskFor.erase(inv.hash);
|
||||
}
|
||||
++it;
|
||||
@ -3753,7 +3753,7 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
|
||||
pto->vecAskFor.erase(pto->vecAskFor.begin(), it);
|
||||
if (!vGetData.empty()) {
|
||||
connman.PushMessage(pto, msgMaker.Make(NetMsgType::GETDATA, vGetData));
|
||||
LogPrint(BCLog::NET, "SendMessages -- GETDATA -- pushed size = %lu peer=%d\n", vGetData.size(), pto->id);
|
||||
LogPrint(BCLog::NET, "SendMessages -- GETDATA -- pushed size = %lu peer=%d\n", vGetData.size(), pto->GetId());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string&
|
||||
|
||||
if (strCommand == NetMsgType::DSQUEUE) {
|
||||
if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
|
||||
LogPrint(BCLog::PRIVATESEND, "DSQUEUE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::PRIVATESEND, "DSQUEUE -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION)));
|
||||
return;
|
||||
}
|
||||
@ -68,7 +68,7 @@ void CPrivateSendClientManager::ProcessMessage(CNode* pfrom, const std::string&
|
||||
|
||||
if (!dsq.CheckSignature(dmn->pdmnState->pubKeyOperator.Get())) {
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->id, 10);
|
||||
Misbehaving(pfrom->GetId(), 10);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ void CPrivateSendClientSession::ProcessMessage(CNode* pfrom, const std::string&
|
||||
|
||||
if (strCommand == NetMsgType::DSSTATUSUPDATE) {
|
||||
if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
|
||||
LogPrint(BCLog::PRIVATESEND, "DSSTATUSUPDATE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::PRIVATESEND, "DSSTATUSUPDATE -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION)));
|
||||
return;
|
||||
}
|
||||
@ -174,7 +174,7 @@ void CPrivateSendClientSession::ProcessMessage(CNode* pfrom, const std::string&
|
||||
|
||||
} else if (strCommand == NetMsgType::DSFINALTX) {
|
||||
if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
|
||||
LogPrint(BCLog::PRIVATESEND, "DSFINALTX -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::PRIVATESEND, "DSFINALTX -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION)));
|
||||
return;
|
||||
}
|
||||
@ -201,7 +201,7 @@ void CPrivateSendClientSession::ProcessMessage(CNode* pfrom, const std::string&
|
||||
|
||||
} else if (strCommand == NetMsgType::DSCOMPLETE) {
|
||||
if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
|
||||
LogPrint(BCLog::PRIVATESEND, "DSCOMPLETE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::PRIVATESEND, "DSCOMPLETE -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION)));
|
||||
return;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
|
||||
if (strCommand == NetMsgType::DSACCEPT) {
|
||||
if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
|
||||
LogPrint(BCLog::PRIVATESEND, "DSACCEPT -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::PRIVATESEND, "DSACCEPT -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION)));
|
||||
PushStatus(pfrom, STATUS_REJECTED, ERR_VERSION, connman);
|
||||
return;
|
||||
@ -97,7 +97,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
if (!lockRecv) return;
|
||||
|
||||
if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
|
||||
LogPrint(BCLog::PRIVATESEND, "DSQUEUE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::PRIVATESEND, "DSQUEUE -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION)));
|
||||
return;
|
||||
}
|
||||
@ -123,7 +123,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
|
||||
if (!dsq.CheckSignature(dmn->pdmnState->pubKeyOperator.Get())) {
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->id, 10);
|
||||
Misbehaving(pfrom->GetId(), 10);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
|
||||
} else if (strCommand == NetMsgType::DSVIN) {
|
||||
if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
|
||||
LogPrint(BCLog::PRIVATESEND, "DSVIN -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::PRIVATESEND, "DSVIN -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION)));
|
||||
PushStatus(pfrom, STATUS_REJECTED, ERR_VERSION, connman);
|
||||
return;
|
||||
@ -274,7 +274,7 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm
|
||||
|
||||
} else if (strCommand == NetMsgType::DSSIGNFINALTX) {
|
||||
if (pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) {
|
||||
LogPrint(BCLog::PRIVATESEND, "DSSIGNFINALTX -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrint(BCLog::PRIVATESEND, "DSSIGNFINALTX -- peer=%d using obsolete version %i\n", pfrom->GetId(), pfrom->nVersion);
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION)));
|
||||
return;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ void CSporkManager::ProcessSpork(CNode* pfrom, const std::string& strCommand, CD
|
||||
LOCK(cs_main);
|
||||
connman.RemoveAskFor(hash);
|
||||
if(!chainActive.Tip()) return;
|
||||
strLogMsg = strprintf("SPORK -- hash: %s id: %d value: %10d bestHeight: %d peer=%d", hash.ToString(), spork.nSporkID, spork.nValue, chainActive.Height(), pfrom->id);
|
||||
strLogMsg = strprintf("SPORK -- hash: %s id: %d value: %10d bestHeight: %d peer=%d", hash.ToString(), spork.nSporkID, spork.nValue, chainActive.Height(), pfrom->GetId());
|
||||
}
|
||||
|
||||
if (spork.nTimeSigned > GetAdjustedTime() + 2 * 60 * 60) {
|
||||
|
Loading…
Reference in New Issue
Block a user