Skip to content

Commit 799d98b

Browse files
committed
Skip the 8th anchor when picking oldest
1 parent fbcfb83 commit 799d98b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

client/src/rpc.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ impl AsyncChainState {
12371237
///
12381238
/// This function finds a suitable historical snapshot that:
12391239
/// 1. Is not older than when the space was last updated.
1240-
/// 2. Falls within [ROOT_ANCHORS_COUNT] range (for proof verification)
1240+
/// 2. Falls within [ROOT_ANCHORS_COUNT] range
12411241
/// 3. Skips the oldest trust anchors to prevent the proof from becoming stale too quickly.
12421242
///
12431243
/// Parameters:
@@ -1256,7 +1256,7 @@ impl AsyncChainState {
12561256
* COMMIT_BLOCK_INTERVAL;
12571257

12581258
// Calculate the oldest allowed snapshot while maintaining safety margin
1259-
let lookback_window = USABLE_ANCHORS * COMMIT_BLOCK_INTERVAL;
1259+
let lookback_window = (USABLE_ANCHORS - 1) * COMMIT_BLOCK_INTERVAL;
12601260
let oldest_allowed_snapshot = current_tip_aligned.saturating_sub(lookback_window);
12611261

12621262
// Choose the most recent of last update or oldest allowed snapshot
@@ -1294,6 +1294,7 @@ impl AsyncChainState {
12941294
};
12951295

12961296
let root = proof.compute_root()?.to_vec();
1297+
info!("Proving with root anchor {}", hex::encode(root.as_slice()));
12971298
let mut buf = vec![0u8; 4096];
12981299
let offset = proof.write_to_slice(&mut buf)?;
12991300
buf.truncate(offset);

0 commit comments

Comments
 (0)