mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-18 14:44:22 +01:00
onchaind: keep trying to collect HTLC even if we're past timeout.
The test actually triggers this: 1. We don't get our commitment tx mined at all (we block it). 2. By the time the peer does, the HTLC is expired. 3. We have the preimage but we don't even try, since it's expired. We should at least *try* to collect the HTLC in this case. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1499,12 +1499,16 @@ static void handle_preimage(struct tracked_output **outs,
|
||||
if (!ripemd160_eq(&outs[i]->htlc.ripemd, &ripemd))
|
||||
continue;
|
||||
|
||||
/* Too late? */
|
||||
/* If HTLC has timed out, we will already have
|
||||
* proposed a "ignore this, it's their problem". But
|
||||
* now try this proposal instead! */
|
||||
if (outs[i]->resolved) {
|
||||
status_broken("HTLC already resolved by %s"
|
||||
" when we found preimage",
|
||||
tx_type_name(outs[i]->resolved->tx_type));
|
||||
return;
|
||||
if (outs[i]->resolved->tx_type != SELF) {
|
||||
status_broken("HTLC already resolved by %s"
|
||||
" when we found preimage",
|
||||
tx_type_name(outs[i]->resolved->tx_type));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* stash the payment_hash so we can track this coin movement */
|
||||
|
||||
Reference in New Issue
Block a user