Trying to spend 20,000 sats to fund a channel but getting "Cannot afford transaction" error. I have about 8 million sats so not sure why im getting the error?
listfunds output:
"outputs": [
{
"txid": "c9f6a28f7af2da6da66f9a4c6b1404037a3100553bd6dd53a3d8e56920fe81e9",
"output": 1,
"value": 7647454,
"amount_msat": "7647454000msat",
"address": "tb1qa8c6j0lu02ur9u4g673m33ume247wy29q70snz",
"status": "unconfirmed"
},
{
"txid": "845b1aa450d016f4360ae067f399e60cfff22ef417e059a6b9bbf15c89292bb1",
"output": 1,
"value": 978846,
"amount_msat": "978846000msat",
"address": "tb1qct9k6dzlxqkn0242uleyndtm8tyfztax2qt253",
"status": "unconfirmed"
}
],
"channels": [
{
"peer_id": "030f0bf260acdbd3edcad84d7588ec7c5df4711e87e6a23016f989b8d3a4147230",
"channel_sat": 20000,
"our_amount_msat": "20000000msat",
"channel_total_sat": 20000,
"amount_msat": "20000000msat",
"funding_txid": "c9f6a28f7af2da6da66f9a4c6b1404037a3100553bd6dd53a3d8e56920fe81e9"
},
{
"peer_id": "036b96e4713c5f84dcb8030592e1bd42a2d9a43d91fa2e535b9bfd05f2c5def9b9",
"channel_sat": 20000,
"our_amount_msat": "20000000msat",
"channel_total_sat": 20000,
"amount_msat": "20000000msat",
"funding_txid": "845b1aa450d016f4360ae067f399e60cfff22ef417e059a6b9bbf15c89292bb1"
}
]
}
I've been getting this error too the past couple days. I'm on 0.7.0.
Tried to fund a handful of different channels with ~ 400k sats each and at least two of them gave that error. I also had millions of sats to spare.
Couple things that were different that could have contributed to the problem are that I use feerate=slow, for at least one of the channels I had one or more opening transactions waiting in the mempool.
I waited 30-60 minutes and when I tried again, I was able to open the channels.
@FontaineDenton your listfund outputs are currently unconfirmed
"status": "unconfirmed"
Ah, that would explain my situation as well!
for at least one of the channels I had one or more opening transactions waiting in the mempool
I waited 30-60 minutes and when I tried again, I was able to open the channels.
I had enough funds but had to wait for the change UTXOs from my channel opening transactions to confirm.
Thanks @niftynei!
@niftynei That would explain it but I funded the other channels with the unconfirmed status. You can see the proof of that by checking the tx id in a block explorer and cross referencing the addresses.
I just noticed that I didn't add the optional minconf argument to fundchannel, that'd allow you to use unconfirmed outputs to fund a new channel (at the risk of chaining channel fundings which usually end up being nasty).
Would changing the message to Insufficient confirmed funds to fund channel be better?
Wow I found a real bug! That would be better. Just from a UX pov i didn't look at whether the onchain tx had confirmed or not as the other fundchannels were successful, better to make it obvious you have to wait for confs.
Most helpful comment
I just noticed that I didn't add the optional
minconfargument tofundchannel, that'd allow you to use unconfirmed outputs to fund a new channel (at the risk of chaining channel fundings which usually end up being nasty).Would changing the message to
Insufficient confirmed funds to fund channelbe better?