Node wallet's fee estimation can be off by 2 bytes? #19021

issue monokh opened this issue on May 19, 2020
  1. monokh commented at 10:05 PM on May 19, 2020: none

    I'm writing functional tests that ensure that my code sending transactions using sendtoaddress is sent with the right transaction fee. These tests are failing, even though the calculation checks out.

    Then I had a look at the functional tests and found this: https://github.com/bitcoin/bitcoin/blob/362f9c60a54e673bb3daa8996f86d4bc7547eb13/test/functional/test_framework/util.py#L40

    The node's fee calculation can be off by 2 bytes? What is the reason for this and can it be fixed?

    To reproduce

    Rpc settxfee: 0.00100 (100 sat/b) Send transaction (sendtoaddress) (2segwit inputs, 1 wrapped segwit output - Not an important detail)

    The transaction reports this: Fee: 0.00020680 vSize: 201 calculate sat/b from this and you get ~102

    Expected behavior

    The fee/b as set in settxfee should be used exactly (100)

    Actual behavior

    Effective sat/b fee of ~ 102

    System information

    Bitcoin core 0.18.1

  2. monokh added the label Bug on May 19, 2020
  3. MarcoFalke removed the label Bug on May 19, 2020
  4. MarcoFalke added the label Brainstorming on May 19, 2020
  5. MarcoFalke added the label Wallet on May 19, 2020
  6. achow101 commented at 10:23 PM on May 19, 2020: member

    What is the reason for this

    Coin selection will add dust and otherwise negligible amounts to the fee instead of creating unspendable change outputs.

    can it be fixed?

    No. It is not a bug.

  7. monokh commented at 11:06 PM on May 19, 2020: none

    Coin selection will add dust and otherwise negligible amounts to the fee instead of creating unspendable change outputs.

    Thanks for the explanation. That makes much more sense now. It seemed my wallet had some well split utxos hence was producing the 1 output and no change. Though i did note that the fee calculated was quite divergent in these cases (not really an issue as you suggest)

  8. MarcoFalke commented at 11:19 PM on May 19, 2020: member

    not really an issue as you suggest

    Ok, closing this issue for now

  9. MarcoFalke closed this on May 19, 2020

  10. DrahtBot locked this on Feb 15, 2022

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-21 15:14 UTC

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