mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
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:
parent
bdf7f250de
commit
1c9a713dfa
@ -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. */
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user