Rustify core/src/core (#1122)
Small refactoring of one folder, if it makes sense I could extend the scope. * Remove some cloning (real and just verbosity in the code) * Naming conventions like to/into* * Some Clippy's suggestions I found that we don't use field init shorthand syntax, so I didn't touch this part, was it discussed before?
This commit is contained in:
+2
-2
@@ -30,8 +30,8 @@ use pipe;
|
||||
use store;
|
||||
use txhashset;
|
||||
use types::*;
|
||||
use util::secp::pedersen::{Commitment, RangeProof};
|
||||
use util::LOGGER;
|
||||
use util::secp::pedersen::{Commitment, RangeProof};
|
||||
|
||||
/// Orphan pool size is limited by MAX_ORPHAN_SIZE
|
||||
pub const MAX_ORPHAN_SIZE: usize = 200;
|
||||
@@ -260,7 +260,7 @@ impl Chain {
|
||||
debug!(
|
||||
LOGGER,
|
||||
"Chain init: {} @ {} [{}]",
|
||||
head.total_difficulty.into_num(),
|
||||
head.total_difficulty.to_num(),
|
||||
head.height,
|
||||
head.last_block_h,
|
||||
);
|
||||
|
||||
+3
-3
@@ -277,7 +277,7 @@ fn validate_header(header: &BlockHeader, ctx: &mut BlockContext) -> Result<(), E
|
||||
|
||||
let target_difficulty = header.total_difficulty.clone() - prev.total_difficulty.clone();
|
||||
|
||||
if header.pow.clone().to_difficulty() < target_difficulty {
|
||||
if header.pow.to_difficulty() < target_difficulty {
|
||||
return Err(Error::DifficultyTooLow);
|
||||
}
|
||||
|
||||
@@ -297,8 +297,8 @@ fn validate_header(header: &BlockHeader, ctx: &mut BlockContext) -> Result<(), E
|
||||
error!(
|
||||
LOGGER,
|
||||
"validate_header: BANNABLE OFFENCE: header cumulative difficulty {} != {}",
|
||||
target_difficulty.into_num(),
|
||||
prev.total_difficulty.into_num() + network_difficulty.into_num()
|
||||
target_difficulty.to_num(),
|
||||
prev.total_difficulty.to_num() + network_difficulty.to_num()
|
||||
);
|
||||
return Err(Error::WrongTotalDifficulty);
|
||||
}
|
||||
|
||||
@@ -930,7 +930,7 @@ impl<'a> Extension<'a> {
|
||||
if pmmr::is_leaf(n) {
|
||||
if let Some(out) = self.output_pmmr.get_data(n) {
|
||||
if let Some(rp) = self.rproof_pmmr.get_data(n) {
|
||||
out.to_output(rp).verify_proof()?;
|
||||
out.into_output(rp).verify_proof()?;
|
||||
} else {
|
||||
// TODO - rangeproof not found
|
||||
return Err(Error::OutputNotFound);
|
||||
|
||||
Reference in New Issue
Block a user