Browse Source

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.
ppa
niftynei 4 years ago
committed by Christian Decker
parent
commit
1c9a713dfa
  1. 12
      lightningd/channel_state.h
  2. 4
      lightningd/peer_control.c

12
lightningd/channel_state.h

@ -31,9 +31,17 @@ enum channel_state {
ONCHAIN, ONCHAIN,
/* Final state after we have fully settled on-chain */ /* 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 { enum state_change {
/* Anything other than the reasons below. Should not happen. */ /* Anything other than the reasons below. Should not happen. */

4
lightningd/peer_control.c

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

Loading…
Cancel
Save