script/evgrd: fetch successors of requested tips

This commit is contained in:
dasman
2024-09-10 17:35:09 +03:00
parent 04063b3bb7
commit 15c02253a8
2 changed files with 6 additions and 10 deletions

View File

@@ -202,19 +202,15 @@ async fn handle_connect(
let fetchevs = FetchEventsMessage::decode_async(&mut stream).await?;
info!(target: "evgrd", "Fetching events {fetchevs:?}");
// Now do your thing with the daemon and get missing tips
let events = daemon.event_graph.fetch_successors_of(fetchevs.unref_tips).await?;
// Then send them like this:
// for ev in evs {
// MSG_EVENT.encode_async(&mut stream).await?;
// ev.encode_async(&mut stream).await?;
// }
for event in events {
MSG_EVENT.encode_async(&mut stream).await?;
event.encode_async(&mut stream).await?;
}
}
}
}
Ok(())
}
async_daemonize!(realmain);

View File

@@ -47,7 +47,7 @@ impl VersionMessage {
#[derive(Debug, Clone, SerialEncodable, SerialDecodable)]
pub struct FetchEventsMessage {
unref_tips: Vec<(u64, blake3::Hash)>,
pub unref_tips: Vec<(u64, blake3::Hash)>,
}
impl FetchEventsMessage {