You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Be less aggressive in outbound HTLC CLTV timeout checks
We currently assume our counterparty is naive and misconfigured and
may force-close a channel to get an HTLC we just forwarded them.
There shouldn't be any reason to do this - we don't have any such
bug, and we shouldn't start by assuming our counterparties are
buggy. Worse, this results in refusing to forward payments today,
failing HTLCs for largely no reason.
Instead, we keep a fairly conservative check, but not one which
will fail HTLC forwarding spuriously - testing only that the HTLC
doesn't expire for a few blocks from now.
Fixes#1114.
breakSome(("Forwarding node has tampered with the intended HTLC values or origin node has an obsolete cltv_expiry_delta",0x1000 | 13,Some(self.get_channel_update_for_unicast(chan).unwrap())));
1851
1851
}
1852
1852
let cur_height = self.best_block.read().unwrap().height() + 1;
1853
-
// Theoretically, channel counterparty shouldn't send us a HTLC expiring now, but we want to be robust wrt to counterparty
1854
-
// packet sanitization (see HTLC_FAIL_BACK_BUFFER rational)
1853
+
// Theoretically, channel counterparty shouldn't send us a HTLC expiring now,
1854
+
// but we want to be robust wrt to counterparty packet sanitization (see
1855
+
// HTLC_FAIL_BACK_BUFFER rationale).
1855
1856
if msg.cltv_expiry <= cur_height + HTLC_FAIL_BACK_BUFFERasu32{// expiry_too_soon
1856
1857
breakSome(("CLTV expiry is too close",0x1000 | 14,Some(self.get_channel_update_for_unicast(chan).unwrap())));
1857
1858
}
1858
1859
if msg.cltv_expiry > cur_height + CLTV_FAR_FAR_AWAYasu32{// expiry_too_far
1859
1860
breakSome(("CLTV expiry is too far in the future",21,None));
1860
1861
}
1861
-
// In theory, we would be safe against unintentional channel-closure, if we only required a margin of LATENCY_GRACE_PERIOD_BLOCKS.
1862
-
// But, to be safe against policy reception, we use a longer delay.
0 commit comments