Fee(rate) mismatch between min relay and fee filter #16499

issue instagibbs opened this issue on July 30, 2019
  1. instagibbs commented at 8:16 PM on July 30, 2019: member

    I was messing around with min relay policies and found that under certain circumstances the mempool will accept things, then not relay to any peers.

    Example made using wallet: Transaction of size 6195, fee of 619 satoshis, minrelay of 100 satoshis per kvB. Mempool logic allows it:

            // No transactions are allowed below minRelayTxFee except from disconnected blocks
            if (!bypass_limits && nModifiedFees < ::minRelayTxFee.GetFee(nSize)) {
                return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "min relay fee not met", false, strprintf("%d < %d", nModifiedFees, ::minRelayTxFee.GetFee(nSize)));
            }
    

    and lets it into mempool

    but in net_processing.cpp:

                        if (filterrate && txinfo.feeRate.GetFeePerK() < filterrate) {
                            continue;
                        }
    

    this gets hit because the computed feerate is insufficient(printing I added):

    0.00000099 BTC/kB
    

    I'm not super at arithmetic so I'm opening this up in case someone has an easy fix.

    let me also get a reproducible test failure with this...

  2. instagibbs commented at 8:34 PM on July 30, 2019: member
  3. fanquake added the label TX fees and policy on Jul 30, 2019
  4. instagibbs commented at 9:00 PM on July 30, 2019: member

    Ok it's pretty straight-forward:

    Whenever you have a feerate in satoshis per kvB that's not divisible by 1000 exactly, GetFee may undershoot its intended results when it's checked for fee filter. See:

    https://github.com/instagibbs/bitcoin/commit/c480e4ddbf611dd0d9de9aa39317de15381625b8

    Applying this fix means that previously-accepted things into mempool are no longer accepted, but these transactions won't propagate anyways, so I think it's fairly conservative.

  5. fanquake closed this on Oct 4, 2019

  6. sidhujag referenced this in commit ec1754ad1a on Oct 4, 2019
  7. MarcoFalke locked this on Dec 16, 2021
  8. knst referenced this in commit 5b63e6c384 on Mar 24, 2023
  9. knst referenced this in commit 9becea04ad on Apr 9, 2023
  10. knst referenced this in commit 47a1b956d5 on Apr 10, 2023
  11. knst referenced this in commit 3d0fc732ef on Apr 10, 2023
  12. knst referenced this in commit 03e1ed1576 on Apr 15, 2023
  13. PastaPastaPasta referenced this in commit c2df9366f0 on Apr 17, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 09:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me