channel-state: add two new states, for dualopend

v2 channel opens are going to happen over in dualopend. In order
to make sure that these don't end up in the wrong place/to keep track of
the difference between "waiting for sigs" and "have merely initiatlized
a channel", we add two new states to the channel state machine.

A channel that 'originates' in dualopend will only ever arrive at
channeld in the state CHANNELD_NORMAL.
This commit is contained in:
niftynei 2020-11-23 19:43:02 -06:00 committed by Christian Decker
parent bdf7f250de
commit 1c9a713dfa
2 changed files with 14 additions and 2 deletions

View File

@ -31,9 +31,17 @@ enum channel_state {
ONCHAIN,
/* Final state after we have fully settled on-chain */
CLOSED
CLOSED,
/* For dual-funded channels, we start at a different state.
* We transition to 'awaiting lockin' after sigs have
* been exchanged */
DUALOPEND_OPEN_INIT,
/* Dual-funded channel, waiting for lock-in */
DUALOPEND_AWAITING_LOCKIN,
};
#define CHANNEL_STATE_MAX CLOSED
#define CHANNEL_STATE_MAX DUALOPEND_AWAITING_LOCKIN
enum state_change {
/* Anything other than the reasons below. Should not happen. */

View File

@ -1021,6 +1021,10 @@ peer_connected_hook_cb(struct peer_connected_hook_payload *payload STEALS,
"Awaiting unilateral close");
goto send_error;
}
case DUALOPEND_OPEN_INIT:
case DUALOPEND_AWAITING_LOCKIN:
/* FIXME: open dualopend */
abort();
case CHANNELD_AWAITING_LOCKIN:
case CHANNELD_NORMAL: