diff --git a/src/masternode.cpp b/src/masternode.cpp index 1bec0db3e9846..594aafa57cfd0 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -519,8 +519,7 @@ bool CMasternodeBroadcast::CheckAndUpdate(int& nDos) } std::string errorMessage = ""; - if (!obfuScationSigner.VerifyMessage(pubKeyCollateralAddress, sig, GetNewStrMessage(), errorMessage) - && !obfuScationSigner.VerifyMessage(pubKeyCollateralAddress, sig, GetOldStrMessage(), errorMessage)) + if (!obfuScationSigner.VerifyMessage(pubKeyCollateralAddress, sig, GetStrMessage(), errorMessage)) { // don't ban for old masternodes, their sigs could be broken because of the bug nDos = protocolVersion < MIN_PEER_MNANNOUNCE ? 0 : 100; @@ -661,11 +660,7 @@ bool CMasternodeBroadcast::Sign(CKey& keyCollateralAddress) std::string errorMessage; sigTime = GetAdjustedTime(); - std::string strMessage; - if(chainActive.Height() < Params().Zerocoin_Block_V2_Start()) - strMessage = GetOldStrMessage(); - else - strMessage = GetNewStrMessage(); + std::string strMessage = GetStrMessage(); if (!obfuScationSigner.SignMessage(strMessage, errorMessage, sig, keyCollateralAddress)) return error("CMasternodeBroadcast::Sign() - Error: %s", errorMessage); @@ -681,31 +676,20 @@ bool CMasternodeBroadcast::VerifySignature() { std::string errorMessage; - if(!obfuScationSigner.VerifyMessage(pubKeyCollateralAddress, sig, GetNewStrMessage(), errorMessage) - && !obfuScationSigner.VerifyMessage(pubKeyCollateralAddress, sig, GetOldStrMessage(), errorMessage)) + if(!obfuScationSigner.VerifyMessage(pubKeyCollateralAddress, sig, GetStrMessage(), errorMessage)) return error("CMasternodeBroadcast::VerifySignature() - Error: %s", errorMessage); return true; } -std::string CMasternodeBroadcast::GetOldStrMessage() +std::string CMasternodeBroadcast::GetStrMessage() { - std::string strMessage; - - std::string vchPubKey(pubKeyCollateralAddress.begin(), pubKeyCollateralAddress.end()); - std::string vchPubKey2(pubKeyMasternode.begin(), pubKeyMasternode.end()); - strMessage = addr.ToString() + std::to_string(sigTime) + vchPubKey + vchPubKey2 + std::to_string(protocolVersion); - - return strMessage; -} - -std:: string CMasternodeBroadcast::GetNewStrMessage() -{ - std::string strMessage; - - strMessage = addr.ToString() + std::to_string(sigTime) + pubKeyCollateralAddress.GetID().ToString() + pubKeyMasternode.GetID().ToString() + std::to_string(protocolVersion); - - return strMessage; + return (addr.ToString() + + std::to_string(sigTime) + + pubKeyCollateralAddress.GetID().ToString() + + pubKeyMasternode.GetID().ToString() + + std::to_string(protocolVersion) + ); } CMasternodePing::CMasternodePing() diff --git a/src/masternode.h b/src/masternode.h index 3c08a4b0c801c..bfe7118b2f811 100644 --- a/src/masternode.h +++ b/src/masternode.h @@ -303,8 +303,7 @@ class CMasternodeBroadcast : public CMasternode bool Sign(CKey& keyCollateralAddress); bool VerifySignature(); void Relay(); - std::string GetOldStrMessage(); - std::string GetNewStrMessage(); + std::string GetStrMessage(); ADD_SERIALIZE_METHODS;