state_types: simplify open states.

The state now doesn't differentiate between who is funding.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-11-09 08:04:26 +10:30
parent 1f23905bee
commit eedf95a8fc
5 changed files with 152 additions and 187 deletions

23
state.h
View File

@@ -35,17 +35,22 @@ static inline bool state_is_normal(enum state s)
return s == STATE_NORMAL || s == STATE_NORMAL_COMMITTING;
}
static inline bool state_is_opening(enum state s)
{
return s < STATE_NORMAL;
}
static inline bool state_is_waiting_for_anchor(enum state s)
{
return s == STATE_OPEN_WAITING_OURANCHOR
|| s == STATE_OPEN_WAITING_OURANCHOR_THEYCOMPLETED
|| s == STATE_OPEN_WAITING_THEIRANCHOR
|| s == STATE_OPEN_WAITING_THEIRANCHOR_THEYCOMPLETED;
return s == STATE_OPEN_WAIT_ANCHORDEPTH_AND_THEIRCOMPLETE
|| s == STATE_OPEN_WAIT_ANCHORDEPTH;
}
static inline bool state_is_openwait(enum state s)
{
return s == STATE_OPEN_WAIT_ANCHORDEPTH_AND_THEIRCOMPLETE
|| s == STATE_OPEN_WAIT_ANCHORDEPTH
|| s == STATE_OPEN_WAIT_THEIRCOMPLETE;
}
static inline bool state_is_opening(enum state s)
{
return s <= STATE_OPEN_WAIT_THEIRCOMPLETE;
}
static inline bool state_can_io(enum state s)