From 50bd576bb1a878d3eb6be961623601b418ca8676 Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Mon, 14 Oct 2024 16:57:10 -0400 Subject: [PATCH] hard_fork_info --- binaries/cuprated/src/rpc/json.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/binaries/cuprated/src/rpc/json.rs b/binaries/cuprated/src/rpc/json.rs index 0dc60aee..fe2b597f 100644 --- a/binaries/cuprated/src/rpc/json.rs +++ b/binaries/cuprated/src/rpc/json.rs @@ -380,20 +380,24 @@ async fn hard_fork_info( let hard_fork = if request.version > 0 { HardFork::from_version(request.version)? } else { - // blockchain::current_hard_fork(&mut state).await? - todo!() + blockchain_context::context(&mut state.blockchain_context) + .await? + .unchecked_blockchain_context() + .current_hf }; + let info = blockchain_context::hard_fork_info(&mut state.blockchain_context, hard_fork).await?; + Ok(HardForkInfoResponse { base: AccessResponseBase::ok(), - earliest_height: todo!(), - enabled: todo!("hard_fork.is_latest() is not always correct"), - state: todo!(), - threshold: todo!(), - version: hard_fork.as_u8(), - votes: todo!(), - voting: todo!(), - window: todo!(), + earliest_height: info.earliest_height, + enabled: info.enabled, + state: info.state, + threshold: info.threshold, + version: info.version, + votes: info.votes, + voting: info.voting, + window: info.window, }) }