Skip to content

Commit

Permalink
fix: treat our inactive MN as a regular node when processing mnauth
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 committed Oct 31, 2023
1 parent 25ee167 commit c7ea030
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/evo/mnauth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,20 @@ void CMNAuth::ProcessMessage(CNode& peer, PeerManager& peerman, CConnman& connma
}
}

const uint256 myProTxHash = WITH_LOCK(activeMasternodeInfoCs, return activeMasternodeInfo.proTxHash);

connman.ForEachNode([&](CNode* pnode2) {
if (peer.fDisconnect) {
// we've already disconnected the new peer
return;
}

if (pnode2->GetVerifiedProRegTxHash() == mnauth.proRegTxHash) {
if (fMasternodeMode) {
const auto deterministicOutbound = WITH_LOCK(activeMasternodeInfoCs, return llmq::utils::DeterministicOutboundConnection(activeMasternodeInfo.proTxHash, mnauth.proRegTxHash));
if (fMasternodeMode && !myProTxHash.IsNull()) {
const auto deterministicOutbound = llmq::utils::DeterministicOutboundConnection(myProTxHash, mnauth.proRegTxHash);
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- Masternode %s has already verified as peer %d, deterministicOutbound=%s. peer=%d\n",
mnauth.proRegTxHash.ToString(), pnode2->GetId(), deterministicOutbound.ToString(), peer.GetId());
if (WITH_LOCK(activeMasternodeInfoCs, return deterministicOutbound == activeMasternodeInfo.proTxHash)) {
if (deterministicOutbound == myProTxHash) {
if (pnode2->fInbound) {
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- dropping old inbound, peer=%d\n", pnode2->GetId());
pnode2->fDisconnect = true;
Expand Down

0 comments on commit c7ea030

Please sign in to comment.