Skip to content

Commit

Permalink
Merge pull request #60 from Sovenok-Hacker/rewrite
Browse files Browse the repository at this point in the history
Some clippy fixes
  • Loading branch information
YeahNotSewerSide authored May 4, 2024
2 parents ddd1cf2 + da65bf4 commit df1a6b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
base64 = "0.22.0"
base64 = "0.22.1"
byteorder = "1.5.0"
colored = "2.1.0"
env_logger = "0.11.3"
Expand All @@ -15,7 +15,7 @@ hex = "0.4.3"
lazy_static = "1.4.0"
log = "0.4.21"
num-bigint = "0.4.4"
num-traits = "0.2.18"
num-traits = "0.2.19"
rsa = "0.9.6"
secp256k1 = { version = "0.29.0", features = ["rand-std"] }
sha2 = "0.10.8"
Expand Down
11 changes: 5 additions & 6 deletions src/blockchaintree.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
use std::{collections::HashMap, path::Path, sync::Arc};

use crate::{
block::{self, Block as _, BlockArc, TransactionBlock},
block::{self, Block as _, BlockArc},
chain,
errors::{BCTreeErrorKind, BlockChainTreeError, ChainErrorKind},
merkletree,
static_values::{
self, AMMOUNT_SUMMARY, BLOCKS_PER_EPOCH, COINS_PER_CYCLE, GAS_SUMMARY, MAIN_CHAIN_PAYMENT,
self, AMMOUNT_SUMMARY, BLOCKS_PER_EPOCH, COINS_PER_CYCLE, GAS_SUMMARY,
OLD_AMMOUNT_SUMMARY, OLD_GAS_SUMMARY, ROOT_PUBLIC_ADDRESS,
},
tools,
transaction::Transaction,
txpool,
types::Hash,
};
use error_stack::{Report, ResultExt};
Expand Down Expand Up @@ -89,7 +88,7 @@ impl BlockChainTree {
let derivative_chain =
chain::DerivativeChain::new(&hex::encode(owner), &last_block.hash().unwrap())?;
self.derivative_chains
.insert(owner.clone(), derivative_chain.clone());
.insert(*owner, derivative_chain.clone());
Ok(derivative_chain)
}

Expand Down Expand Up @@ -431,7 +430,7 @@ impl BlockChainTree {
};
let new_block: block::BlockArc =
if ((last_block.get_info().height + 1) % BLOCKS_PER_EPOCH).is_zero() {
if transactions.len() != 0 {
if !transactions.is_empty() {
return Err(BlockChainTreeError::BlockChainTree(
BCTreeErrorKind::SummarizeBlockWrongTransactionsAmount,
)
Expand All @@ -450,7 +449,7 @@ impl BlockChainTree {

summarize_block
} else {
if transactions.len() == 0 {
if transactions.is_empty() {
return Err(BlockChainTreeError::BlockChainTree(
BCTreeErrorKind::CreateMainChainBlock,
)
Expand Down
3 changes: 1 addition & 2 deletions src/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use std::convert::TryInto;
use std::fs::File;
use std::io::Read;
use std::io::Write;
use std::mem::transmute;
use std::path::Path;
use std::{fs, io};

Expand Down Expand Up @@ -239,7 +238,7 @@ pub fn recalculate_difficulty(prev_timestamp: u64, timestamp: u64, prev_difficul
pub fn recalculate_fee(current_difficulty: &Hash) -> U256 {
let leading_zeros = count_leading_zeros(current_difficulty);

FEE_STEP.clone() * leading_zeros
*FEE_STEP * leading_zeros
}

#[cfg(test)]
Expand Down

0 comments on commit df1a6b4

Please sign in to comment.