Skip to content

Commit

Permalink
feat: p2p message mnauth to always use Basic BLS scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Dec 26, 2024
1 parent 59d13ab commit 597d95e
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 @@ -51,7 +51,8 @@ void CMNAuth::PushMNAUTH(CNode& peer, CConnman& connman, const CActiveMasternode

mnauth.proRegTxHash = mn_activeman.GetProTxHash();

mnauth.sig = mn_activeman.Sign(signHash, bls::bls_legacy_scheme.load());
// all clients uses basic BLS
mnauth.sig = mn_activeman.Sign(signHash, false);

LogPrint(BCLog::NET_NETCONN, "CMNAuth::%s -- Sending MNAUTH, peer=%d\n", __func__, peer.GetId());
connman.PushMessage(&peer, CNetMsgMaker(peer.GetCommonVersion()).Make(NetMsgType::MNAUTH, mnauth));
Expand Down Expand Up @@ -86,7 +87,8 @@ PeerMsgRet CMNAuth::ProcessMessage(CNode& peer, ServiceFlags node_services, CCon
}

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());
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"}};
}

Expand All @@ -112,7 +114,7 @@ PeerMsgRet CMNAuth::ProcessMessage(CNode& peer, ServiceFlags node_services, CCon
}
LogPrint(BCLog::NET_NETCONN, "CMNAuth::%s -- constructed signHash for nVersion %d, peer=%d\n", __func__, peer.nVersion, peer.GetId());

if (!mnauth.sig.VerifyInsecure(dmn->pdmnState->pubKeyOperator.Get(), signHash)) {
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"}};
Expand Down

0 comments on commit 597d95e

Please sign in to comment.