mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +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:
parent
4146950496
commit
6c96bcacd7
2 changed files with 5 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue