mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Remove support for legacy operator keys in CPrivateSendBroadcastTx
This commit is contained in:
parent
5f5fcc49cd
commit
fb13b000b5
@ -98,71 +98,28 @@ bool CPrivateSendBroadcastTx::Sign()
|
||||
|
||||
std::string strError = "";
|
||||
|
||||
if (deterministicMNManager->IsDIP3Active()) {
|
||||
uint256 hash = GetSignatureHash();
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
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);
|
||||
|
||||
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;
|
||||
|
@ -306,7 +306,7 @@ public:
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user