From 30f24a39d0cd26237fcf67ddd485f7d48baabb2d Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Fri, 7 Jun 2019 13:12:07 +0000 Subject: [PATCH] Remove confusing mentions of SPV --- src/blockdata/block.rs | 6 +++--- src/util/mod.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/blockdata/block.rs b/src/blockdata/block.rs index 064e5ae7..ee4e440d 100644 --- a/src/blockdata/block.rs +++ b/src/blockdata/block.rs @@ -23,7 +23,7 @@ use bitcoin_hashes::{sha256d, Hash}; use util; -use util::Error::{SpvBadTarget, SpvBadProofOfWork}; +use util::Error::{BlockBadTarget, BlockBadProofOfWork}; use util::hash::{BitcoinHash, MerkleRoot, bitcoin_merkle_root}; use util::uint::Uint256; use consensus::encode::Encodable; @@ -169,13 +169,13 @@ impl BlockHeader { let target = &self.target(); if target != required_target { - return Err(SpvBadTarget); + return Err(BlockBadTarget); } let data: [u8; 32] = self.bitcoin_hash().into_inner(); let mut ret = [0u64; 4]; LittleEndian::read_u64_into(&data, &mut ret); let hash = &Uint256(ret); - if hash <= target { Ok(()) } else { Err(SpvBadProofOfWork) } + if hash <= target { Ok(()) } else { Err(BlockBadProofOfWork) } } /// Returns the total work of the block diff --git a/src/util/mod.rs b/src/util/mod.rs index 598bf905..c69f30b1 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -64,9 +64,9 @@ pub enum Error { /// Network error Network(network::Error), /// The header hash is not below the target - SpvBadProofOfWork, + BlockBadProofOfWork, /// The `target` field of a block header did not match the expected difficulty - SpvBadTarget, + BlockBadTarget, } impl fmt::Display for Error { @@ -74,7 +74,7 @@ impl fmt::Display for Error { match *self { Error::Encode(ref e) => fmt::Display::fmt(e, f), Error::Network(ref e) => fmt::Display::fmt(e, f), - Error::SpvBadProofOfWork | Error::SpvBadTarget => f.write_str(error::Error::description(self)), + Error::BlockBadProofOfWork | Error::BlockBadTarget => f.write_str(error::Error::description(self)), } } } @@ -84,7 +84,7 @@ impl error::Error for Error { match *self { Error::Encode(ref e) => Some(e), Error::Network(ref e) => Some(e), - Error::SpvBadProofOfWork | Error::SpvBadTarget => None + Error::BlockBadProofOfWork | Error::BlockBadTarget => None } } @@ -92,8 +92,8 @@ impl error::Error for Error { match *self { Error::Encode(ref e) => e.description(), Error::Network(ref e) => e.description(), - Error::SpvBadProofOfWork => "target correct but not attained", - Error::SpvBadTarget => "target incorrect", + Error::BlockBadProofOfWork => "block target correct but not attained", + Error::BlockBadTarget => "block target incorrect", } } }