Unify uses of MAX_FREE_TRANSACTION_CREATE_SIZE #5693

issue wtogami opened this issue on January 23, 2015
  1. wtogami commented at 4:00 AM on January 23, 2015: contributor

    https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L896

    CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree)
    {
    ...
        CAmount nMinFee = ::minRelayTxFee.GetFee(nBytes);
    
        if (fAllowFree)
        {
            // There is a free transaction area in blocks created by most miners,
            // * If we are relaying we allow transactions up to DEFAULT_BLOCK_PRIORITY_SIZE - 1000
            //   to be considered to fall into this category. We don't want to encourage sending
            //   multiple transactions instead of one big transaction to avoid fees.
            if (nBytes < (DEFAULT_BLOCK_PRIORITY_SIZE - 1000))
                nMinFee = 0;
        }
    

    That 1000 is a magic number, previously 10000 in versions prior to 0.8.6.

    https://github.com/bitcoin/bitcoin/blob/master/src/wallet.h#L48

    //! Largest (in bytes) free transaction we're willing to create
    static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000;
    

    It has been equal to what is now defined as MAX_FREE_TRANSACTION_CREATE_SIZE for the creation of wallet transactions, but this constant can't be used directly by main.cpp because it isn't reliant on the wallet.

    Should we unify it so isn't it is no longer an unexplained magic number or should we just eliminate the magic?

  2. wtogami commented at 12:33 AM on January 27, 2015: contributor
    <wumpus> [13:41:10] warren: +1 for creating a constant for the magic number, although I don't think it should be unified with the wallet constant
    <wumpus> [14:04:53] warren: It makes sense to be able to set it for the wallet and network separately
    <wumpus> [14:29:32] warren: you remove the negative magic so you get moar magic
    

    OK ... I don't care enough to define another constant that isn't unified. Closing.

  3. wtogami closed this on Jan 27, 2015

  4. MarcoFalke locked this on Sep 8, 2021
Contributors

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-05-02 15:15 UTC

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