From 7f6dca82190bb576668a86c4735686cce8ee89ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Brada?= Date: Sun, 12 Aug 2018 19:14:35 +0200 Subject: [PATCH] Raise coinstake output count limit to 8 --- src/main.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1335bd64e3..45fe4efe51 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -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)); } } }