`sendtoaddress` tries to use unspendable UTXOs and fails #23783

issue antonilol opened this issue on December 15, 2021
  1. antonilol commented at 1:14 PM on December 15, 2021: none

    Is your feature request related to a problem? Please describe.

    <!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

    problem: having to wait for a confirmation before able to spend them with sendtoaddress

    Describe the solution you'd like

    <!-- A clear and concise description of what you want to happen. -->

    an optional argument to enable it for one time (i agree with #3288 but i think you should be able to override it)

    Describe alternatives you've considered

    <!-- A clear and concise description of any alternative solutions or features you've considered. -->

    i could createrawtransaction but i have a lot of UTXOs i want to bundle in one coin and it is easier to send the wallet balance to one address

    Additional context

    <!-- Add any other context or screenshots about the feature request here. -->

    on the testnet btw

  2. antonilol added the label Feature on Dec 15, 2021
  3. MarcoFalke commented at 1:22 PM on December 15, 2021: member

    There is an option to spend unconfirmed change. Are you asking to spend untrusted coins?

  4. antonilol commented at 3:45 PM on December 15, 2021: none

    i thought the error came from the fact that they were unconfirmed. but the real issue is sendtoaddress is trying to use an unspendable output (i dont have the privkey for it)

    log:

    $ bitcoin-cli listunspent 0          
    [
      {
        "txid": "dc7595d0fb13741b1aa175ed64b7de264321a0ed022763d3765ed10c5e9b7971",
        "vout": 0,
        "address": "tb1qw3pd0gznwq80wwzg9ehwlplppp8s94p3ns5236",
        "label": "",
        "scriptPubKey": "00147442d7a053700ef738482e6eef87e1084f02d431",
        "amount": 0.00030804,
        "confirmations": 341,
        "spendable": false,
        "solvable": false,
        "safe": true
      },
      {
        "txid": "08936d1a45c1de996ab9b7f12e31c16e512a77e222287436ac986f85bd32937c",
        "vout": 0,
        "address": "tb1qpr8hdsyu7gdkwnyju39qdfrmghn3ynyd64kv3a",
        "label": "",
        "scriptPubKey": "001408cf76c09cf21b674c92e44a06a47b45e7124c8d",
        "amount": 0.28421771,
        "confirmations": 0,
        "spendable": true,
        "solvable": true,
        "desc": "wpkh([8b8fe090/0'/0'/23']038954c20414979e5a874c83f4343932b84213c2275ab063b6cd1679990cc837e9)#lp9303f2",
        "safe": true
      }
    ]
    
    $ bitcoin-cli getwalletinfo
    {
      "walletname": "testnet",
      "walletversion": 169900,
      "format": "bdb",
      "balance": 0.28421771,
      "unconfirmed_balance": 0.00000000,
      "immature_balance": 0.00000000,
      "txcount": 31,
      "keypoololdest": 1639325422,
      "keypoolsize": 999,
      "hdseedid": "f2f6d54f0d4c3242870bda83800c4aee0574a0cf",
      "keypoolsize_hd_internal": 1000,
      "paytxfee": 0.00000000,
      "private_keys_enabled": true,
      "avoid_reuse": false,
      "scanning": false,
      "descriptors": false
    }
    
    $ bitcoin-cli getnewaddress
    tb1q4kuxaazx0tmwv750366x6e3x95hlsz950n6g6u
    
    $ bitcoin-cli sendtoaddress tb1q4kuxaazx0tmwv750366x6e3x95hlsz950n6g6u 0.28421771 subtractfeefromamount=true 
    error code: -6
    error message:
    Insufficient funds
    
  5. antonilol renamed this:
    allow spending unconfirmed UTXOs with sendtoaddress
    `sendtoaddress` tries to use unspendable UTXOs and fails
    on Dec 15, 2021
  6. MarcoFalke removed the label Feature on Dec 15, 2021
  7. MarcoFalke added the label Questions and Help on Dec 15, 2021
  8. MarcoFalke added the label Wallet on Dec 15, 2021
  9. antonilol commented at 3:52 PM on December 15, 2021: none

    my bad forgot the -named so it didnt recognize the subtractfeefromamount=true

  10. antonilol closed this on Dec 15, 2021

  11. antonilol commented at 3:53 PM on December 15, 2021: none

    maybe improve argument parsing to accept named and positional argument in one call

  12. antonilol commented at 4:50 PM on December 15, 2021: none

    made a separate issue for that https://github.com/bitcoin/bitcoin/issues/23786

  13. DrahtBot locked this on Dec 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-13 15:14 UTC

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