Skip to content

Commit bc8e688

Browse files
committed
Reduce hold time resolution
In the spec process, it was agreed to report hold time in multiples of 100 ms.
1 parent b5bfa85 commit bc8e688

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7123,7 +7123,9 @@ where
71237123
log_trace!(logger, " ...removing outbound AwaitingRemovedRemoteRevoke {}", &htlc.payment_hash);
71247124
if let OutboundHTLCOutcome::Failure(mut reason) = outcome.clone() { // We really want take() here, but, again, non-mut ref :(
71257125
if let (Some(timestamp), Some(now)) = (htlc.send_timestamp, now) {
7126-
let hold_time = u32::try_from(now.saturating_sub(timestamp).as_millis()).unwrap_or(u32::MAX);
7126+
const HOLD_TIME_GRANULARITY_MS: u128 = 100;
7127+
7128+
let hold_time = u32::try_from(now.saturating_sub(timestamp).as_millis() / HOLD_TIME_GRANULARITY_MS).unwrap_or(u32::MAX);
71277129
reason.set_hold_time(hold_time);
71287130
}
71297131

0 commit comments

Comments
 (0)