mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Directly use deterministicMNManager when processing DSTX
This commit is contained in:
parent
ae229e2833
commit
b49ef5d712
@ -127,6 +127,16 @@ void CMasternodeMan::AskForMN(CNode* pnode, const COutPoint& outpoint, CConnman&
|
||||
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSEG, outpoint));
|
||||
}
|
||||
|
||||
bool CMasternodeMan::IsValidForMixingTxes(const COutPoint& outpoint)
|
||||
{
|
||||
LOCK(cs);
|
||||
CMasternode* pmn = Find(outpoint);
|
||||
if (!pmn) {
|
||||
return false;
|
||||
}
|
||||
return pmn->IsValidForMixingTxes();
|
||||
}
|
||||
|
||||
bool CMasternodeMan::AllowMixing(const COutPoint &outpoint)
|
||||
{
|
||||
LOCK(cs);
|
||||
|
@ -137,6 +137,7 @@ public:
|
||||
void AskForMN(CNode *pnode, const COutPoint& outpoint, CConnman& connman);
|
||||
|
||||
bool PoSeBan(const COutPoint &outpoint);
|
||||
bool IsValidForMixingTxes(const COutPoint &outpoint);
|
||||
bool AllowMixing(const COutPoint &outpoint);
|
||||
bool DisallowMixing(const COutPoint &outpoint);
|
||||
|
||||
|
@ -2079,21 +2079,20 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
return true; // not an error
|
||||
}
|
||||
|
||||
CMasternode mn;
|
||||
|
||||
if(!mnodeman.Get(dstx.masternodeOutpoint, mn)) {
|
||||
auto dmn = deterministicMNManager->GetListAtChainTip().GetValidMNByCollateral(dstx.masternodeOutpoint);
|
||||
if(!dmn) {
|
||||
LogPrint("privatesend", "DSTX -- Can't find masternode %s to verify %s\n", dstx.masternodeOutpoint.ToStringShort(), hashTx.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!mn.IsValidForMixingTxes()) {
|
||||
if(!mnodeman.IsValidForMixingTxes(dstx.masternodeOutpoint)) {
|
||||
LogPrint("privatesend", "DSTX -- Masternode %s is sending too many transactions %s\n", dstx.masternodeOutpoint.ToStringShort(), hashTx.ToString());
|
||||
return true;
|
||||
// TODO: Not an error? Could it be that someone is relaying old DSTXes
|
||||
// we have no idea about (e.g we were offline)? How to handle them?
|
||||
}
|
||||
|
||||
if (!dstx.CheckSignature(mn.legacyKeyIDOperator, mn.blsPubKeyOperator)) {
|
||||
if (!dstx.CheckSignature(dmn->pdmnState->pubKeyOperator)) {
|
||||
LogPrint("privatesend", "DSTX -- CheckSignature() failed for %s\n", hashTx.ToString());
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user