Skip to content

Commit 6be1634

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 6be1634

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
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

lightning/src/ln/onion_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ where
12231223
logger,
12241224
"Htlc hold time at pos {}: {} ms",
12251225
route_hop_idx,
1226-
hold_time
1226+
hold_time * 100
12271227
);
12281228

12291229
// Shift attribution data to prepare for processing the next hop.

0 commit comments

Comments
 (0)