mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-07 16:14:26 +01:00
lightningd: fix inconsistency without COMPAT enabled.
We don't expect payment or payment->route_channels to be NULL without an old db, but putting an assert there reveals that we try to fail an HTLC which has already succeeded in 'test_onchain_unwatch'. Obviously we only want to fail an HTLC which goes onchain if we don't already have the preimage! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user