Skip to content

Channels stuck in ONCHAIND_OUR_UNILATERAL state #721

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

Closed
hectorj opened this issue Jan 22, 2018 · 18 comments
Closed

Channels stuck in ONCHAIND_OUR_UNILATERAL state #721

hectorj opened this issue Jan 22, 2018 · 18 comments

Comments

@hectorj
Copy link

hectorj commented Jan 22, 2018

Hi! I have multiple channels which seems to be stuck in the ONCHAIND_OUR_UNILATERAL state.

Here is the list:

lightning-cli listpeers | grep -B2 ONCHAIND_OUR_UNILATERAL
�[3;J
		{ "id" : "020de4c7b3fcca7eac8fe5ac0fb9c87400db5a931baec35251fe7c55f0d0f91773", "connected" : false, "channels" : 
			[ 
				{ "state" : "ONCHAIND_OUR_UNILATERAL", "short_channel_id" : "505357:1830:0", "funding_txid" : "3d48f673f98738bb5d4edb04d57028230f3e23fd244bb8e848ddd9f53d4f3026", "msatoshi_to_us" : 0, "msatoshi_total" : 70000000, "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" : "035f1498c929d4cefba4701ae36a554691f526ff60b1766badd5a49b3c8b68e1d8", "connected" : false, "channels" : 
			[ 
				{ "state" : "ONCHAIND_OUR_UNILATERAL", "short_channel_id" : "505026:359:1", "funding_txid" : "ce8f29dc21a96f1e1d0e60db0f44414943b31c64487718209c254d3708da8991", "msatoshi_to_us" : 250000000, "msatoshi_total" : 250000000, "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" : "03db669c2f2a3d596c4b2110e6334a147e80019d37bb8c94707aa7751b8e9756d2", "connected" : false, "channels" : 
			[ 
				{ "state" : "ONCHAIND_OUR_UNILATERAL", "short_channel_id" : "504786:1466:1", "funding_txid" : "7d6705eebdc34e0073614fbb624817a9777dd68e4c5e25f9a50c32b7a56c73ac", "msatoshi_to_us" : 228285000, "msatoshi_total" : 228285000, "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" : "03cbf298b068300be33f06c947b9d3f00a0f0e8089da3233f5db37e81d3a596fe1", "connected" : false, "channels" : 
			[ 
				{ "state" : "ONCHAIND_OUR_UNILATERAL", "short_channel_id" : "504710:651:1", "funding_txid" : "4f73ae2d1cb668b97e9cb5ee06450a981c4263046a29c786e748a4af00f65574", "msatoshi_to_us" : 10000, "msatoshi_total" : 100000000, "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" : "02aeb693e2dfb2f890c65dcf27e6eb7d52dd3e4f7b74ce5fe646675793625f9b51", "connected" : false, "channels" : 
			[ 
				{ "state" : "ONCHAIND_OUR_UNILATERAL", "short_channel_id" : "504690:1724:1", "funding_txid" : "afeb0b5d5e1b89dd4c457084f86767261826e139b07e6e7c62a0d31cca8a16f6", "msatoshi_to_us" : 150000000, "msatoshi_total" : 150000000, "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" : "02eccebd9ed98f6d267080a58194dbe554a2b33d976eb95bb7c116d00fd64c4a13", "connected" : false, "channels" : 
			[ 
				{ "state" : "ONCHAIND_OUR_UNILATERAL", "short_channel_id" : "504681:1734:0", "funding_txid" : "12637c45f213673591db085f9ca8581498f33a7f165278885f4a18c6229a7cc9", "msatoshi_to_us" : 150000000, "msatoshi_total" : 150000000, "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 } ] },

Here are links to the funding transactions:

I tried asking c-lightning to close them again, but it refuses with the message "Peer is in state ONCHAIND_OUR_UNILATERAL" (which seems normal)

The funds do not seem to appear in my listfunds.

Is there a way to properly close them, or forget them (if funds are lost anyway)?

@rustyrussell
Copy link
Contributor

Yeah, it's pretty silent about what's happening here.

There's a delay before it can take back its own outputs, which it will automatically spend back to the wallet. Then another 100 blocks before it forgets the peer completely.

@ZmnSCPxj
Copy link
Contributor

These are not stuck, they are awaiting a timeout before they can reclaim the funds. This is due to a unilateral close being done by lightningd. Unilateral closes have a timeout, bilateral closes do not.

Probably a fix would be to include a reclaim_at_blockheight, but I am uncertain how to express when the closing tx is not yet confirmed; the timeout starts as soon as the closing tx confirms, and that is when we can compute reclaim_at_blockheight.

@shrugged
Copy link

is there a way to ignore that channel and use another?

@hectorj
Copy link
Author

hectorj commented Jan 23, 2018

Oh ok, I thought I "only" had to wait 144 blocks ~= 1440 minutes = 1 day.

I'll be patient then. Thanks for your explanations!

Closing for now.

@hectorj
Copy link
Author

hectorj commented Jan 24, 2018

When should I start "worrying"? (not really worried, I knew the risks when I started experimenting on mainnet)

All those channels I've listed are still in the same state.

I wonder if it's not the same issue as #747

@hectorj
Copy link
Author

hectorj commented Jan 24, 2018

I should note I am using a pruning bitcoind.

@gdassori
Copy link
Contributor

I have a channel in the same status with a fullnode with txindex

@hectorj
Copy link
Author

hectorj commented Jan 24, 2018

hmmm.. weird, for a few minutes I really thought the pruning was the reason, because:

My funding transaction's output is spent in https://www.smartbit.com.au/tx/2d0707e9327201788577ef5ccc5c801183132b6e775038d353c61a4c9951d6f5

But here is what I get when I try to get this transaction from my bitcoind:

bitcoin-cli getrawtransaction 2d0707e9327201788577ef5ccc5c801183132b6e775038d353c61a4c9951d6f5
error code: -5
error message:
No such mempool transaction. Use -txindex to enable blockchain transaction queries. Use gettransaction for wallet transactions.

@hectorj
Copy link
Author

hectorj commented Jan 24, 2018

In the coming days I'll try droping the pruning and activating txindex (I'm gonna need a bigger disk 🙁 ).

@alecalve
Copy link

I too run an non-pruning, txindex-ed node with channels in that situation, so I think we can rule out pruning.

@Ulmo
Copy link

Ulmo commented Jan 25, 2018

On my full unpruned node with txindex, it easily works:

$ bitcoin-cli getrawtransaction 2d0707e9327201788577ef5ccc5c801183132b6e775038d353c61a4c9951d6f5
02000000000101ac736ca5b7320ca5f9255e4c8ed67d77a9174862bb4f6173004ec3bdee05677d0100000000b1a9518001a913020000000000220020465a132e548b68c719d86df478d12d51ff7da3e04fa63f965ccff903b965a5e7040047304402205876d5139e70949a36400f1e6f96297dd903bb7cb9cf23425ee723624c3368910220097fa47b53aa0445b799007364f37a494ce82594904deced656cf57e5a9bb2bb01473044022016811c028b18520b12ee325f523fceaf927243af202a5d6a1d2bdb1d2306d08a02201356817e45e77c6049dc10f91feb0e7005119f60b82c1ef92bb6fb670e33966c0147522102311436df5fed078a362893d20b2c6cc4918e671a445de2d4181dd67e2f3418da2103dbdc00f5bf91def950db6fb28585f8704919f8d155e1c333603f1bbef091fa0f52aeaa2ee820
$

@gdassori
Copy link
Contributor

Related to my previous comment, for the records: my funds returned after 144 blocks.
Sometimes the lightning node hang to sync the blockchain as already reported, so it may be laggy.
You also may want to check if blockheight in lightningd is aligned with bitcoind.

@hectorj
Copy link
Author

hectorj commented Jan 26, 2018

After updating my c-lightning node with latest commits, all these channels are gone. But all the funds did not come back 🤔

@hectorj
Copy link
Author

hectorj commented Jan 26, 2018

Maybe closing transactions were finally properly published, and the 144 blocks countdown starts now.

I'll be patient again.

@alecalve
Copy link

@hectorj you should check that your node is up to date with the blockchain using the dev-blockheight RPC call.

@hectorj
Copy link
Author

hectorj commented Jan 26, 2018

@alecalve : thanks for the tip. It is indeed up-to-date { "blockheight" : 506197 }

@hectorj
Copy link
Author

hectorj commented Jan 29, 2018

Funds from the second channel ("505026:359:1") appeared in my listfunds today. Patience seems to be working.

@hectorj
Copy link
Author

hectorj commented Jan 29, 2018

PS : Here is the transaction which brought the funds back https://www.smartbit.com.au/tx/6c88698d7d77bfa62312b7f9401a4006222747d8b1eea477b183750752606d20

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

7 participants