From: alex Date: Sat, 15 Jun 2013 15:19:52 +0000 (+0400) Subject: Remove MINOUT checkings for coinbase transactions since 20 Sep 2013 X-Git-Tag: v0.4.3-pre~6 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=032e6d33debcf5a9924f9c8ff7cdecc2c30b3519 Remove MINOUT checkings for coinbase transactions since 20 Sep 2013 --- diff --git a/src/main.cpp b/src/main.cpp index b7b20bc..bf7367d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -476,8 +476,10 @@ bool CTransaction::CheckTransaction() const if (txout.IsEmpty() && !IsCoinBase() && !IsCoinStake()) return DoS(100, error("CTransaction::CheckTransaction() : txout empty for user transaction")); - // ppcoin: enforce minimum output amount - if ((!txout.IsEmpty()) && txout.nValue < MIN_TXOUT_AMOUNT) + // NovaCoin: enforce minimum output amount for user transactions + // (and for all transactions until 20 Sep 2013) + if ((!IsCoinBase() || nTime < CHAINCHECKS_SWITCH_TIME) + && (!txout.IsEmpty()) && txout.nValue < MIN_TXOUT_AMOUNT) return DoS(100, error("CTransaction::CheckTransaction() : txout.nValue below minimum")); if (txout.nValue > MAX_MONEY) @@ -499,7 +501,7 @@ bool CTransaction::CheckTransaction() const if (IsCoinBase()) { if (vin[0].scriptSig.size() < 2 || vin[0].scriptSig.size() > 100) - return DoS(100, error("CTransaction::CheckTransaction() : coinbase script size")); + return DoS(100, error("CTransaction::CheckTransaction() : coinbase script size is invalid")); } else { @@ -982,6 +984,7 @@ int64 GetProofOfWorkReward(unsigned int nBits) } int64 nSubsidy = bnUpperBound.getuint64(); + nSubsidy = (nSubsidy / CENT) * CENT; if (fDebug && GetBoolArg("-printcreation")) printf("GetProofOfWorkReward() : create=%s nBits=0x%08x nSubsidy=%"PRI64d"\n", FormatMoney(nSubsidy).c_str(), nBits, nSubsidy); @@ -2111,11 +2114,14 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot) const } else { + // Coinbase fee paid until 20 Sep 2013 + int64 nFee = GetBlockTime() < CHAINCHECKS_SWITCH_TIME ? vtx[0].GetMinFee() - MIN_TX_FEE : 0; + // Check coinbase reward - if (vtx[0].GetValueOut() > (GetProofOfWorkReward(nBits) - vtx[0].GetMinFee() + MIN_TX_FEE)) + if (vtx[0].GetValueOut() > (GetProofOfWorkReward(nBits) - nFee)) return DoS(50, error("CheckBlock() : coinbase reward exceeded %s > %s", FormatMoney(vtx[0].GetValueOut()).c_str(), - FormatMoney(IsProofOfWork()? GetProofOfWorkReward(nBits) : 0).c_str())); + FormatMoney(GetProofOfWorkReward(nBits) - nFee).c_str())); } // Check transactions