Validate -ac_minopreturnfee as a consensus rule
This commit is contained in:
25
src/main.cpp
25
src/main.cpp
@@ -2678,6 +2678,31 @@ namespace Consensus {
|
|||||||
if (!MoneyRange(nFees))
|
if (!MoneyRange(nFees))
|
||||||
return state.DoS(100, error("CheckInputs(): nFees out of range"),
|
return state.DoS(100, error("CheckInputs(): nFees out of range"),
|
||||||
REJECT_INVALID, "bad-txns-fee-outofrange");
|
REJECT_INVALID, "bad-txns-fee-outofrange");
|
||||||
|
|
||||||
|
//NOTE: Since we have access to fee here, verify that opreturn pays
|
||||||
|
//required minimum fee, even though this is a check on outputs not
|
||||||
|
//inputs. If we don't do it here we would need to duplicate already
|
||||||
|
//done work somewhere else
|
||||||
|
|
||||||
|
if ( ASSETCHAINS_MINOPRETURNFEE > 0 ) {
|
||||||
|
BOOST_FOREACH(const CTxOut& txout, tx.vout) {
|
||||||
|
const bool isopret = txout.scriptPubKey.IsOpReturn();
|
||||||
|
|
||||||
|
// HUSH+DRGX do not use -ac_minopreturnfee so this does not (yet)
|
||||||
|
// affect those chains, they will need a height activated consensus
|
||||||
|
// change
|
||||||
|
|
||||||
|
if ( isopret ) {
|
||||||
|
// Is there any difference between nTxFee and nFees ?
|
||||||
|
// They seem to be 2 vars with the same value
|
||||||
|
fprintf(stderr,"%s: opreturn=1 nFees=%ld nTxFee=%ld\n", __func__, nFees, nTxFee);
|
||||||
|
if (nTxFee < ASSETCHAINS_MINOPRETURNFEE) {
|
||||||
|
return state.DoS(100,error("CheckInputs(): tx does not have required mininum fee for OP_RETURN"), REJECT_INVALID, "bad-txns-minopreturnfee");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}// namespace Consensus
|
}// namespace Consensus
|
||||||
|
|||||||
Reference in New Issue
Block a user