Skip to content

Commit 5f5fcc4

Browse files
committed
Remove legacy signatures support in CPrivateSendQueue
1 parent da92451 commit 5f5fcc4

File tree

2 files changed

+13
-62
lines changed

2 files changed

+13
-62
lines changed

src/privatesend.cpp

+12-61
Original file line numberDiff line numberDiff line change
@@ -52,75 +52,26 @@ bool CPrivateSendQueue::Sign()
5252

5353
std::string strError = "";
5454

55-
if (deterministicMNManager->IsDIP3Active()) {
56-
uint256 hash = GetSignatureHash();
57-
CBLSSignature sig = activeMasternodeInfo.blsKeyOperator->Sign(hash);
58-
if (!sig.IsValid()) {
59-
return false;
60-
}
61-
sig.GetBuf(vchSig);
62-
} else if (sporkManager.IsSporkActive(SPORK_6_NEW_SIGS)) {
63-
uint256 hash = GetSignatureHash();
64-
65-
if (!CHashSigner::SignHash(hash, activeMasternodeInfo.legacyKeyOperator, vchSig)) {
66-
LogPrintf("CPrivateSendQueue::Sign -- SignHash() failed\n");
67-
return false;
68-
}
69-
70-
if (!CHashSigner::VerifyHash(hash, activeMasternodeInfo.legacyKeyIDOperator, vchSig, strError)) {
71-
LogPrintf("CPrivateSendQueue::Sign -- VerifyHash() failed, error: %s\n", strError);
72-
return false;
73-
}
74-
} else {
75-
std::string strMessage = CTxIn(masternodeOutpoint).ToString() +
76-
std::to_string(nDenom) +
77-
std::to_string(nTime) +
78-
std::to_string(fReady);
79-
80-
if (!CMessageSigner::SignMessage(strMessage, vchSig, activeMasternodeInfo.legacyKeyOperator)) {
81-
LogPrintf("CPrivateSendQueue::Sign -- SignMessage() failed, %s\n", ToString());
82-
return false;
83-
}
84-
85-
if (!CMessageSigner::VerifyMessage(activeMasternodeInfo.legacyKeyIDOperator, vchSig, strMessage, strError)) {
86-
LogPrintf("CPrivateSendQueue::Sign -- VerifyMessage() failed, error: %s\n", strError);
87-
return false;
88-
}
55+
uint256 hash = GetSignatureHash();
56+
CBLSSignature sig = activeMasternodeInfo.blsKeyOperator->Sign(hash);
57+
if (!sig.IsValid()) {
58+
return false;
8959
}
60+
sig.GetBuf(vchSig);
9061

9162
return true;
9263
}
9364

94-
bool CPrivateSendQueue::CheckSignature(const CKeyID& keyIDOperator, const CBLSPublicKey& blsPubKey) const
65+
bool CPrivateSendQueue::CheckSignature(const CBLSPublicKey& blsPubKey) const
9566
{
9667
std::string strError = "";
97-
if (deterministicMNManager->IsDIP3Active()) {
98-
uint256 hash = GetSignatureHash();
68+
uint256 hash = GetSignatureHash();
9969

100-
CBLSSignature sig;
101-
sig.SetBuf(vchSig);
102-
if (!sig.IsValid() || !sig.VerifyInsecure(blsPubKey, hash)) {
103-
LogPrintf("CTxLockVote::CheckSignature -- VerifyInsecure() failed\n");
104-
return false;
105-
}
106-
} else if (sporkManager.IsSporkActive(SPORK_6_NEW_SIGS)) {
107-
uint256 hash = GetSignatureHash();
108-
109-
if (!CHashSigner::VerifyHash(hash, keyIDOperator, vchSig, strError)) {
110-
// we don't care about queues with old signature format
111-
LogPrintf("CPrivateSendQueue::CheckSignature -- VerifyHash() failed, error: %s\n", strError);
112-
return false;
113-
}
114-
} else {
115-
std::string strMessage = CTxIn(masternodeOutpoint).ToString() +
116-
std::to_string(nDenom) +
117-
std::to_string(nTime) +
118-
std::to_string(fReady);
119-
120-
if (!CMessageSigner::VerifyMessage(keyIDOperator, vchSig, strMessage, strError)) {
121-
LogPrintf("CPrivateSendQueue::CheckSignature -- Got bad Masternode queue signature: %s; error: %s\n", ToString(), strError);
122-
return false;
123-
}
70+
CBLSSignature sig;
71+
sig.SetBuf(vchSig);
72+
if (!sig.IsValid() || !sig.VerifyInsecure(blsPubKey, hash)) {
73+
LogPrintf("CTxLockVote::CheckSignature -- VerifyInsecure() failed\n");
74+
return false;
12475
}
12576

12677
return true;

src/privatesend.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class CPrivateSendQueue
225225
*/
226226
bool Sign();
227227
/// Check if we have a valid Masternode address
228-
bool CheckSignature(const CKeyID& keyIDOperator, const CBLSPublicKey& blsPubKey) const;
228+
bool CheckSignature(const CBLSPublicKey& blsPubKey) const;
229229

230230
bool Relay(CConnman& connman);
231231

0 commit comments

Comments
 (0)