Skip to content

Commit 895f2a0

Browse files
committed
mtc_worker: Replace landmark subtree intervals with tree sizes
1 parent 469dec2 commit 895f2a0

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

crates/mtc_api/src/landmark.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use tlog_tiles::Subtree;
44

55
#[derive(Debug, PartialEq, Clone)]
66
pub struct LandmarkSequence {
7-
max_landmarks: usize,
8-
last_landmark: usize,
9-
landmarks: VecDeque<u64>,
7+
pub max_landmarks: usize,
8+
pub last_landmark: usize,
9+
pub landmarks: VecDeque<u64>,
1010
}
1111

1212
/// The location in object storage for the landmark bundle.

crates/mtc_worker/src/frontend_worker.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use mtc_api::{
2525
use serde::{Deserialize, Serialize};
2626
use serde_with::{base64::Base64, serde_as};
2727
use signed_note::VerifierList;
28-
use std::time::Duration;
28+
use std::{collections::VecDeque, time::Duration};
2929
use tlog_tiles::{
3030
open_checkpoint, CheckpointSigner, CheckpointText, LeafIndex, PendingLogEntry,
3131
PendingLogEntryBlob,
@@ -74,17 +74,16 @@ pub struct GetCertificateResponse {
7474

7575
/// GET response structure for the `/get-landmark-bundle` endpoint
7676
#[serde_as]
77-
#[derive(Serialize, Deserialize)]
77+
#[derive(Serialize)]
7878
pub struct GetLandmarkBundleResponse<'a> {
7979
pub checkpoint: &'a str,
8080
pub subtrees: Vec<SubtreeWithConsistencyProof>,
81+
pub landmarks: &'a VecDeque<u64>,
8182
}
8283

8384
#[serde_as]
8485
#[derive(Serialize, Deserialize)]
8586
pub struct SubtreeWithConsistencyProof {
86-
pub start: u64,
87-
pub end: u64,
8887
#[serde_as(as = "Base64")]
8988
pub hash: [u8; 32],
9089
#[serde_as(as = "Vec<Base64>")]
@@ -438,8 +437,6 @@ async fn get_landmark_bundle(env: &Env, name: &str) -> Result<Response> {
438437
};
439438

440439
subtrees.push(SubtreeWithConsistencyProof {
441-
start: landmark_subtree.lo(),
442-
end: landmark_subtree.hi(),
443440
hash: landmark_subtree_hash.0,
444441
consistency_proof: consistency_proof.iter().map(|h| h.0).collect(),
445442
});
@@ -448,6 +445,7 @@ async fn get_landmark_bundle(env: &Env, name: &str) -> Result<Response> {
448445
Response::from_json(&GetLandmarkBundleResponse {
449446
checkpoint: std::str::from_utf8(&checkpoint_bytes).unwrap(),
450447
subtrees,
448+
landmarks: &landmark_sequence.landmarks,
451449
})
452450
}
453451

0 commit comments

Comments
 (0)