channel_states: fold all the ONCHAIND states into one.

The billboard is now far more useful to tell what's going on, and this
gets us closer to a state == owner mapping.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-02-23 16:53:51 +10:30
committed by Christian Decker
parent 866ba00445
commit cccdb53bec
9 changed files with 72 additions and 98 deletions

View File

@@ -48,21 +48,8 @@ static void onchaind_tell_fulfill(struct channel *channel)
static void handle_onchain_init_reply(struct channel *channel, const u8 *msg)
{
u8 state;
if (!fromwire_onchain_init_reply(msg, &state)) {
channel_internal_error(channel, "Invalid onchain_init_reply");
return;
}
if (!channel_state_on_chain(state)) {
channel_internal_error(channel,
"Invalid onchain_init_reply state %u (%s)",
state, channel_state_str(state));
return;
}
channel_set_state(channel, FUNDING_SPEND_SEEN, state);
/* FIXME: We may already be ONCHAIN state when we implement restart! */
channel_set_state(channel, FUNDING_SPEND_SEEN, ONCHAIN);
/* Tell it about any preimages we know. */
onchaind_tell_fulfill(channel);