Commit b549a372 authored by Benjamin Allred's avatar Benjamin Allred

mend

parent 44666b57
Pipeline #635 failed with stage
in 4 minutes and 5 seconds
......@@ -378,34 +378,29 @@ int64_t CSystemnode::GetLastPaid() const
bool CSystemnode::GetRecentPaymentBlocks(std::vector<const CBlockIndex*>& vPaymentBlocks, bool limitMostRecent) const
{
vPaymentBlocks.clear();
if (chainActive.Tip() == NULL) return false;
const CBlockIndex *BlockReading = chainActive.Tip();
int nBlockLimit = BlockReading->nHeight - PAYMENT_BLOCK_DEPTH;
if (nBlockLimit < 1)
nBlockLimit = 1;
int nMinimumValidBlockHeight = chainActive.Height() - PAYMENT_BLOCK_DEPTH;
if (nMinimumValidBlockHeight < 1)
nMinimumValidBlockHeight = 1;
CBlockIndex* pindex = chainActive[nMinimumValidBlockHeight];
CScript snpayee;
snpayee = GetScriptForDestination(pubkey.GetID());
bool fBlockFound = false;
while (BlockReading && BlockReading->nHeight >= nBlockLimit) {
if(systemnodePayments.mapSystemnodeBlocks.count(BlockReading->nHeight)){
/*
Search for this payee, with at least 2 votes. This will aid in consensus allowing the network
to converge on the same payees quickly, then keep the same schedule.
*/
if(systemnodePayments.mapSystemnodeBlocks[BlockReading->nHeight].HasPayeeWithVotes(snpayee, 2)){
vPaymentBlocks.emplace_back(BlockReading);
fBlockFound = true;
if (limitMostRecent)
return fBlockFound;
}
while (chainActive.Next(pindex)) {
CBlock block;
if (!ReadBlockFromDisk(block, pindex))
continue;
if (block.vtx[0].vout.size() > 2 && block.vtx[0].vout[2].scriptPubKey == snpayee) {
vPaymentBlocks.emplace_back(pindex);
fBlockFound = true;
if (limitMostRecent)
return fBlockFound;
}
if (BlockReading->pprev == NULL) { assert(BlockReading); break; }
BlockReading = BlockReading->pprev;
pindex = chainActive.Next(pindex);
}
return fBlockFound;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment