diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index f367cc671..f18881405 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -1456,15 +1456,21 @@ static void handle_peer_tx_sigs_sent(struct subd *dualopend, * transaction `feerate` */ if (!feerate_satisfied(inflight->funding_psbt, - inflight->funding->feerate)) - channel_fail_permanent(channel, - REASON_PROTOCOL, - "Agreed feerate %dperkw not" - " met with witnesses %s", + inflight->funding->feerate)) { + char *errmsg = tal_fmt(tmpctx, + "Witnesses lower effective" + " feerate below agreed upon rate" + " of %dperkw. Failing channel." + " Offending PSBT: %s", inflight->funding->feerate, type_to_string(tmpctx, - struct wally_psbt, - inflight->funding_psbt)); + struct wally_psbt, + inflight->funding_psbt)); + + /* Notify the peer we're failing */ + subd_send_msg(dualopend, + take(towire_dualopend_fail(NULL, errmsg))); + } } } @@ -1778,15 +1784,21 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend, * transaction `feerate` */ if (!feerate_satisfied(inflight->funding_psbt, - inflight->funding->feerate)) - channel_fail_permanent(channel, - REASON_PROTOCOL, - "Agreed feerate %dperkw not" - " met with witnesses %s", + inflight->funding->feerate)) { + char *errmsg = tal_fmt(tmpctx, + "Witnesses lower effective" + " feerate below agreed upon rate" + " of %dperkw. Failing channel." + " Offending PSBT: %s", inflight->funding->feerate, type_to_string(tmpctx, - struct wally_psbt, - inflight->funding_psbt)); + struct wally_psbt, + inflight->funding_psbt)); + + /* Notify the peer we're failing */ + subd_send_msg(dualopend, + take(towire_dualopend_fail(NULL, errmsg))); + } } /* Send notification with peer's signed PSBT */ diff --git a/openingd/dualopend.c b/openingd/dualopend.c index b22b80060..0d85f2e5a 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -436,6 +436,17 @@ static void handle_our_shutdown(struct state *state, u8 *msg) billboard_update(state); } +static void handle_failure_fatal(struct state *state, u8 *msg) +{ + char *err; + + if (!fromwire_dualopend_fail(msg, msg, &err)) + master_badmsg(fromwire_peektype(msg), msg); + + /* We're gonna fail here */ + open_err_fatal(state, "%s", err); +} + static void check_channel_id(struct state *state, struct channel_id *id_in, struct channel_id *orig_id) @@ -3267,12 +3278,14 @@ static u8 *handle_master_in(struct state *state) case WIRE_DUALOPEND_SEND_SHUTDOWN: handle_our_shutdown(state, msg); return NULL; + case WIRE_DUALOPEND_FAIL: + handle_failure_fatal(state, msg); + return NULL; /* Handled inline */ case WIRE_DUALOPEND_INIT: case WIRE_DUALOPEND_REINIT: case WIRE_DUALOPEND_DEV_MEMLEAK_REPLY: - case WIRE_DUALOPEND_FAIL: case WIRE_DUALOPEND_PSBT_UPDATED: case WIRE_DUALOPEND_GOT_OFFER_REPLY: case WIRE_DUALOPEND_GOT_RBF_OFFER_REPLY: