From d0888c8cf32059632fb56d5cb83045a5be0c1472 Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Fri, 4 Oct 2024 16:20:25 -0400 Subject: [PATCH] remove `BlockchainReadRequest::Difficulty` --- .../cuprated/src/rpc/request/blockchain.rs | 19 ------------------- storage/blockchain/src/service/read.rs | 6 ------ types/src/blockchain.rs | 15 ++------------- 3 files changed, 2 insertions(+), 38 deletions(-) diff --git a/binaries/cuprated/src/rpc/request/blockchain.rs b/binaries/cuprated/src/rpc/request/blockchain.rs index 4324fdc..c4016c9 100644 --- a/binaries/cuprated/src/rpc/request/blockchain.rs +++ b/binaries/cuprated/src/rpc/request/blockchain.rs @@ -269,25 +269,6 @@ pub(super) async fn database_size( Ok((database_size, free_space)) } -/// [`BlockchainReadRequest::Difficulty`] -pub(super) async fn difficulty( - mut blockchain_read: BlockchainReadHandle, - block_height: u64, -) -> Result { - let BlockchainResponse::Difficulty(difficulty) = blockchain_read - .ready() - .await? - .call(BlockchainReadRequest::Difficulty(u64_to_usize( - block_height, - ))) - .await? - else { - unreachable!(); - }; - - Ok(difficulty) -} - /// [`BlockchainReadRequest::OutputHistogram`] pub(super) async fn output_histogram( mut blockchain_read: BlockchainReadHandle, diff --git a/storage/blockchain/src/service/read.rs b/storage/blockchain/src/service/read.rs index 05af6ca..1530bd4 100644 --- a/storage/blockchain/src/service/read.rs +++ b/storage/blockchain/src/service/read.rs @@ -119,7 +119,6 @@ fn map_request( R::BlockByHash(hash) => block_by_hash(env, hash), R::TotalTxCount => total_tx_count(env), R::DatabaseSize => database_size(env), - R::Difficulty(height) => difficulty(env, height), R::OutputHistogram(input) => output_histogram(env, input), R::CoinbaseTxSum { height, count } => coinbase_tx_sum(env, height, count), R::MinerData => miner_data(env), @@ -641,11 +640,6 @@ fn database_size(env: &ConcreteEnv) -> ResponseResult { }) } -/// [`BlockchainReadRequest::Difficulty()`] -fn difficulty(env: &ConcreteEnv, block_height: BlockHeight) -> ResponseResult { - Ok(BlockchainResponse::Difficulty(todo!())) -} - /// [`BlockchainReadRequest::OutputHistogram`] fn output_histogram(env: &ConcreteEnv, input: OutputHistogramInput) -> ResponseResult { Ok(BlockchainResponse::OutputHistogram(todo!())) diff --git a/types/src/blockchain.rs b/types/src/blockchain.rs index e29ba30..8913657 100644 --- a/types/src/blockchain.rs +++ b/types/src/blockchain.rs @@ -108,9 +108,7 @@ pub enum BlockchainReadRequest { AltBlocksInChain(ChainId), /// Get a [`Block`] by its height. - Block { - height: usize, - }, + Block { height: usize }, /// Get a [`Block`] by its hash. BlockByHash([u8; 32]), @@ -121,9 +119,6 @@ pub enum BlockchainReadRequest { /// Get the current size of the database. DatabaseSize, - // Get the difficulty for the next block in the chain. - Difficulty(usize), - /// Get an output histogram. /// /// TODO: document fields after impl. @@ -133,10 +128,7 @@ pub enum BlockchainReadRequest { /// `N` last blocks starting at particular height. /// /// TODO: document fields after impl. - CoinbaseTxSum { - height: usize, - count: u64, - }, + CoinbaseTxSum { height: usize, count: u64 }, /// Get the necessary data to create a custom block template. MinerData, @@ -282,9 +274,6 @@ pub enum BlockchainResponse { free_space: u64, }, - /// Response to [`BlockchainReadRequest::Difficulty`]. - Difficulty(u128), - /// Response to [`BlockchainReadRequest::OutputHistogram`]. OutputHistogram(Vec),