Skip to content

Fail gracefully on second channel open attempt #287

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
rustyrussell opened this issue Sep 22, 2017 · 0 comments
Closed

Fail gracefully on second channel open attempt #287

rustyrussell opened this issue Sep 22, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@rustyrussell
Copy link
Contributor

From #284 we can see things get into a weird state when (understandably!) they try to open a multiple channels to the same peer because one is failing:

root@alibaba:~# lightning-cli getpeers
{ "peers" : 
	[ 
		{ "unique_id" : 0, "state" : "CHANNELD_NORMAL", "netaddr" : "Unknown protocol 0", "peerid" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6", "connected" : false, "channel" : "1196170:6:1", "msatoshi_to_us" : 0, "msatoshi_total" : 10000000000 }, 
		{ "unique_id" : 2, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false }, 
		{ "unique_id" : 2, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false }, 
		{ "unique_id" : 1, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false } ] }
root@alibaba:~# lightning-cli close 02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f
{  }
root@alibaba:~# lightning-cli close 02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f
{  }
root@alibaba:~# lightning-cli close 02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f
{  }
root@alibaba:~# lightning-cli close 02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f
"Could not find peer with that id"
root@alibaba:~# lightning-cli getpeers
{ "peers" : 
	[ 
		{ "unique_id" : 0, "state" : "CHANNELD_NORMAL", "netaddr" : "Unknown protocol 0", "peerid" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6", "connected" : false, "channel" : "1196170:6:1", "msatoshi_to_us" : 0, "msatoshi_total" : 10000000000 } ] }
root@alibaba:~# lightning-cli connect 47.91.94.194 9735 0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6
{ "id" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6" }
root@alibaba:~# lightning-cli getpeers
{ "peers" : 
	[ 
		{ "unique_id" : 0, "state" : "CHANNELD_NORMAL", "netaddr" : "47.91.94.194:9735", "peerid" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6", "connected" : true, "owner" : "lightning_channeld", "channel" : "1196170:6:1", "msatoshi_to_us" : 0, "msatoshi_total" : 10000000000 } ] }
root@alibaba:~# lightning-cli getnodes
{ "nodes" : 
	[  ] }
root@alibaba:~# lightning-cli dev-ping 0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6 10 10
{ "totlen" : 14 }
root@alibaba:~# lightning-cli getpeers^C
root@alibaba:~# lightning-cli getchannels
{ "channels" : 
	[  ] }
root@alibaba:~# lightning-cli fundchannel 0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6 10000
"Peer not ready for connection"
root@alibaba:~# lightning-cli connect 47.91.94.194 9735 0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6
{ "id" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6" }
root@alibaba:~# lightning-cli fundchannel 0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6 10000
lightning-cli: Connecting to 'lightning-rpc': Connection refused
root@alibaba:~# lightning-cli connect 47.91.94.194 9735 0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6
"Failed to connect to peer"
root@alibaba:~# lightning-cli connect 47.91.94.194 9735 0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6
{ "id" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6" }
root@alibaba:~# lightning-cli fundchannel 0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6 10000
"Peer not ready for connection"
root@alibaba:~# lightning-cli getpeers
{ "peers" : 
	[ 
		{ "unique_id" : 0, "state" : "CHANNELD_NORMAL", "netaddr" : "47.91.94.194:9735", "peerid" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6", "connected" : true, "owner" : "lightning_channeld", "channel" : "1196170:6:1", "msatoshi_to_us" : 0, "msatoshi_total" : 10000000000 }, 
		{ "unique_id" : 3, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false }, 
		{ "unique_id" : 2, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false }, 
		{ "unique_id" : 2, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false }, 
		{ "unique_id" : 1, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false } ] }
root@alibaba:~# lightning-cli close 02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f
{  }
root@alibaba:~# lightning-cli getpeers
{ "peers" : 
	[ 
		{ "unique_id" : 0, "state" : "CHANNELD_NORMAL", "netaddr" : "47.91.94.194:9735", "peerid" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6", "connected" : true, "owner" : "lightning_channeld", "channel" : "1196170:6:1", "msatoshi_to_us" : 0, "msatoshi_total" : 10000000000 }, 
		{ "unique_id" : 2, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false }, 
		{ "unique_id" : 2, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false }, 
		{ "unique_id" : 1, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false } ] }
root@alibaba:~# lightning-cli close 02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f
{  }
root@alibaba:~# lightning-cli getpeers
{ "peers" : 
	[ 
		{ "unique_id" : 0, "state" : "CHANNELD_NORMAL", "netaddr" : "47.91.94.194:9735", "peerid" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6", "connected" : true, "owner" : "lightning_channeld", "channel" : "1196170:6:1", "msatoshi_to_us" : 0, "msatoshi_total" : 10000000000 }, 
		{ "unique_id" : 2, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false }, 
		{ "unique_id" : 1, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false } ] }
root@alibaba:~# lightning-cli close 02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f
{  }
root@alibaba:~# lightning-cli getpeers
{ "peers" : 
	[ 
		{ "unique_id" : 0, "state" : "CHANNELD_NORMAL", "netaddr" : "47.91.94.194:9735", "peerid" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6", "connected" : true, "owner" : "lightning_channeld", "channel" : "1196170:6:1", "msatoshi_to_us" : 0, "msatoshi_total" : 10000000000 }, 
		{ "unique_id" : 1, "state" : "OPENINGD", "netaddr" : "Unknown protocol 0", "peerid" : "02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f", "connected" : false } ] }
root@alibaba:~# lightning-cli close 02028f6eb6852cd153bdd7344d2f6f3d80baeaf5468c8f0fc9f2635461e078a81f
{  }
root@alibaba:~# lightning-cli getpeers
{ "peers" : 
	[ 
		{ "unique_id" : 0, "state" : "CHANNELD_NORMAL", "netaddr" : "47.91.94.194:9735", "peerid" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6", "connected" : true, "owner" : "lightning_channeld", "channel" : "1196170:6:1", "msatoshi_to_us" : 0, "msatoshi_total" : 10000000000 } ] }
root@alibaba:~# lightning-cli connect 47.91.94.194 9735 0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6
{ "id" : "0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6" }
root@alibaba:~# lightning-cli fundchannel 0365c02afb409f4571d2962039c8c6e7394c93bc91a9a983c8e8b3dedbf993c8f6 10000
"Peer not ready for connection"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant