diff --git a/zebra-chain/src/transaction/unmined.rs b/zebra-chain/src/transaction/unmined.rs index cfdb6962423..9c081018c97 100644 --- a/zebra-chain/src/transaction/unmined.rs +++ b/zebra-chain/src/transaction/unmined.rs @@ -357,12 +357,7 @@ impl VerifiedUnminedTx { let fee_weight_ratio = zip317::conventional_fee_weight_ratio(&transaction, miner_fee); let unpaid_actions = zip317::unpaid_actions(&transaction, miner_fee); - zip317::mempool_checks( - unpaid_actions, - miner_fee, - transaction.conventional_fee, - transaction.size, - )?; + zip317::mempool_checks(unpaid_actions, miner_fee, transaction.size)?; Ok(Self { transaction, diff --git a/zebra-chain/src/transaction/unmined/zip317.rs b/zebra-chain/src/transaction/unmined/zip317.rs index 9923991764b..44ef709aacd 100644 --- a/zebra-chain/src/transaction/unmined/zip317.rs +++ b/zebra-chain/src/transaction/unmined/zip317.rs @@ -169,7 +169,6 @@ fn conventional_actions(transaction: &Transaction) -> u32 { pub fn mempool_checks( unpaid_actions: u32, miner_fee: Amount, - conventional_fee: Amount, transaction_size: usize, ) -> Result<(), Error> { // # Standard Rule @@ -189,18 +188,17 @@ pub fn mempool_checks( // > conventional fee as specified in this ZIP. // // - if miner_fee < conventional_fee { - return Err(Error::FeeBelowConventional); - } - - // # Standard rule // - // > Minimum Fee Rate - // > - // > Transactions must pay a fee of at least 100 zatoshis per 1000 bytes of serialized size, - // > with a maximum fee of 1000 zatoshis. In zcashd this is `DEFAULT_MIN_RELAY_TX_FEE`. + // In Zebra, we use a similar minimum fee rate to `zcashd` v5.5.0 and later. + // Transactions must pay a fee of at least 100 zatoshis per 1000 bytes of serialized size, + // with a maximum fee of 1000 zatoshis. + // + // // - // + // In zcashd this is `DEFAULT_MIN_RELAY_TX_FEE` and `LEGACY_DEFAULT_FEE`: + // + // + const KILOBYTE: usize = 1000; // This calculation can't overflow, because transactions are limited to 2 MB, @@ -232,9 +230,6 @@ pub enum Error { #[error("Unpaid actions is higher than the limit")] UnpaidActions, - #[error("Transaction fee is below the conventional fee for the transaction")] - FeeBelowConventional, - #[error("Transaction fee is below the minimum fee rate")] FeeBelowMinimumRate, } diff --git a/zebra-chain/src/transaction/unmined/zip317/tests.rs b/zebra-chain/src/transaction/unmined/zip317/tests.rs index a3ed8b62067..fb708a73c0b 100644 --- a/zebra-chain/src/transaction/unmined/zip317/tests.rs +++ b/zebra-chain/src/transaction/unmined/zip317/tests.rs @@ -3,38 +3,15 @@ use super::{mempool_checks, Amount, Error}; #[test] fn zip317_unpaid_actions_err() { - let check = mempool_checks( - 51, - Amount::try_from(1).unwrap(), - Amount::try_from(10000).unwrap(), - 1, - ); + let check = mempool_checks(51, Amount::try_from(1).unwrap(), 1); assert!(check.is_err()); assert_eq!(check.err(), Some(Error::UnpaidActions)); } -#[test] -fn zip317_convetional_fee_err() { - let check = mempool_checks( - 50, - Amount::try_from(1).unwrap(), - Amount::try_from(10000).unwrap(), - 1, - ); - - assert!(check.is_err()); - assert_eq!(check.err(), Some(Error::FeeBelowConventional)); -} - #[test] fn zip317_minimum_rate_fee_err() { - let check = mempool_checks( - 50, - Amount::try_from(1).unwrap(), - Amount::try_from(1).unwrap(), - 1000, - ); + let check = mempool_checks(50, Amount::try_from(1).unwrap(), 1000); assert!(check.is_err()); assert_eq!(check.err(), Some(Error::FeeBelowMinimumRate)); diff --git a/zebra-consensus/src/transaction/tests.rs b/zebra-consensus/src/transaction/tests.rs index 74db70504c6..9f9fd6fbfd5 100644 --- a/zebra-consensus/src/transaction/tests.rs +++ b/zebra-consensus/src/transaction/tests.rs @@ -2886,9 +2886,7 @@ async fn mempool_zip317_error() { assert!(verifier_response.is_err()); assert_eq!( verifier_response.err(), - Some(TransactionError::Zip317( - zip317::Error::FeeBelowConventional - )) + Some(TransactionError::Zip317(zip317::Error::FeeBelowMinimumRate)) ); }