diff --git a/ouroboros-consensus-cardano/changelog.d/20250107_124744_alexander.esgen_shelley_mempool_txsize_check.md b/ouroboros-consensus-cardano/changelog.d/20250107_124744_alexander.esgen_shelley_mempool_txsize_check.md new file mode 100644 index 0000000000..ecbfd60025 --- /dev/null +++ b/ouroboros-consensus-cardano/changelog.d/20250107_124744_alexander.esgen_shelley_mempool_txsize_check.md @@ -0,0 +1,4 @@ +### Patch + +- Fixed a bug where a valid tx with less than `4` bytes less than the max tx + size would be incorrectly rejected by the mempool. diff --git a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs index ad6f439ad0..b7ed4a3040 100644 --- a/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs +++ b/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs @@ -328,9 +328,9 @@ txInBlockSize :: txInBlockSize st (ShelleyTx _txid tx') = validateMaybe (maxTxSizeUTxO txsz limit) $ do guard $ txsz <= limit - Just $ IgnoringOverflow $ ByteSize32 $ fromIntegral txsz + Just $ IgnoringOverflow $ ByteSize32 $ fromIntegral txsz + perTxOverhead where - txsz = perTxOverhead + (tx' ^. sizeTxF) + txsz = tx' ^. sizeTxF pparams = getPParams $ tickedShelleyLedgerState st limit = fromIntegral (pparams ^. L.ppMaxTxSizeL) :: Integer