state: use STATE_INIT and separate inputs to decide on anchor.

This is conceptually cleaner, especially since it means we're running
a command until we're set up (which prevents other commands, so no
special case needed).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-01-22 06:41:46 +10:30
parent e5e58eeb00
commit fd370075f2
3 changed files with 81 additions and 43 deletions

View File

@@ -12,8 +12,7 @@
#define STATE_CLOSE_SPENDOURS_BIT 32
enum state {
STATE_INIT_NOANCHOR,
STATE_INIT_WITHANCHOR,
STATE_INIT,
/*
* Opening.
@@ -268,6 +267,8 @@ enum state_input {
INPUT_RVALUE,
/* Commands */
CMD_OPEN_WITH_ANCHOR,
CMD_OPEN_WITHOUT_ANCHOR,
CMD_SEND_HTLC_UPDATE,
CMD_SEND_HTLC_FULFILL,
CMD_SEND_HTLC_TIMEDOUT,