Repository navigation
Shutdown while awaiting lockin - #1313
Conversation
Signed-off-by: Rusty Russell <[email protected]>
Fixes: ElementsProject#1308 Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
ZmnSCPxj
left a comment
There was a problem hiding this comment.
Looks OK, mostly trusting Rusty superior knowledge of state machine though.
cdecker
left a comment
There was a problem hiding this comment.
The commits should probably be reordered (test needs to move down) otherwise we broke the bisectability of master.
FWIW, I don't think this addresses #1308 since that fails on the transition after channeld_shutting_down:
lightning/lightningd/channel_control.c
Lines 104 to 106 in 26f7014
|
|
||
| /* If we weren't already shutting down, we are now */ | ||
| if (channel->state == CHANNELD_NORMAL) | ||
| if (channel->state != CHANNELD_SHUTTING_DOWN) |
There was a problem hiding this comment.
Might a bit too permissive now? We probably also don't want to accept in state sigexchange.
There was a problem hiding this comment.
If we're in channeld (which we are), we have to be in AWAITING_LOCKIN or NORMAL or SHUTTING_DOWN. So this is actually safe.
|
I think the PR makes the state machine transition to |
|
Oh I see, we're forcing the channel state into shutting down, then tell IMHO there still is a tiny probability that there is a channel state transition between receiving the shutdown and |
|
It's channeld which tells us that it received shutdown, so it can't die at the same time? The order is:
Note that if we reconnect, the peer can re-send shutdown so we need to handle the case where we're already in CHANNELD_SHUTTING_DOWN. We could eliminate the CHANNELD_SHUTTING_DOWN state and use the existence of the remote closing scriptpubkey as a flag, but as shutdown can be extended, I think having the state is clearer to users. |
|
Oh, and on test order: I've taken to leaving the test-then-fix order in my pushes, using unittest.expectedFail() and removing it in the fix. That proves that I actually tested it before and after :) |
No description provided.