dual-fund: on witness failure, route through dualopend

We want to notify the peer that we've failed and why, as a courtesy.
This commit is contained in:
niftynei
2021-04-08 16:09:36 -05:00
committed by Rusty Russell
parent ff164cf8b3
commit d5bf6bb994
2 changed files with 40 additions and 15 deletions

View File

@@ -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 */