subtractfeefromamount=true fails with insufficient funds #25129

issue MarcoFalke openend this issue on May 13, 2022
  1. MarcoFalke commented at 2:54 pm on May 13, 2022: member

    Was: #25030

    Steps to reproduce:

    0wget https://github.com/bitcoin/bitcoin/files/8688722/datadir_node0.tar.gz
    1tar -xvf datadir_node0.tar.gz
    2export DD='-datadir=./node0/'
    3bitcoin-qt $DD &
    4bitcoin-cli $DD loadwallet rpc_online
    5bitcoin-cli $DD -named sendtoaddress address=bcrt1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3xueyj amount=1966.66779818 subtractfeefromamount=true
    
  2. MarcoFalke added the label Bug on May 13, 2022
  3. MarcoFalke added the label Wallet on May 13, 2022
  4. MarcoFalke commented at 1:23 pm on May 16, 2022: member

    Maybe this should be replaced by sendall in the tests, but I am wondering if the bug should be fixed or ignored.

    cc @Xekyo @achow101 https://github.com/bitcoin/bitcoin/pull/24118

  5. achow101 commented at 2:16 pm on May 16, 2022: member
    The bug would probably be fixed by #23534, however I think changing to use sendall is the more correct fix.
  6. Xekyo commented at 6:04 pm on May 16, 2022: member
    Looking at how the test works, and seeing that it creates transactions sending random recipient amounts up to the full balance, it seems likely that it occasionally creates some tiny UTXOs that are skipped during AvailableCoins(…) due to having a negative effective value. Since line 448 where this error occurs is trying to empty the wallet, using sendall seems like the appropriate fix. IIRC, we also allow creating a PSBT with sendall, so it would work for both 444 and 448. Might be an “Easy first issue”?
  7. MarcoFalke added the label good first issue on May 17, 2022
  8. MarcoFalke commented at 6:38 am on May 17, 2022: member

    yeah, changing the test is a gfi

    Useful skills:

    • Bitcoin Core functional test framework and RPC methods

    Want to work on this issue?

    For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.

  9. ishaanam referenced this in commit 5bb384638e on May 17, 2022
  10. ishaanam referenced this in commit c6122f560b on May 17, 2022
  11. achow101 closed this on May 17, 2022

  12. achow101 referenced this in commit f7a1e676d5 on May 17, 2022
  13. naumenkogs referenced this in commit 59f6c138bc on May 23, 2022
  14. sidhujag referenced this in commit 40c71c94cd on May 28, 2022
  15. ekkis commented at 5:24 pm on June 30, 2022: none
    I have this issue in trying to use bitcoin-cli but there is no sendall command. suggestions?
  16. achow101 commented at 6:00 pm on June 30, 2022: member

    sendall will be available in the next major release. You can build the master branch from source if you need it now.

    Otherwise you can achieve the same thing by manually choosing all of the utxos in your wallet. listunspent will provide you the utxos and you can use them with send or the raw transaction or psbt workflows.

  17. ekkis commented at 6:03 pm on June 30, 2022: none
    wonderful. thank you
  18. DrahtBot locked this on Jun 30, 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: 2024-12-22 12:12 UTC

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