mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +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 = "";
|
std::string strError = "";
|
||||||
|
|
||||||
if (deterministicMNManager->IsDIP3Active()) {
|
uint256 hash = GetSignatureHash();
|
||||||
uint256 hash = GetSignatureHash();
|
|
||||||
|
|
||||||
CBLSSignature sig = activeMasternodeInfo.blsKeyOperator->Sign(hash);
|
CBLSSignature sig = activeMasternodeInfo.blsKeyOperator->Sign(hash);
|
||||||
if (!sig.IsValid()) {
|
if (!sig.IsValid()) {
|
||||||
return false;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
sig.GetBuf(vchSig);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPrivateSendBroadcastTx::CheckSignature(const CKeyID& keyIDOperator, const CBLSPublicKey& blsPubKey) const
|
bool CPrivateSendBroadcastTx::CheckSignature(const CBLSPublicKey& blsPubKey) const
|
||||||
{
|
{
|
||||||
std::string strError = "";
|
std::string strError = "";
|
||||||
|
|
||||||
if (deterministicMNManager->IsDIP3Active()) {
|
uint256 hash = GetSignatureHash();
|
||||||
uint256 hash = GetSignatureHash();
|
|
||||||
|
|
||||||
CBLSSignature sig;
|
CBLSSignature sig;
|
||||||
sig.SetBuf(vchSig);
|
sig.SetBuf(vchSig);
|
||||||
if (!sig.IsValid() || !sig.VerifyInsecure(blsPubKey, hash)) {
|
if (!sig.IsValid() || !sig.VerifyInsecure(blsPubKey, hash)) {
|
||||||
LogPrintf("CTxLockVote::CheckSignature -- VerifyInsecure() failed\n");
|
LogPrintf("CTxLockVote::CheckSignature -- VerifyInsecure() failed\n");
|
||||||
return false;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -306,7 +306,7 @@ public:
|
|||||||
uint256 GetSignatureHash() const;
|
uint256 GetSignatureHash() const;
|
||||||
|
|
||||||
bool Sign();
|
bool Sign();
|
||||||
bool CheckSignature(const CKeyID& keyIDOperator, const CBLSPublicKey& blsPubKey) const;
|
bool CheckSignature(const CBLSPublicKey& blsPubKey) const;
|
||||||
|
|
||||||
void SetConfirmedHeight(int nConfirmedHeightIn) { nConfirmedHeight = nConfirmedHeightIn; }
|
void SetConfirmedHeight(int nConfirmedHeightIn) { nConfirmedHeight = nConfirmedHeightIn; }
|
||||||
bool IsExpired(int nHeight);
|
bool IsExpired(int nHeight);
|
||||||
|
Loading…
Reference in New Issue
Block a user