few more simplifications

This commit is contained in:
debris 2016-11-25 02:07:46 +01:00
parent 3143ff75d0
commit e167b3350a
2 changed files with 3 additions and 3 deletions

View File

@ -56,7 +56,7 @@ impl ChainVerifier {
fn ordered_verify(&self, block: &chain::Block, at_height: u32) -> Result<(), Error> {
// check that difficulty matches the adjusted level
if let Some(work) = self.work_required(block, at_height) {
if let Some(work) = self.work_required(at_height) {
if !self.skip_pow && work != block.header().nbits {
trace!(target: "verification", "pow verification error at height: {}", at_height);
trace!(target: "verification", "expected work: {}, got {}", work, block.header().nbits);
@ -295,7 +295,7 @@ impl ChainVerifier {
Some(timestamps[timestamps.len() / 2])
}
fn work_required(&self, block: &chain::Block, height: u32) -> Option<u32> {
fn work_required(&self, height: u32) -> Option<u32> {
if height == 0 {
return None;
}

View File

@ -27,7 +27,7 @@ impl Compact {
let mut word = self.0 & 0x007fffff;
let result = if size <= 3 {
word >>= (8 * (3 - size as usize));
word >>= 8 * (3 - size as usize);
word.into()
} else {
U256::from(word) << (8 * (size as usize - 3))