mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-09 15:18:09 +01:00
780b3870ad
1. We explicitly assert what state we're coming from, to make transitions clearer. 2. Every transition has a state, even between owners while waiting for HSM. 3. Explictly step though getting the HSM signature on the funding tx before starting channeld, rather than doing it in parallel: makes states clearer. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
46 lines
1008 B
C
46 lines
1008 B
C
#ifndef LIGHTNING_LIGHTNINGD_PEER_STATE_H
|
|
#define LIGHTNING_LIGHTNINGD_PEER_STATE_H
|
|
#include "config.h"
|
|
|
|
enum peer_state {
|
|
UNINITIALIZED,
|
|
|
|
/* In gossip daemon. */
|
|
GOSSIPD,
|
|
|
|
/* Negotiating channel opening: in opening daemon */
|
|
OPENINGD,
|
|
|
|
/* Getting signature from HSM for funding tx (funder only). */
|
|
GETTING_SIG_FROM_HSM,
|
|
|
|
/* Waiting for funding tx to lock in: either have broadcast, or
|
|
* have sent `funding_signed`. */
|
|
OPENINGD_AWAITING_LOCKIN,
|
|
|
|
/* Getting HSM fd for channeld. */
|
|
GETTING_HSMFD,
|
|
|
|
/* In channeld, still waiting for lockin. */
|
|
CHANNELD_AWAITING_LOCKIN,
|
|
|
|
/* Normal operating state. */
|
|
CHANNELD_NORMAL,
|
|
|
|
/* We are closing, pending HTLC resolution. */
|
|
SHUTDOWND_SENT,
|
|
/* Both are closing, pending HTLC resolution. */
|
|
SHUTDOWND_RCVD,
|
|
|
|
/* Exchanging signatures on closing tx. */
|
|
CLOSINGD_SIGEXCHANGE,
|
|
|
|
/* Various onchain states. */
|
|
ONCHAIND_CHEATED,
|
|
ONCHAIND_THEIR_UNILATERAL,
|
|
ONCHAIND_OUR_UNILATERAL,
|
|
ONCHAIND_MUTUAL
|
|
};
|
|
|
|
#endif /* LIGHTNING_LIGHTNINGD_PEER_STATE_H */
|