diff --git a/common/billboard.c b/common/billboard.c index 03f5d5dc3..a9f178e70 100644 --- a/common/billboard.c +++ b/common/billboard.c @@ -24,13 +24,18 @@ char *billboard_message(const tal_t *ctx, else if (!funding_locked[LOCAL] && funding_locked[REMOTE]) funding_status = "They've confirmed funding, we haven't yet."; - if (have_sigs[LOCAL] && have_sigs[REMOTE]) - announce_status = " Channel announced."; - else if (have_sigs[LOCAL] && !have_sigs[REMOTE]) - announce_status = " Waiting for their announcement signatures."; - else if (!have_sigs[LOCAL] && have_sigs[REMOTE]) - announce_status = " They need our announcement signatures."; - else if (!have_sigs[LOCAL] && !have_sigs[REMOTE]) + if (have_sigs) { + if (have_sigs[LOCAL] && have_sigs[REMOTE]) + announce_status = " Channel announced."; + else if (have_sigs[LOCAL] && !have_sigs[REMOTE]) + announce_status = " Waiting for their" + " announcement signatures."; + else if (!have_sigs[LOCAL] && have_sigs[REMOTE]) + announce_status = " They need our announcement" + " signatures."; + else if (!have_sigs[LOCAL] && !have_sigs[REMOTE]) + announce_status = ""; + } else announce_status = ""; if (!shutdown_sent[LOCAL] && !shutdown_sent[REMOTE]) diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 460d2f329..07f5772fe 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -1148,9 +1148,11 @@ void dualopen_tell_depth(struct subd *dualopend, assert(channel->scid); msg = towire_dualopend_depth_reached(NULL, depth); subd_send_msg(dualopend, take(msg)); - } - - // FIXME: update billboard. needs to_go counter! + } else + channel_set_billboard(channel, false, + tal_fmt(tmpctx, "Funding needs %d more" + " confirmations for lockin.", + to_go)); } static void accepter_psbt_changed(struct subd *dualopend, diff --git a/openingd/Makefile b/openingd/Makefile index b99c9dd64..0bb195566 100644 --- a/openingd/Makefile +++ b/openingd/Makefile @@ -39,6 +39,7 @@ OPENINGD_COMMON_OBJS := \ common/amount.o \ common/base32.o \ common/bigsize.o \ + common/billboard.o \ common/bip32.o \ common/channel_config.o \ common/channel_id.o \ diff --git a/openingd/dualopend.c b/openingd/dualopend.c index 0f632c358..f2f495222 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -153,8 +154,8 @@ struct state { /* Peer sends this to us in the funding_locked msg */ struct pubkey remote_per_commit; - /* Are we shutting this channel down? */ - bool shutting_down; + /* Are we shutting down? */ + bool shutdown_sent[NUM_SIDES]; }; /* psbt_changeset_get_next - Get next message to send @@ -297,6 +298,16 @@ static void negotiation_failed(struct state *state, bool am_opener, negotiation_aborted(state, am_opener, errmsg); } +static void billboard_update(struct state *state) +{ + const char *update = billboard_message(tmpctx, state->funding_locked, + NULL, + state->shutdown_sent, + 0, /* Always zero? */ + 0); + peer_billboard(false, update); +} + static void check_channel_id(struct state *state, struct channel_id *id_in, struct channel_id *orig_id) @@ -2187,7 +2198,7 @@ static u8 *handle_funding_locked(struct state *state, u8 *msg) type_to_string(msg, struct channel_id, &cid)); state->funding_locked[REMOTE] = true; - // FIXME: update billboard! + billboard_update(state); if (state->funding_locked[LOCAL]) return towire_dualopend_channel_locked(state, state->pps, &state->remote_per_commit); @@ -2220,7 +2231,7 @@ static u8 *handle_funding_depth(struct state *state, u8 *msg) master_badmsg(WIRE_DUALOPEND_DEPTH_REACHED, msg); /* Too late, shutting down already */ - if (state->shutting_down) + if (state->shutdown_sent[LOCAL]) return NULL; /* We check this before we arrive here, but for sanity */ @@ -2235,7 +2246,7 @@ static u8 *handle_funding_depth(struct state *state, u8 *msg) sync_crypto_write(state->pps, take(msg)); state->funding_locked[LOCAL] = true; - // FIXME: update billboard! + billboard_update(state); if (state->funding_locked[REMOTE]) return towire_dualopend_channel_locked(state, state->pps, @@ -2438,7 +2449,7 @@ int main(int argc, char *argv[]) memset(&state->channel_id, 0, sizeof(state->channel_id)); state->channel = NULL; state->funding_locked[LOCAL] = state->funding_locked[REMOTE] = false; - state->shutting_down = false; + state->shutdown_sent[LOCAL]= state->shutdown_sent[REMOTE] = false; for (size_t i = 0; i < NUM_TX_MSGS; i++) state->tx_msg_count[i] = 0;