mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-12-25 13:09:41 +00:00
cuprated: use From
when mapping types
This commit is contained in:
parent
d1cff90660
commit
6c7b5be94e
2 changed files with 9 additions and 27 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -827,8 +827,10 @@ version = "0.0.0"
|
|||
dependencies = [
|
||||
"cuprate-epee-encoding",
|
||||
"cuprate-fixed-bytes",
|
||||
"cuprate-helper",
|
||||
"cuprate-test-utils",
|
||||
"cuprate-types",
|
||||
"hex",
|
||||
"paste",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
|
@ -5,7 +5,10 @@ use futures::StreamExt;
|
|||
use tower::{Service, ServiceExt};
|
||||
|
||||
use cuprate_consensus::BlockchainResponse;
|
||||
use cuprate_helper::cast::{u64_to_usize, usize_to_u64};
|
||||
use cuprate_helper::{
|
||||
cast::{u64_to_usize, usize_to_u64},
|
||||
map::split_u128_into_low_high_bits,
|
||||
};
|
||||
use cuprate_rpc_types::{
|
||||
base::{AccessResponseBase, ResponseBase},
|
||||
json::{
|
||||
|
@ -180,38 +183,15 @@ async fn get_block_header_by_hash(
|
|||
|
||||
let ready = state.blockchain.ready().await.expect("TODO");
|
||||
|
||||
let BlockchainResponse::BlockExtendedHeaderByHash(header) = ready
|
||||
.call(BlockchainReadRequest::BlockExtendedHeaderByHash(hash))
|
||||
let BlockchainResponse::BlockByHash(block) = ready
|
||||
.call(BlockchainReadRequest::BlockByHash(hash))
|
||||
.await
|
||||
.expect("TODO")
|
||||
else {
|
||||
unreachable!();
|
||||
};
|
||||
|
||||
let block_header = BlockHeader {
|
||||
block_size: todo!(),
|
||||
block_weight: todo!(),
|
||||
cumulative_difficulty_top64: todo!(),
|
||||
cumulative_difficulty: todo!(),
|
||||
depth: todo!(),
|
||||
difficulty_top64: todo!(),
|
||||
difficulty: todo!(),
|
||||
hash: todo!(),
|
||||
height: todo!(),
|
||||
long_term_weight: todo!(),
|
||||
major_version: todo!(),
|
||||
miner_tx_hash: todo!(),
|
||||
minor_version: todo!(),
|
||||
nonce: todo!(),
|
||||
num_txes: todo!(),
|
||||
orphan_status: todo!(),
|
||||
pow_hash: todo!(),
|
||||
prev_hash: todo!(),
|
||||
reward: todo!(),
|
||||
timestamp: todo!(),
|
||||
wide_cumulative_difficulty: todo!(),
|
||||
wide_difficulty: todo!(),
|
||||
};
|
||||
let block_header = BlockHeader::from(&block);
|
||||
|
||||
Ok(block_header)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue