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
Time out incoming HTLCs when we reach cltv_expiry (+ test)
We only do this for incoming HTLCs directly as we rely on channel
closure and HTLC-Timeout broadcast to fail any HTLCs which we
relayed onwards where our next-hop doesn't update_fail in time.
Copy file name to clipboardExpand all lines: lightning/src/ln/channelmanager.rs
+40-7Lines changed: 40 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ use secp256k1;
28
28
use chain::chaininterface::{BroadcasterInterface,ChainListener,FeeEstimator};
29
29
use chain::transaction::OutPoint;
30
30
use ln::channel::{Channel,ChannelError};
31
-
use ln::channelmonitor::{ChannelMonitor,ChannelMonitorUpdate,ChannelMonitorUpdateErr,ManyChannelMonitor,CLTV_CLAIM_BUFFER,LATENCY_GRACE_PERIOD_BLOCKS,ANTI_REORG_DELAY};
31
+
use ln::channelmonitor::{ChannelMonitor,ChannelMonitorUpdate,ChannelMonitorUpdateErr,ManyChannelMonitor,CLTV_CLAIM_BUFFER,LATENCY_GRACE_PERIOD_BLOCKS,ANTI_REORG_DELAY,HTLC_FAIL_BACK_BUFFER};
32
32
use ln::features::{InitFeatures,NodeFeatures};
33
33
use ln::router::{Route,RouteHop};
34
34
use ln::msgs;
@@ -76,6 +76,7 @@ enum PendingHTLCRouting {
76
76
},
77
77
Receive{
78
78
payment_data:Option<msgs::FinalOnionHopData>,
79
+
incoming_cltv_expiry:u32,// Used to track when we should expire pending HTLCs that go unclaimed
79
80
},
80
81
}
81
82
@@ -129,6 +130,7 @@ struct ClaimableHTLC {
129
130
/// payment_secret which prevents path-probing attacks and can associate different HTLCs which
130
131
/// are part of the same payment.
131
132
payment_data:Option<msgs::FinalOnionHopData>,
133
+
cltv_expiry:u32,
132
134
}
133
135
134
136
/// Tracks the inbound corresponding to an outbound HTLC
0 commit comments