mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-01-13 06:14:33 +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 = [
|
dependencies = [
|
||||||
"cuprate-epee-encoding",
|
"cuprate-epee-encoding",
|
||||||
"cuprate-fixed-bytes",
|
"cuprate-fixed-bytes",
|
||||||
|
"cuprate-helper",
|
||||||
"cuprate-test-utils",
|
"cuprate-test-utils",
|
||||||
"cuprate-types",
|
"cuprate-types",
|
||||||
|
"hex",
|
||||||
"paste",
|
"paste",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
|
@ -5,7 +5,10 @@ use futures::StreamExt;
|
||||||
use tower::{Service, ServiceExt};
|
use tower::{Service, ServiceExt};
|
||||||
|
|
||||||
use cuprate_consensus::BlockchainResponse;
|
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::{
|
use cuprate_rpc_types::{
|
||||||
base::{AccessResponseBase, ResponseBase},
|
base::{AccessResponseBase, ResponseBase},
|
||||||
json::{
|
json::{
|
||||||
|
@ -180,38 +183,15 @@ async fn get_block_header_by_hash(
|
||||||
|
|
||||||
let ready = state.blockchain.ready().await.expect("TODO");
|
let ready = state.blockchain.ready().await.expect("TODO");
|
||||||
|
|
||||||
let BlockchainResponse::BlockExtendedHeaderByHash(header) = ready
|
let BlockchainResponse::BlockByHash(block) = ready
|
||||||
.call(BlockchainReadRequest::BlockExtendedHeaderByHash(hash))
|
.call(BlockchainReadRequest::BlockByHash(hash))
|
||||||
.await
|
.await
|
||||||
.expect("TODO")
|
.expect("TODO")
|
||||||
else {
|
else {
|
||||||
unreachable!();
|
unreachable!();
|
||||||
};
|
};
|
||||||
|
|
||||||
let block_header = BlockHeader {
|
let block_header = BlockHeader::from(&block);
|
||||||
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!(),
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(block_header)
|
Ok(block_header)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue