Skip to content

Commit

Permalink
Raise coinstake output count limit to 8
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbrod committed Aug 12, 2018
1 parent 63f7ef5 commit 7f6dca8
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3182,20 +3182,21 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck, boo
pindex->nHeight,CoinToDouble(nTotalCoinstake),CoinToDouble(nTxValueOut));
}

// Verify no recipients exist after coinstake (Recipients start at output position 3 (0=Coinstake flag, 1=coinstake amount, 2=splitstake amount)
if (bIsDPOR && pindex->nHeight > nGrandfather)
if (pindex->nVersion >= 10)
{
if (tx.vout.size() > 8)
return DoS(100,error("Too many coinstake outputs"));
}
else if (bIsDPOR && pindex->nHeight > nGrandfather && pindex->nVersion < 10)
{
// Old rules, does not make sense
// Verify no recipients exist after coinstake (Recipients start at output position 3 (0=Coinstake flag, 1=coinstake amount, 2=splitstake amount)
for (unsigned int i = 3; i < tx.vout.size(); i++)
{
std::string Recipient = PubKeyToAddress(tx.vout[i].scriptPubKey);
double Amount = CoinToDouble(tx.vout[i].nValue);
if (fDebug10) LogPrintf("Iterating Recipient #%d %s with Amount %f", i, Recipient, Amount);
if (Amount > 0)
{
if (fDebug3) LogPrintf("Iterating Recipient #%d %s with Amount %f", i, Recipient, Amount);
LogPrintf("POR Payment results in an overpayment; Recipient %s, Amount %f ",Recipient, Amount);
return DoS(50,error("POR Payment results in an overpayment; Recipient %s, Amount %f ",
Recipient.c_str(), Amount));
return DoS(50,error("Coinstake output %u forbidden", i));
}
}
}
Expand Down

0 comments on commit 7f6dca8

Please sign in to comment.