Skip to content

Commit

Permalink
Sapling transaction fixed fee check.
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Oct 24, 2020
1 parent 3dbd319 commit cda336e
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,21 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
}
}

if (fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000)
return state.Invalid(false,
REJECT_HIGHFEE, "absurdly-high-fee",
strprintf("%d > %d", nFees, ::minRelayTxFee.GetFee(nSize) * 10000));
if (!tx.hasSaplingData()) { // Sapling fee could be higher. Review it properly
if (fRejectAbsurdFee && nFees > ::minRelayTxFee.GetFee(nSize) * 10000) {
return state.Invalid(false,
REJECT_HIGHFEE, "absurdly-high-fee",
strprintf("%d > %d", nFees, ::minRelayTxFee.GetFee(nSize) * 10000));
}
} else {
// Accept a tx if it contains sapling and has at least the default fee specified (1 PIV).
// todo: this is a initial step, we can be more accurate with the fee calculation and use the regular fee flow.
if (nFees < COIN) {
return state.Invalid(false,
REJECT_HIGHFEE, "sapling-invalid-fee",
strprintf("sapling fee: %d < %d", nFees, COIN));
}
}

// As zero fee transactions are not going to be accepted in the near future (4.0) and the code will be fully refactored soon.
// This is just a quick inline towards that goal, the mempool by default will not accept them. Blocking
Expand Down

0 comments on commit cda336e

Please sign in to comment.