Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to pay but getting "WIRE_TEMPORARY_CHANNEL_FAILURE: Capacity exceeded" error. #1031

Closed
Incertainty opened this issue Feb 19, 2018 · 21 comments

Comments

@Incertainty
Copy link

Incertainty commented Feb 19, 2018

I am trying to buy a tee from the Blockstream Store however I am getting the above error whenever I execute lightning-cli pay. The full error message is:

{ "code" : 204, "message" : "failed: WIRE_TEMPORARY_CHANNEL_FAILURE (WIRE_TEMPORARY_CHANNEL_FAILURE: Capacity exceeded)", "data" : { "erring_index" : 0, "failcode" : 4103, "erring_node" : "fcf3dc2901338e20d4655b4d47c4c17468324d276b1feb1845b650f9bc0f3dbb883fbc127245f5c729f69d12f1ae7a45b9fcd66780bf7f8ae08641d13e6d6631", "erring_channel" : "509846:1382:1" } }

lightning-cli listpeers shows:

{ "peers" : 
	[ 
		{ "id" : "02f6725f9c1c40333b67faea92fd211c183050f28df32cac3f9d69685fe9665432", "connected" : true, "netaddr" : 
			[ "104.198.32.198:9735" ], "channels" : 
			[ 
				{ "state" : "CHANNELD_NORMAL", "owner" : "lightning_channeld", "short_channel_id" : "509846:1382:1", "funding_txid" : "064bdafaf74530ca1b4dbfb4a4304dd17233a8b2f0f5c3b3f7d9368e5921d2d7", "msatoshi_to_us" : 134124827, "msatoshi_total" : 200000000, "dust_limit_satoshis" : 546, "max_htlc_value_in_flight_msat" : 18446744073709551615, "channel_reserve_satoshis" : 0, "htlc_minimum_msat" : 0, "to_self_delay" : 144, "max_accepted_htlcs" : 483 } ] }, 
		{ "id" : "02dcdd7e18b80dc7fd51af34e871901c13f574e4b82325dc74c0beeada5771e8e9", "connected" : true, "netaddr" : 
			[ "138.68.14.201:9735" ], "channels" : 
			[ 
				{ "state" : "CHANNELD_NORMAL", "owner" : "lightning_channeld", "short_channel_id" : "509859:815:1", "funding_txid" : "cb5e2ef5e534889da61eb1e529f79bcf3d2678cc0d2015193c5d90ea237b00c3", "msatoshi_to_us" : 400000000, "msatoshi_total" : 400000000, "dust_limit_satoshis" : 546, "max_htlc_value_in_flight_msat" : 18446744073709551615, "channel_reserve_satoshis" : 0, "htlc_minimum_msat" : 0, "to_self_delay" : 144, "max_accepted_htlcs" : 483 } ] } ] }

And lightning-cli listfunds shows:

{ "outputs" : 
	[ 
		{ "txid" : "cb5e2ef5e534889da61eb1e529f79bcf3d2678cc0d2015193c5d90ea237b00c3", "output" : 0, "value" : 48753 } ], "channels" : 
	[ 
		{ "peer_id" : "02f6725f9c1c40333b67faea92fd211c183050f28df32cac3f9d69685fe9665432", "short_channel_id" : "509846:1382:1", "channel_sat" : 134125, "channel_total_sat" : 200000, "funding_txid" : "064bdafaf74530ca1b4dbfb4a4304dd17233a8b2f0f5c3b3f7d9368e5921d2d7" }, 
		{ "peer_id" : "02dcdd7e18b80dc7fd51af34e871901c13f574e4b82325dc74c0beeada5771e8e9", "short_channel_id" : "509859:815:1", "channel_sat" : 400000, "channel_total_sat" : 400000, "funding_txid" : "cb5e2ef5e534889da61eb1e529f79bcf3d2678cc0d2015193c5d90ea237b00c3" } ] }

lightning-cli getinfo returns:

{ "id" : "02bb3d0fbcf950b64518eb1f6b274d326874c1c4474d5b65d4208e330129dcf3fc", "port" : 9735, "address" : 
	[  ], "version" : "v0.5.2-2016-11-21-1936-ge76a0b4", "blockheight" : 509902, "network" : "bitcoin" }

Do I not have enough funds? Or what am I doing wrong?
Also how do I close the channels and return my Bitcoin back to my wallet?

@ZmnSCPxj
Copy link
Collaborator

ZmnSCPxj commented Feb 19, 2018

Your version predates #993, which will make pay keep retrying on routing failure until it finds some route that succeeds, or until it runs out of potential routes.

You can do either of the below:

  1. Keep retrying the pay command manually until you can pay.
  2. Upgrade to master and do pay command once.

To close your channels, use close command on each peer you have. Wait --- you may need to wait for a day or two if one or more of your channel counterparties have shut down. Finally when all channels have successfully closed (check listpeers command, all peers should be in state GOSSIPING) use withdraw with all to a Bitcoin address you control: e.g. lightning-cli withdraw $BITCOINADDR all.

@ZmnSCPxj
Copy link
Collaborator

Also: how much are you paying? If you are paying more than 4 mBTC (or more like 3.96 mBTC, perhaps) you cannot pay; your larger channel is only 4mBTC, and that limits your payment ability.

@Incertainty
Copy link
Author

Thanks for the replies. The tee is 28.99 USD = 2.64562385 mBTC which should be covered by my 4mBTC channel? I actually managed to buy a couple of stickers yesterday on the first channel I created, which went through fine, however trying to buy the tee it always errors so I assumed that I didn't have enough funds and created the seperate channel. But that didn't resolve my error. How do I upgrade to master? Sorry for noob questions but lightning is new to me but I am curious to test so followed the Medium article ( https://medium.com/@dougvk/run-your-own-mainnet-lightning-node-2d2eab628a8b ) in setting up a node on mainnet.

@ZmnSCPxj
Copy link
Collaborator

Your other channel has only 1.34 mBTC or so, so not enough.

Updating to latest master... unfortunately the instructions use docker, which I do not know how to use. It uses @cdecker's docker, though, so maybe he can give instructions?

For now, if you really want the product, just keep repeating the pay command quickly --- failed channels are marked internally for 20 seconds so they will not be reused for routing. You should be getting a variety of failures until you succeed, but as long as the "code" : 204 or "code" : 202 is there you should be able to retry to route.

@Incertainty
Copy link
Author

Thanks again. When doing transaction can I specify which channel to pay from? I'm assuming now that the money is not taken from both channels. When I did the transaction I only typed:
lightning-cli pay [lightningcode]

Anyway I've now tried to close the channels as I'm thinking to close them both then reopen one new one with the total BTC from both channels. When I closed the channels I typed:
lightning-cli close [channel]

From closing the channels do you know how long it will be until I see the BTC in my wallet? bitcoin-cli getwalletinfo is currently showing 0:

{
"walletname": "wallet.dat",
"walletversion": 139900,
"balance": 0.00000000,
"unconfirmed_balance": 0.00000000,
"immature_balance": 0.00000000,
"txcount": 0,
"keypoololdest": 1518908214,
"keypoolsize": 1000,
"keypoolsize_hd_internal": 1000,
"paytxfee": 0.00500000,
"hdmasterkeyid": "4339c4f878b3acc0c1387d2d03466f1fbd8b82c5"
}

lightning-cli listpeers currently shows:

lightning-cli listpeers
{ "peers" :
[
{ "id" : "02f6725f9c1c40333b67faea92fd211c183050f28df32cac3f9d69685fe9665432", "connected" : false, "channels" :
[
{ "state" : "ONCHAIND_MUTUAL", "owner" : "lightning_onchaind", "short_channel_id" : "509846:1382:1", "funding_txid" : "064bdafaf74530ca1b4dbfb4a4304dd17233a8b2f0f5c3b3f7d9368e5921d2d7", "msatoshi_to_us" : 134124827, "msatoshi_total" : 200000000, "dust_limit_satoshis" : 546, "max_htlc_value_in_flight_msat" : 18446744073709551615, "channel_reserve_satoshis" : 0, "htlc_minimum_msat" : 0, "to_self_delay" : 144, "max_accepted_htlcs" : 483 } ] },
{ "id" : "02dcdd7e18b80dc7fd51af34e871901c13f574e4b82325dc74c0beeada5771e8e9", "connected" : false, "channels" :
[
{ "state" : "ONCHAIND_MUTUAL", "owner" : "lightning_onchaind", "short_channel_id" : "509859:815:1", "funding_txid" : "cb5e2ef5e534889da61eb1e529f79bcf3d2678cc0d2015193c5d90ea237b00c3", "msatoshi_to_us" : 400000000, "msatoshi_total" : 400000000, "dust_limit_satoshis" : 546, "max_htlc_value_in_flight_msat" : 18446744073709551615, "channel_reserve_satoshis" : 0, "htlc_minimum_msat" : 0, "to_self_delay" : 144, "max_accepted_htlcs" : 483 } ] } ] }

@ZmnSCPxj
Copy link
Collaborator

ONCHAIND_MUTUAL means ithe funds should appear as soon as closing tx confirms, so just wait a little. Then the peers should go to GOSSIPING state and you should be able to rechannel..

@Incertainty
Copy link
Author

Thank you. I'll see what happens over the next 24 hours.

@ZmnSCPxj
Copy link
Collaborator

ZmnSCPxj commented Feb 19, 2018

Note that it will appear in the lightning wallet, not in the bitcoind wallet. Use lightning-cli listfunds to see your funds on the lightningd wallet.

@Incertainty
Copy link
Author

Oh okay thanks. I didn't realise that. i'll keep checking that one.

@cdecker
Copy link
Member

cdecker commented Feb 20, 2018

@ZmnSCPxj kicking docker hub to update to latest master, will do that regularly from now on.

@ZmnSCPxj
Copy link
Collaborator

@cdecker thank you very much. Can you share instructions with @Incertainty how to update the install to latest from your docker?

@cdecker
Copy link
Member

cdecker commented Feb 20, 2018

A docker pull cdecker/lightningd:latest should be sufficient, and then restart the container with docker stop and docker run (you did mount the wallet directory from the host OS, right?)

@Incertainty
Copy link
Author

Thanks @ZmnSCPxj and @cdecker for all advice so far in helping me bag this tee, its been a good learning experience for me. In summary here is the situation now, still tee-less:
lightning-cli listpeers
{ "peers" :
[ ] }

lightning-cli listfunds
{ "outputs" :
[
{ "txid" : "cb5e2ef5e534889da61eb1e529f79bcf3d2678cc0d2015193c5d90ea237b00c3", "output" : 0, "value" : 48753 },
{ "txid" : "d573c8584adb37a0b065b75fcf9b278c6474fb462cf9a8450d8f16816cdc7088", "output" : 0, "value" : 399368 },
{ "txid" : "068dc0f9d96ae149f8c6abc10805f6b597d97ef0e27945ed099d72ec37ffc41c", "output" : 1, "value" : 133492 } ], "channels" :
[ ] }

Does this mean that both my channels have now successfully closed and funds returned to my lightning wallet? (48753 + 399368 + 133492 = 581,613 satoshis)

I guess I have a number of options now:

  1. Transfer all outstanding Bitcoin from lightning wallet back to my personal Bitcoin wallet, give up and shut down the node;
  2. Update to master, reopen a new single channel and include all available funds and try again to buy the tee;
  3. Don't update to master, reopen a new single channel and include all available funds and try again to buy the tee.
    What is my best option?
    @cdecker I'm not entirely sure what you mean. I basically followed the instructions from the Medium article that I posted above. Sorry this is mostly new to me but I assume that included me mounting the wallet directory on the host OS.

Basically considering the instructions in that article how would I be best to integrate an upgrade to master?

@ZmnSCPxj
Copy link
Collaborator

If your goal is the tee, than option 3 should be good; payment will still work on non-master with a direct channel, it is the indirect routes when you have a depleted direct channels that are a bit iffy if you are not on latest.

(incidentally, most command lines let you easily repeat old commands by using the up-arrow key in your keyboard, so if you are still unable to update to latest master, next time pay fails with 204 or 202 you can just press up-arrow and Enter to retry the pay command quickly; latest master automates the pay retry)

@Incertainty
Copy link
Author

Thanks. Yes the unltinate goal is the tee and to learn more about Lightning. I managed to purchase the stickers so it confused me how my second purchase for the tee failed. Anyway is my assumption about how many satoshis I have in my lightning wallet correct? I can add all these to funding a new channel? I will try option 3 tonight when back from work. Incidentally is there a direct channel to Blockstream Store or a way to find the nearest channel?

@ZmnSCPxj
Copy link
Collaborator

ZmnSCPxj commented Feb 21, 2018

If you go connect to Blockstream and fundchannel directly to them, then you have a direct channel to Blockstream. I believe @cdecker tweeted the node pubkey and the address of Blockstream. Edit: here: https://twitter.com/snyke/status/953428932866560001?lang=en

(c-lightning currently has a limitation that it can only allow one channel per peer at a time. this will not affect you, as, you have no channels now, but you should be aware of this fact if later you want to transfer more funds over the LN. this is not an onerous limitation as in general your risk is better spread if you have channels to multiple different peers than if you have multiple channels to a single "hub" peer)

The number of satoshi is correct, although you need to manually specify how much of those to put into a channel.

@cdecker
Copy link
Member

cdecker commented Feb 21, 2018

@Incertainty I was referring to you having the following in your initial docker run command:

-v /scratch/bitcoin/mainnet/clightning:/root/.lightning

that makes sure that your lightningd writes to a directory that is not part of the docker image and will survive a restart of the container. Without that you'd be writing in a directory in the container which would be lost when creating a new container.

@Incertainty
Copy link
Author

Incertainty commented Feb 21, 2018

@cdecker thanks that is correct. The complete command line I used was:

docker run --rm --name lightning --network container:bitcoind_mainnet -v /scratch/bitcoin/mainnet/bitcoind:/root/.bitcoin -v /scratch/bitcoin/mainnet/clightning:/root/.lightning --entrypoint /usr/bin/lightningd cdecker/lightningd:master --network=bitcoin --log-level=debug

@Incertainty
Copy link
Author

Update to master appears to have gone okay:

docker pull cdecker/lightningd:latest
latest: Pulling from cdecker/lightningd
1be7f2b886e8: Already exists
6fbc4a21b806: Already exists
c71a6f8e1378: Already exists
4be3072e5a37: Already exists
06c6d2f59700: Already exists
4b019bc0046f: Pull complete
f01d429e1eae: Pull complete
Digest: sha256:560f9a8295441690f2c48e959f07059b93312910e5077504f3f065dcd6c3cba3
Status: Downloaded newer image for cdecker/lightningd:latest

docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f32535f850fd cdecker/lightningd:master "/usr/bin/lightningd…" 3 days ago Up 3 days lightning
e4b0eeae00ee dougvk/bitcoind:latest "/entrypoint.sh bitc…" 3 days ago Up 3 days 0.0.0.0:8333->8333/tcp, 8332/tcp, 18332-18333/tcp, 0.0.0.0:9735->9735/tcp bitcoind_mainnet

docker stop f32535f850fd
f32535f850fd
docker stop e4b0eeae00ee
e4b0eeae00ee

Then I restarted the containers:

docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
692f9b0cf56f cdecker/lightningd:master "/usr/bin/lightningd…" 17 seconds ago Up 16 seconds lightning
e4b0eeae00ee dougvk/bitcoind:latest "/entrypoint.sh bitc…" 3 days ago Up 47 seconds 0.0.0.0:8333->8333/tcp, 8332/tcp, 18332-18333/tcp, 0.0.0.0:9735->9735/tcp bitcoind_mainnet

Will open a new channel add 550,000 satoshis and retry purchase.

@Incertainty
Copy link
Author

@ZmnSCPxj @cdecker many thanks to you both. Payment was instant and successful this time. Looking forward to the tee and stickers arriving. :)
screen shot 2018-02-21 at 9 28 09 pm

Incidently, and my last question, now that I have a lightning node running, can I name it or assign it an alias? When I look at https://lnmainnet.gaben.win they all have names.

@cdecker
Copy link
Member

cdecker commented Feb 22, 2018

@Incertainty that's great news, glad it worked out in the end.

Your node already has a randomly generated name, you can use docker logs 692f9b0cf56f to see the logs and the name should be printed along with your public key relatively high up. If you'd like to give it a custom name you can stop the container, and restart with an additional --alias=yourname and it should eventually show up on the network explorer as well.

@cdecker cdecker closed this as completed Feb 22, 2018
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Apr 1, 2023
"Allow nodes to overshoot the MPP `total_msat` when paying (ElementsProject#1031)"

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Changed: Protocol: Allow slight overpaying, even with MPP, as spec now recommends.
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Apr 7, 2023
"Allow nodes to overshoot the MPP `total_msat` when paying (ElementsProject#1031)"

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Changed: Protocol: Allow slight overpaying, even with MPP, as spec now recommends.
rustyrussell added a commit that referenced this issue Apr 7, 2023
"Allow nodes to overshoot the MPP `total_msat` when paying (#1031)"

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Changed: Protocol: Allow slight overpaying, even with MPP, as spec now recommends.
itme-brain pushed a commit to itme-brain/lightning that referenced this issue Apr 7, 2023
"Allow nodes to overshoot the MPP `total_msat` when paying (ElementsProject#1031)"

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Changed: Protocol: Allow slight overpaying, even with MPP, as spec now recommends.
ddustin pushed a commit to ddustin/lightning that referenced this issue Apr 11, 2023
"Allow nodes to overshoot the MPP `total_msat` when paying (ElementsProject#1031)"

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Changed: Protocol: Allow slight overpaying, even with MPP, as spec now recommends.
gkrizek pushed a commit to voltagecloud/lightning that referenced this issue Apr 26, 2023
"Allow nodes to overshoot the MPP `total_msat` when paying (ElementsProject#1031)"

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Changed: Protocol: Allow slight overpaying, even with MPP, as spec now recommends.
ddustin pushed a commit to ddustin/lightning that referenced this issue May 12, 2023
"Allow nodes to overshoot the MPP `total_msat` when paying (ElementsProject#1031)"

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Changed: Protocol: Allow slight overpaying, even with MPP, as spec now recommends.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants