remove BlockchainReadRequest::Difficulty

This commit is contained in:
hinto.janai 2024-10-04 16:20:25 -04:00
parent 2228d4d741
commit d0888c8cf3
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
3 changed files with 2 additions and 38 deletions

View file

@ -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<u128, Error> {
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,

View file

@ -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!()))

View file

@ -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<OutputHistogramEntry>),