diff --git a/src/privatesend.cpp b/src/privatesend.cpp index b821533a22b28..2f7e6f12224ca 100644 --- a/src/privatesend.cpp +++ b/src/privatesend.cpp @@ -98,71 +98,28 @@ bool CPrivateSendBroadcastTx::Sign() std::string strError = ""; - if (deterministicMNManager->IsDIP3Active()) { - uint256 hash = GetSignatureHash(); - - CBLSSignature sig = activeMasternodeInfo.blsKeyOperator->Sign(hash); - if (!sig.IsValid()) { - return false; - } - sig.GetBuf(vchSig); - } else if (sporkManager.IsSporkActive(SPORK_6_NEW_SIGS)) { - uint256 hash = GetSignatureHash(); - - if (!CHashSigner::SignHash(hash, activeMasternodeInfo.legacyKeyOperator, vchSig)) { - LogPrintf("CPrivateSendBroadcastTx::Sign -- SignHash() failed\n"); - return false; - } - - if (!CHashSigner::VerifyHash(hash, activeMasternodeInfo.legacyKeyIDOperator, vchSig, strError)) { - LogPrintf("CPrivateSendBroadcastTx::Sign -- VerifyHash() failed, error: %s\n", strError); - return false; - } - } else { - std::string strMessage = tx->GetHash().ToString() + std::to_string(sigTime); - - if (!CMessageSigner::SignMessage(strMessage, vchSig, activeMasternodeInfo.legacyKeyOperator)) { - LogPrintf("CPrivateSendBroadcastTx::Sign -- SignMessage() failed\n"); - return false; - } + uint256 hash = GetSignatureHash(); - if (!CMessageSigner::VerifyMessage(activeMasternodeInfo.legacyKeyIDOperator, vchSig, strMessage, strError)) { - LogPrintf("CPrivateSendBroadcastTx::Sign -- VerifyMessage() failed, error: %s\n", strError); - return false; - } + CBLSSignature sig = activeMasternodeInfo.blsKeyOperator->Sign(hash); + if (!sig.IsValid()) { + return false; } + sig.GetBuf(vchSig); return true; } -bool CPrivateSendBroadcastTx::CheckSignature(const CKeyID& keyIDOperator, const CBLSPublicKey& blsPubKey) const +bool CPrivateSendBroadcastTx::CheckSignature(const CBLSPublicKey& blsPubKey) const { std::string strError = ""; - if (deterministicMNManager->IsDIP3Active()) { - uint256 hash = GetSignatureHash(); - - CBLSSignature sig; - sig.SetBuf(vchSig); - if (!sig.IsValid() || !sig.VerifyInsecure(blsPubKey, hash)) { - LogPrintf("CTxLockVote::CheckSignature -- VerifyInsecure() failed\n"); - return false; - } - } else if (sporkManager.IsSporkActive(SPORK_6_NEW_SIGS)) { - uint256 hash = GetSignatureHash(); - - if (!CHashSigner::VerifyHash(hash, keyIDOperator, vchSig, strError)) { - // we don't care about dstxes with old signature format - LogPrintf("CPrivateSendBroadcastTx::CheckSignature -- VerifyHash() failed, error: %s\n", strError); - return false; - } - } else { - std::string strMessage = tx->GetHash().ToString() + std::to_string(sigTime); + uint256 hash = GetSignatureHash(); - if (!CMessageSigner::VerifyMessage(keyIDOperator, vchSig, strMessage, strError)) { - LogPrintf("CPrivateSendBroadcastTx::CheckSignature -- Got bad dstx signature, error: %s\n", strError); - return false; - } + CBLSSignature sig; + sig.SetBuf(vchSig); + if (!sig.IsValid() || !sig.VerifyInsecure(blsPubKey, hash)) { + LogPrintf("CTxLockVote::CheckSignature -- VerifyInsecure() failed\n"); + return false; } return true; diff --git a/src/privatesend.h b/src/privatesend.h index a88171444ccc3..f8e85097e36e3 100644 --- a/src/privatesend.h +++ b/src/privatesend.h @@ -306,7 +306,7 @@ class CPrivateSendBroadcastTx uint256 GetSignatureHash() const; bool Sign(); - bool CheckSignature(const CKeyID& keyIDOperator, const CBLSPublicKey& blsPubKey) const; + bool CheckSignature(const CBLSPublicKey& blsPubKey) const; void SetConfirmedHeight(int nConfirmedHeightIn) { nConfirmedHeight = nConfirmedHeightIn; } bool IsExpired(int nHeight);