@@ -32,7 +32,7 @@ use ln::chan_utils::{CounterpartyCommitmentSecrets, TxCreationKeys, HTLCOutputIn
32
32
use ln:: chan_utils;
33
33
use chain:: BestBlock ;
34
34
use chain:: chaininterface:: { FeeEstimator , ConfirmationTarget } ;
35
- use chain:: channelmonitor:: { ChannelMonitor , ChannelMonitorUpdate , ChannelMonitorUpdateStep , HTLC_FAIL_BACK_BUFFER } ;
35
+ use chain:: channelmonitor:: { ChannelMonitor , ChannelMonitorUpdate , ChannelMonitorUpdateStep , LATENCY_GRACE_PERIOD_BLOCKS } ;
36
36
use chain:: transaction:: { OutPoint , TransactionData } ;
37
37
use chain:: keysinterface:: { Sign , KeysInterface } ;
38
38
use util:: ser:: { Readable , ReadableArgs , Writeable , Writer , VecWriter } ;
@@ -4107,7 +4107,10 @@ impl<Signer: Sign> Channel<Signer> {
4107
4107
pub fn best_block_updated < L : Deref > ( & mut self , height : u32 , highest_header_time : u32 , logger : & L )
4108
4108
-> Result < ( Option < msgs:: FundingLocked > , Vec < ( HTLCSource , PaymentHash ) > ) , msgs:: ErrorMessage > where L :: Target : Logger {
4109
4109
let mut timed_out_htlcs = Vec :: new ( ) ;
4110
- let unforwarded_htlc_cltv_limit = height + HTLC_FAIL_BACK_BUFFER ;
4110
+ // This mirrors the check in ChannelManager::decode_update_add_htlc_onion, refusing to
4111
+ // forward an HTLC when our counterparty should almost certainly just fail it for expiring
4112
+ // ~now.
4113
+ let unforwarded_htlc_cltv_limit = height + LATENCY_GRACE_PERIOD_BLOCKS ;
4111
4114
self . holding_cell_htlc_updates . retain ( |htlc_update| {
4112
4115
match htlc_update {
4113
4116
& HTLCUpdateAwaitingACK :: AddHTLC { ref payment_hash, ref source, ref cltv_expiry, .. } => {
0 commit comments