diff --git a/lightningd/pay.c b/lightningd/pay.c index c0545ad14..4d511160a 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -482,6 +482,9 @@ void payment_failed(struct lightningd *ld, const struct htlc_out *hout, PAYMENT_FAILED, NULL); return; } +#else + assert(payment); + assert(payment->route_channels); #endif /* This gives more details than a generic failure message */ diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 3d691e37c..c03c9d4cb 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -860,8 +860,8 @@ void onchain_failed_our_htlc(const struct channel *channel, struct lightningd *ld = channel->peer->ld; struct htlc_out *hout = find_htlc_out_by_ripemd(channel, &htlc->ripemd); - /* Don't fail twice! */ - if (hout->failuremsg || hout->failcode) + /* Don't fail twice (or if already succeeded)! */ + if (hout->failuremsg || hout->failcode || hout->preimage) return; hout->failcode = WIRE_PERMANENT_CHANNEL_FAILURE;