From 9374d08a07b0f58aa7251f42268a62f8d22fd7fe Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Wed, 13 Nov 2024 17:44:45 -0500 Subject: [PATCH] fix `sync_info` --- binaries/cuprated/src/rpc/json.rs | 25 ++++++++++--------- .../src/rpc/request/blockchain_manager.rs | 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/binaries/cuprated/src/rpc/json.rs b/binaries/cuprated/src/rpc/json.rs index ecb60b85..07b96a62 100644 --- a/binaries/cuprated/src/rpc/json.rs +++ b/binaries/cuprated/src/rpc/json.rs @@ -58,6 +58,8 @@ use crate::{ statics::START_INSTANT_UNIX, }; +use super::constants::FIELD_NOT_SUPPORTED; + /// Map a [`JsonRpcRequest`] to the function that will lead to a [`JsonRpcResponse`]. pub(super) async fn map_request( state: CupratedRpcHandler, @@ -715,7 +717,7 @@ async fn get_version( let mut hard_forks = Vec::with_capacity(HardFork::COUNT); - // FIXME: use an iterator `collect()` version. + // FIXME: use an async iterator `collect()` version. for hf in HardFork::VARIANTS { if let Ok(hf) = blockchain_context::hard_fork_info(&mut state.blockchain_context, *hf).await { @@ -822,16 +824,15 @@ async fn sync_info( .map(|info| SyncInfoPeer { info }) .collect(); - // TODO - // let next_needed_pruning_seed = - // address_book::next_needed_pruning_seed::(&mut DummyAddressBook) - // .await? - // .compress(); - // let overview = blockchain_manager::overview(&mut state.blockchain_manager, height).await?; - // let spans = address_book::spans::(&mut DummyAddressBook).await?; - let next_needed_pruning_seed = todo!(); - let overview = todo!(); - let spans = todo!(); + let next_needed_pruning_seed = + blockchain_manager::next_needed_pruning_seed(&mut state.blockchain_manager) + .await? + .compress(); + + let spans = blockchain_manager::spans::(&mut state.blockchain_manager).await?; + + // + let overview = String::from(FIELD_NOT_SUPPORTED); Ok(SyncInfoResponse { base: AccessResponseBase::OK, @@ -1009,7 +1010,7 @@ async fn get_tx_ids_loose( request: GetTxIdsLooseRequest, ) -> Result { // TODO: this RPC call is not yet in the v0.18 branch. - return Err(anyhow!("not implemented")); + return Err(anyhow!("Not implemented")); Ok(GetTxIdsLooseResponse { base: ResponseBase::OK, diff --git a/binaries/cuprated/src/rpc/request/blockchain_manager.rs b/binaries/cuprated/src/rpc/request/blockchain_manager.rs index 4b591214..ed72284a 100644 --- a/binaries/cuprated/src/rpc/request/blockchain_manager.rs +++ b/binaries/cuprated/src/rpc/request/blockchain_manager.rs @@ -183,7 +183,8 @@ pub(crate) async fn spans( // unreachable!(); // }; - let vec: Vec> = todo!(); + let vec: Vec> = + todo!("waiting on blockchain downloader/syncer: "); // FIXME: impl this map somewhere instead of inline. let vec = vec