mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
prevent gaming sigTime too much on initial dsee
This commit is contained in:
parent
b2017ebefa
commit
f4f3f6bd6a
@ -481,6 +481,24 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// verify that sig time is legit in past
|
||||||
|
// should be at least not earlier than block when 1000 DRK tx got MASTERNODE_MIN_CONFIRMATIONS
|
||||||
|
uint256 hashBlock = 0;
|
||||||
|
GetTransaction(vin.prevout.hash, tx, hashBlock, true);
|
||||||
|
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
|
||||||
|
if (mi != mapBlockIndex.end() && (*mi).second)
|
||||||
|
{
|
||||||
|
CBlockIndex* pMNIndex = (*mi).second; // block for 1000 DRK tx -> 1 confirmation
|
||||||
|
CBlockIndex* pConfIndex = chainActive[pMNIndex->nHeight + MASTERNODE_MIN_CONFIRMATIONS - 1]; // block where tx got MASTERNODE_MIN_CONFIRMATIONS
|
||||||
|
if(pConfIndex->GetBlockTime() > sigTime)
|
||||||
|
{
|
||||||
|
LogPrintf("dsee - Bad sigTime %d for masternode %20s %105s (%i conf block is at %d)\n",
|
||||||
|
sigTime, addr.ToString(), vin.ToString(), MASTERNODE_MIN_CONFIRMATIONS, pConfIndex->GetBlockTime());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// use this as a peer
|
// use this as a peer
|
||||||
addrman.Add(CAddress(addr), pfrom->addr, 2*60*60);
|
addrman.Add(CAddress(addr), pfrom->addr, 2*60*60);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user