Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/iota-network/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ fn build_anemo_services(out_dir: &Path) {
.codec_path(codec_path)
.build(),
)
.method(
anemo_build::manual::Method::builder()
.name("push_state_sync_handshake")
.route_name("PushStateSyncHandshake")
.request_type("crate::state_sync::StateSyncHandshake")
.response_type("()")
.codec_path(codec_path)
.build(),
)
.build();

let randomness = anemo_build::manual::Service::builder()
Expand Down
12 changes: 12 additions & 0 deletions crates/iota-network/src/state_sync/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,17 @@ where
.pipe(RwLock::new)
.pipe(Arc::new);

let genesis_checkpoint = Arc::new(
store
.get_checkpoint_by_sequence_number(0)
.expect("store should contain genesis checkpoint before building state sync"),
);

let server = Server {
store: store.clone(),
peer_heights: peer_heights.clone(),
sender: weak_sender,
genesis_checkpoint: genesis_checkpoint.clone(),
};

(
Expand All @@ -168,6 +175,7 @@ where
checkpoint_event_sender,
metrics,
archive_readers,
genesis_checkpoint,
},
server,
)
Expand All @@ -184,6 +192,8 @@ pub struct UnstartedStateSync<S> {
pub(super) checkpoint_event_sender: broadcast::Sender<VerifiedCheckpoint>,
pub(super) metrics: Metrics,
pub(super) archive_readers: ArchiveReaderBalancer,
/// Cached genesis checkpoint, shared with the RPC server.
pub(super) genesis_checkpoint: Arc<VerifiedCheckpoint>,
}

impl<S> UnstartedStateSync<S>
Expand All @@ -201,6 +211,7 @@ where
checkpoint_event_sender,
metrics,
archive_readers,
genesis_checkpoint,
} = self;

(
Expand All @@ -219,6 +230,7 @@ where
metrics,
archive_readers,
sync_checkpoint_from_archive_task: None,
genesis_checkpoint,
},
handle,
)
Expand Down
Loading
Loading