diff --git a/src/confidential_validation.cpp b/src/confidential_validation.cpp index da17e07a17..2a7f7bb51e 100644 --- a/src/confidential_validation.cpp +++ b/src/confidential_validation.cpp @@ -33,9 +33,12 @@ bool HasValidFee(const CTransaction& tx) { if (fee == 0 || !MoneyRange(fee)) return false; totalFee[tx.vout[i].nAsset.GetAsset()] += fee; + if (!MoneyRange(totalFee)) { + return false; + } } } - return MoneyRange(totalFee); + return true; } CAmountMap GetFeeMap(const CTransaction& tx) { diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp index 54f8fc8fd6..99cff8d9d5 100644 --- a/src/consensus/tx_verify.cpp +++ b/src/consensus/tx_verify.cpp @@ -246,6 +246,9 @@ bool Consensus::CheckTxInputs(const CTransaction& tx, TxValidationState& state, return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-in-ne-out", "value in != value out"); } fee_map += GetFeeMap(tx); + if (!MoneyRange(fee_map)) { + return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-block-total-fee-outofrange"); + } } else { const CAmount value_out = tx.GetValueOutMap()[CAsset()]; if (nValueIn < value_out) {