Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion contrib/devtools/copyright_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
'src/ctpl_stl.h',
'src/test/fuzz/FuzzedDataProvider.h',
'src/tinyformat.h',
'src/util/expected.h',
'src/wallet/bip39.cpp',
'src/wallet/bip39.h',
'src/wallet/bip39_english.h',
Expand Down
1 change: 0 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ BITCOIN_CORE_H = \
util/enumerate.h \
util/epochguard.h \
util/error.h \
util/expected.h \
util/fastrange.h \
util/fees.h \
util/golombrice.h \
Expand Down
3 changes: 1 addition & 2 deletions src/chainlock/chainlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <chainlock/clsig.h>

#include <net_types.h>
#include <primitives/transaction.h>
#include <protocol.h>
#include <saltedhasher.h>
Expand All @@ -28,8 +29,6 @@ class CScheduler;
class CSporkManager;
class CTxMemPool;

using NodeId = int64_t;

namespace llmq {
class CInstantSendManager;
class CQuorumManager;
Expand Down
2 changes: 1 addition & 1 deletion src/chainlock/signing.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ChainLockSignerParent
virtual bool HasConflictingChainLock(int nHeight, const uint256& blockHash) const = 0;
virtual bool IsEnabled() const = 0;
virtual bool IsTxSafeForMining(const uint256& txid) const = 0;
virtual MessageProcessingResult ProcessNewChainLock(NodeId from, const ChainLockSig& clsig, const uint256& hash) = 0;
[[nodiscard]] virtual MessageProcessingResult ProcessNewChainLock(NodeId from, const ChainLockSig& clsig, const uint256& hash) = 0;
virtual void UpdateTxFirstSeenMap(const std::unordered_set<uint256, StaticSaltedHasher>& tx, const int64_t& time) = 0;
};

Expand Down
50 changes: 23 additions & 27 deletions src/coinjoin/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,36 @@ using wallet::CoinType;
using wallet::CWallet;
using wallet::ReserveDestination;

PeerMsgRet CCoinJoinClientQueueManager::ProcessMessage(const CNode& peer, CConnman& connman, PeerManager& peerman,
std::string_view msg_type, CDataStream& vRecv)
MessageProcessingResult CCoinJoinClientQueueManager::ProcessMessage(NodeId from, CConnman& connman, PeerManager& peerman,
std::string_view msg_type, CDataStream& vRecv)
{
if (msg_type != NetMsgType::DSQUEUE) {
return {};
}

if (m_is_masternode) return {};
if (!m_mn_sync.IsBlockchainSynced()) return {};

if (msg_type == NetMsgType::DSQUEUE) {
return CCoinJoinClientQueueManager::ProcessDSQueue(peer, connman, peerman, vRecv);
}
return {};
}

PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CConnman& connman, PeerManager& peerman,
CDataStream& vRecv)
{
assert(m_mn_metaman.IsValid());

CCoinJoinQueue dsq;
vRecv >> dsq;

{
LOCK(::cs_main);
peerman.EraseObjectRequest(peer.GetId(), CInv(MSG_DSQ, dsq.GetHash()));
}
MessageProcessingResult ret{};
ret.m_to_erase = CInv{MSG_DSQ, dsq.GetHash()};

if (dsq.masternodeOutpoint.IsNull() && dsq.m_protxHash.IsNull()) {
return tl::unexpected{100};
ret.m_error = MisbehavingError{100};
return ret;
}

const auto tip_mn_list = m_dmnman.GetListAtChainTip();
if (dsq.masternodeOutpoint.IsNull()) {
if (auto dmn = tip_mn_list.GetValidMN(dsq.m_protxHash)) {
dsq.masternodeOutpoint = dmn->collateralOutpoint;
} else {
return tl::unexpected{10};
ret.m_error = MisbehavingError{10};
return ret;
}
}

Expand All @@ -84,31 +79,32 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CConnm
// process every dsq only once
for (const auto &q: vecCoinJoinQueue) {
if (q == dsq) {
return {};
return ret;
}
if (q.fReady == dsq.fReady && q.masternodeOutpoint == dsq.masternodeOutpoint) {
// no way the same mn can send another dsq with the same readiness this soon
LogPrint(BCLog::COINJOIN, /* Continued */
"DSQUEUE -- Peer %s is sending WAY too many dsq messages for a masternode with collateral %s\n",
peer.GetLogString(), dsq.masternodeOutpoint.ToStringShort());
return {};
"DSQUEUE -- Peer %d is sending WAY too many dsq messages for a masternode with collateral %s\n",
from, dsq.masternodeOutpoint.ToStringShort());
return ret;
}
}
Comment on lines 84 to 91
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Fix clang-format diff failure in this hunk

CI flagged style differences here. Please apply the formatter.

You can use:


🏁 Script executed:

#!/bin/bash
git diff -U0 | contrib/devtools/clang-format-diff.py -p1 -i -v

Length of output: 64


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE=src/coinjoin/client.cpp

echo "=== Git branch ==="
git rev-parse --abbrev-ref HEAD || true
echo

echo "=== Git remotes ==="
git remote -v || true
echo

echo "=== Last commit ==="
git log -1 --oneline || true
echo

if [ ! -f "$FILE" ]; then
  echo "FILE_NOT_FOUND: $FILE"
  exit 0
fi

echo "=== File snippet ($FILE) ==="
nl -ba "$FILE" | sed -n '1,140p'
echo

# Determine a reasonable base to diff against
BASE=""
for candidate in origin/main origin/master origin/HEAD HEAD~1; do
  if git rev-parse --verify "$candidate" >/dev/null 2>&1; then
    if git show "$candidate":"$FILE" >/dev/null 2>&1; then
      BASE="$candidate"
      break
    fi
  fi
done

if [ -z "$BASE" ]; then
  echo "No upstream base found; will diff against HEAD~1"
  BASE="HEAD~1"
fi

echo "=== Diff base chosen: $BASE ==="
git rev-parse --short "$BASE" || true
echo

echo "=== Generating diff for $FILE (unified, 0 context) ==="
git diff -U0 "$BASE".."HEAD" -- "$FILE" > /tmp/file.diff || true
if [ ! -s /tmp/file.diff ]; then
  echo "Diff is empty (no changes to $FILE between $BASE and HEAD). Showing full diff of HEAD~1..HEAD for the file as fallback."
  git diff -U0 HEAD~1..HEAD -- "$FILE" > /tmp/file.diff || true
fi
echo "=== Diff (first 200 lines) ==="
sed -n '1,200p' /tmp/file.diff || true
echo

echo "=== clang-format presence ==="
if command -v clang-format >/dev/null 2>&1; then
  echo "clang-format found: $(command -v clang-format)"
else
  echo "clang-format NOT found in PATH"
fi
echo

echo "=== Running contrib/devtools/clang-format-diff.py on the diff ==="
python3 contrib/devtools/clang-format-diff.py -p1 -i -v < /tmp/file.diff || echo "clang-format-diff.py exited with non-zero status"

Length of output: 796


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE=src/coinjoin/client.cpp

echo "=== Git branch ==="
git rev-parse --abbrev-ref HEAD || true
echo

echo "=== Last commit ==="
git log -1 --oneline || true
echo

if [ ! -f "$FILE" ]; then
  echo "FILE_NOT_FOUND: $FILE"
  exit 0
fi

echo "=== File snippet ($FILE) lines 1-200 ==="
awk '{printf("%5d: %s\n", NR, $0)}' "$FILE" | sed -n '1,200p'
echo

# Determine base for diff
BASE=""
for candidate in origin/main origin/master origin/HEAD HEAD~1; do
  if git rev-parse --verify "$candidate" >/dev/null 2>&1; then
    if git show "$candidate":"$FILE" >/dev/null 2>&1; then
      BASE="$candidate"
      break
    fi
  fi
done

if [ -z "$BASE" ]; then
  echo "No upstream base found; using HEAD~1"
  BASE="HEAD~1"
fi

echo "=== Diff base chosen: $BASE ==="
git rev-parse --short "$BASE" || true
echo

echo "=== Generating diff for $FILE (unified, 0 context) ==="
git diff -U0 "$BASE".."HEAD" -- "$FILE" > /tmp/file.diff || true
if [ ! -s /tmp/file.diff ]; then
  echo "Diff empty against $BASE; trying HEAD~1..HEAD"
  git diff -U0 HEAD~1..HEAD -- "$FILE" > /tmp/file.diff || true
fi
echo "=== Diff (first 200 lines) ==="
sed -n '1,200p' /tmp/file.diff || true
echo

echo "=== clang-format presence ==="
if command -v clang-format >/dev/null 2>&1; then
  echo "clang-format found: $(command -v clang-format)"
else
  echo "clang-format NOT found in PATH"
fi
echo

echo "=== Running contrib/devtools/clang-format-diff.py ==="
python3 contrib/devtools/clang-format-diff.py -p1 -i -v < /tmp/file.diff || echo "clang-format-diff.py exited with non-zero status"

Length of output: 15308


Apply clang-format to src/coinjoin/client.cpp (hunk around lines 84–91)

CI flagged style differences in this hunk. I ran contrib/devtools/clang-format-diff.py but it failed here because clang-format is not available in the environment (FileNotFoundError). Please run the formatter and commit the result.

  • File: src/coinjoin/client.cpp — hunk around lines 84–91 (DSQUEUE log block)
  • Problematic snippet:
                if (q.fReady == dsq.fReady && q.masternodeOutpoint == dsq.masternodeOutpoint) {
                    // no way the same mn can send another dsq with the same readiness this soon
                    LogPrint(BCLog::COINJOIN, /* Continued */
                             "DSQUEUE -- Peer %d is sending WAY too many dsq messages for a masternode with collateral %s\n",
                             from, dsq.masternodeOutpoint.ToStringShort());
                    return ret;
                }

Suggested fix (run locally and commit the formatted changes):

  • git diff -U0 | contrib/devtools/clang-format-diff.py -p1 -i -v
  • or run clang-format directly: clang-format -i src/coinjoin/client.cpp
🧰 Tools
🪛 GitHub Actions: Clang Diff Format Check

[error] 84-91: Clang-format differences detected by clang-format-diff.py. Apply formatting changes to this file.

🤖 Prompt for AI Agents
In src/coinjoin/client.cpp around lines 84 to 91, the DSQUEUE LogPrint block is
misformatted per clang-format; run the project formatter on this file (e.g.
clang-format -i src/coinjoin/client.cpp or run git diff -U0 |
contrib/devtools/clang-format-diff.py -p1 -i -v) to reformat the hunk so it
matches the repo style, then stage and commit the resulting changes.

} // cs_vecqueue

LogPrint(BCLog::COINJOIN, "DSQUEUE -- %s new\n", dsq.ToString());

if (dsq.IsTimeOutOfBounds()) return {};
if (dsq.IsTimeOutOfBounds()) return ret;

auto dmn = tip_mn_list.GetValidMNByCollateral(dsq.masternodeOutpoint);
if (!dmn) return {};
if (!dmn) return ret;

if (dsq.m_protxHash.IsNull()) {
dsq.m_protxHash = dmn->proTxHash;
}

if (!dsq.CheckSignature(dmn->pdmnState->pubKeyOperator.Get())) {
return tl::unexpected{10};
ret.m_error = MisbehavingError{10};
return ret;
}

// if the queue is ready, submit if we can
Expand All @@ -117,7 +113,7 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CConnm
return clientman->TrySubmitDenominate(dmn->proTxHash, connman);
})) {
LogPrint(BCLog::COINJOIN, "DSQUEUE -- CoinJoin queue is ready, masternode=%s, queue=%s\n", dmn->proTxHash.ToString(), dsq.ToString());
return {};
return ret;
} else {
int64_t nLastDsq = m_mn_metaman.GetMetaInfo(dmn->proTxHash)->GetLastDsq();
int64_t nDsqThreshold = m_mn_metaman.GetDsqThreshold(dmn->proTxHash, tip_mn_list.GetValidMNsCount());
Expand All @@ -127,7 +123,7 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CConnm
if (nLastDsq != 0 && nDsqThreshold > m_mn_metaman.GetDsqCount()) {
LogPrint(BCLog::COINJOIN, "DSQUEUE -- Masternode %s is sending too many dsq messages\n",
dmn->proTxHash.ToString());
return {};
return ret;
}

m_mn_metaman.AllowMixing(dmn->proTxHash);
Expand All @@ -142,7 +138,7 @@ PeerMsgRet CCoinJoinClientQueueManager::ProcessDSQueue(const CNode& peer, CConnm
}
} // cs_ProcessDSQueue
peerman.RelayDSQ(dsq);
return {};
return ret;
}

void CCoinJoinClientManager::ProcessMessage(CNode& peer, CChainState& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv)
Expand Down
7 changes: 4 additions & 3 deletions src/coinjoin/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <coinjoin/util.h>
#include <coinjoin/coinjoin.h>

#include <net_types.h>
#include <protocol.h>
#include <util/ranges.h>
#include <util/translation.h>
Expand Down Expand Up @@ -252,9 +253,9 @@ class CCoinJoinClientQueueManager : public CCoinJoinBaseManager
m_mn_sync(mn_sync),
m_is_masternode{is_masternode} {};

PeerMsgRet ProcessMessage(const CNode& peer, CConnman& connman, PeerManager& peerman, std::string_view msg_type,
CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue);
PeerMsgRet ProcessDSQueue(const CNode& peer, CConnman& connman, PeerManager& peerman, CDataStream& vRecv);
[[nodiscard]] MessageProcessingResult ProcessMessage(NodeId from, CConnman& connman, PeerManager& peerman, std::string_view msg_type,
CDataStream& vRecv)
EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue);
void DoMaintenance();
};

Expand Down
39 changes: 20 additions & 19 deletions src/coinjoin/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

#include <univalue.h>

PeerMsgRet CCoinJoinServer::ProcessMessage(CNode& peer, std::string_view msg_type, CDataStream& vRecv)
MessageProcessingResult CCoinJoinServer::ProcessMessage(CNode& peer, std::string_view msg_type, CDataStream& vRecv)
{
if (!m_mn_activeman) return {};
if (!m_mn_sync.IsBlockchainSynced()) return {};

if (msg_type == NetMsgType::DSACCEPT) {
ProcessDSACCEPT(peer, vRecv);
} else if (msg_type == NetMsgType::DSQUEUE) {
return ProcessDSQUEUE(peer, vRecv);
return ProcessDSQUEUE(peer.GetId(), vRecv);
} else if (msg_type == NetMsgType::DSVIN) {
ProcessDSVIN(peer, vRecv);
} else if (msg_type == NetMsgType::DSSIGNFINALTX) {
Expand Down Expand Up @@ -109,61 +109,62 @@ void CCoinJoinServer::ProcessDSACCEPT(CNode& peer, CDataStream& vRecv)
}
}

PeerMsgRet CCoinJoinServer::ProcessDSQUEUE(const CNode& peer, CDataStream& vRecv)
MessageProcessingResult CCoinJoinServer::ProcessDSQUEUE(NodeId from, CDataStream& vRecv)
{
assert(m_mn_metaman.IsValid());

CCoinJoinQueue dsq;
vRecv >> dsq;

{
LOCK(::cs_main);
Assert(m_peerman)->EraseObjectRequest(peer.GetId(), CInv(MSG_DSQ, dsq.GetHash()));
}
MessageProcessingResult ret{};
ret.m_to_erase = CInv{MSG_DSQ, dsq.GetHash()};

if (dsq.masternodeOutpoint.IsNull() && dsq.m_protxHash.IsNull()) {
return tl::unexpected{100};
ret.m_error = MisbehavingError{100};
return ret;
}

const auto tip_mn_list = m_dmnman.GetListAtChainTip();
if (dsq.masternodeOutpoint.IsNull()) {
if (auto dmn = tip_mn_list.GetValidMN(dsq.m_protxHash)) {
dsq.masternodeOutpoint = dmn->collateralOutpoint;
} else {
return tl::unexpected{10};
ret.m_error = MisbehavingError{10};
return ret;
}
}

{
TRY_LOCK(cs_vecqueue, lockRecv);
if (!lockRecv) return {};
if (!lockRecv) return ret;

// process every dsq only once
for (const auto& q : vecCoinJoinQueue) {
if (q == dsq) {
return {};
return ret;
}
if (q.fReady == dsq.fReady && q.masternodeOutpoint == dsq.masternodeOutpoint) {
// no way the same mn can send another dsq with the same readiness this soon
LogPrint(BCLog::COINJOIN, "DSQUEUE -- Peer %s is sending WAY too many dsq messages for a masternode with collateral %s\n", peer.GetLogString(), dsq.masternodeOutpoint.ToStringShort());
return {};
LogPrint(BCLog::COINJOIN, "DSQUEUE -- Peer %d is sending WAY too many dsq messages for a masternode with collateral %s\n", from, dsq.masternodeOutpoint.ToStringShort());
return ret;
}
}
} // cs_vecqueue

LogPrint(BCLog::COINJOIN, "DSQUEUE -- %s new\n", dsq.ToString());

if (dsq.IsTimeOutOfBounds()) return {};
if (dsq.IsTimeOutOfBounds()) return ret;

auto dmn = tip_mn_list.GetValidMNByCollateral(dsq.masternodeOutpoint);
if (!dmn) return {};
if (!dmn) return ret;

if (dsq.m_protxHash.IsNull()) {
dsq.m_protxHash = dmn->proTxHash;
}

if (!dsq.CheckSignature(dmn->pdmnState->pubKeyOperator.Get())) {
return tl::unexpected{10};
ret.m_error = MisbehavingError{10};
return ret;
}

if (!dsq.fReady) {
Expand All @@ -173,18 +174,18 @@ PeerMsgRet CCoinJoinServer::ProcessDSQUEUE(const CNode& peer, CDataStream& vRecv
//don't allow a few nodes to dominate the queuing process
if (nLastDsq != 0 && nDsqThreshold > m_mn_metaman.GetDsqCount()) {
LogPrint(BCLog::COINJOIN, "DSQUEUE -- node sending too many dsq messages, masternode=%s\n", dmn->proTxHash.ToString());
return {};
return ret;
}
m_mn_metaman.AllowMixing(dmn->proTxHash);

LogPrint(BCLog::COINJOIN, "DSQUEUE -- new CoinJoin queue, masternode=%s, queue=%s\n", dmn->proTxHash.ToString(), dsq.ToString());

TRY_LOCK(cs_vecqueue, lockRecv);
if (!lockRecv) return {};
if (!lockRecv) return ret;
vecCoinJoinQueue.push_back(dsq);
m_peerman->RelayDSQ(dsq);
}
return {};
return ret;
}

void CCoinJoinServer::ProcessDSVIN(CNode& peer, CDataStream& vRecv)
Expand Down
5 changes: 3 additions & 2 deletions src/coinjoin/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <coinjoin/coinjoin.h>

#include <net_types.h>
#include <protocol.h>

class CActiveMasternodeManager;
Expand Down Expand Up @@ -85,7 +86,7 @@ class CCoinJoinServer : public CCoinJoinBaseSession, public CCoinJoinBaseManager
void RelayCompletedTransaction(PoolMessage nMessageID) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);

void ProcessDSACCEPT(CNode& peer, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue);
PeerMsgRet ProcessDSQUEUE(const CNode& peer, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue);
[[nodiscard]] MessageProcessingResult ProcessDSQUEUE(NodeId from, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_vecqueue);
void ProcessDSVIN(CNode& peer, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);
void ProcessDSSIGNFINALTX(CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_coinjoin);

Expand All @@ -110,7 +111,7 @@ class CCoinJoinServer : public CCoinJoinBaseSession, public CCoinJoinBaseManager
fUnitTest(false)
{}

PeerMsgRet ProcessMessage(CNode& pfrom, std::string_view msg_type, CDataStream& vRecv);
[[nodiscard]] MessageProcessingResult ProcessMessage(CNode& pfrom, std::string_view msg_type, CDataStream& vRecv);

bool HasTimedOut() const;
void CheckTimeout();
Expand Down
18 changes: 9 additions & 9 deletions src/evo/mnauth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ void CMNAuth::PushMNAUTH(CNode& peer, CConnman& connman, const CActiveMasternode
connman.PushMessage(&peer, CNetMsgMaker(peer.GetCommonVersion()).Make(NetMsgType::MNAUTH, mnauth));
}

PeerMsgRet CMNAuth::ProcessMessage(CNode& peer, ServiceFlags node_services, CConnman& connman, CMasternodeMetaMan& mn_metaman, const CActiveMasternodeManager* const mn_activeman,
const CMasternodeSync& mn_sync, const CDeterministicMNList& tip_mn_list,
std::string_view msg_type, CDataStream& vRecv)
MessageProcessingResult CMNAuth::ProcessMessage(CNode& peer, ServiceFlags node_services, CConnman& connman, CMasternodeMetaMan& mn_metaman,
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
const CDeterministicMNList& tip_mn_list, std::string_view msg_type, CDataStream& vRecv)
{
assert(mn_metaman.IsValid());

Expand All @@ -71,30 +71,30 @@ PeerMsgRet CMNAuth::ProcessMessage(CNode& peer, ServiceFlags node_services, CCon

// only one MNAUTH allowed
if (!peer.GetVerifiedProRegTxHash().IsNull()) {
return tl::unexpected{MisbehavingError{100, "duplicate mnauth"}};
return MisbehavingError{100, "duplicate mnauth"};
}

if ((~node_services) & (NODE_NETWORK | NODE_BLOOM)) {
// either NODE_NETWORK or NODE_BLOOM bit is missing in node's services
return tl::unexpected{MisbehavingError{100, "mnauth from a node with invalid services"}};
return MisbehavingError{100, "mnauth from a node with invalid services"};
}

if (mnauth.proRegTxHash.IsNull()) {
return tl::unexpected{MisbehavingError{100, "empty mnauth proRegTxHash"}};
return MisbehavingError{100, "empty mnauth proRegTxHash"};
}

if (!mnauth.sig.IsValid()) {
LogPrint(BCLog::NET_NETCONN, "CMNAuth::ProcessMessage -- invalid mnauth for protx=%s with sig=%s\n",
mnauth.proRegTxHash.ToString(), mnauth.sig.ToString(false));
return tl::unexpected{MisbehavingError{100, "invalid mnauth signature"}};
return MisbehavingError{100, "invalid mnauth signature"};
}

const auto dmn = tip_mn_list.GetMN(mnauth.proRegTxHash);
if (!dmn) {
// in case node was unlucky and not up to date, just let it be connected as a regular node, which gives it
// a chance to get up-to-date and thus realize that it's not a MN anymore. We still give it a
// low DoS score.
return tl::unexpected{MisbehavingError{10, "missing mnauth masternode"}};
return MisbehavingError{10, "missing mnauth masternode"};
}

uint256 signHash;
Expand All @@ -114,7 +114,7 @@ PeerMsgRet CMNAuth::ProcessMessage(CNode& peer, ServiceFlags node_services, CCon
if (!mnauth.sig.VerifyInsecure(dmn->pdmnState->pubKeyOperator.Get(), signHash, false)) {
// Same as above, MN seems to not know its fate yet, so give it a chance to update. If this is a
// malicious node (DoSing us), it'll get banned soon.
return tl::unexpected{MisbehavingError{10, "mnauth signature verification failed"}};
return MisbehavingError{10, "mnauth signature verification failed"};
}

if (!peer.IsInboundConn()) {
Expand Down
6 changes: 3 additions & 3 deletions src/evo/mnauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class CMNAuth
* @pre CMasternodeMetaMan's database must be successfully loaded before
* attempting to call this function regardless of sync state
*/
static PeerMsgRet ProcessMessage(CNode& peer, ServiceFlags node_services, CConnman& connman, CMasternodeMetaMan& mn_metaman, const CActiveMasternodeManager* const mn_activeman,
const CMasternodeSync& mn_sync, const CDeterministicMNList& tip_mn_list,
std::string_view msg_type, CDataStream& vRecv);
[[nodiscard]] static MessageProcessingResult ProcessMessage(CNode& peer, ServiceFlags node_services, CConnman& connman, CMasternodeMetaMan& mn_metaman,
const CActiveMasternodeManager* const mn_activeman, const CMasternodeSync& mn_sync,
const CDeterministicMNList& tip_mn_list, std::string_view msg_type, CDataStream& vRecv);
static void NotifyMasternodeListChanged(bool undo, const CDeterministicMNList& oldMNList, const CDeterministicMNListDiff& diff, CConnman& connman);
};

Expand Down
Loading
Loading