suppress trait that is not used so far

This commit is contained in:
NikVolf 2016-11-21 16:08:40 +03:00
parent 7cf8d09444
commit 8e975669c0
8 changed files with 14 additions and 15 deletions

View File

@ -41,9 +41,7 @@ impl From<&'static str> for Block {
} }
impl RepresentH256 for Block { impl RepresentH256 for Block {
fn hash(&self) -> H256 { fn h256(&self) -> H256 { self.hash() }
self.block_header.hash()
}
} }
impl Block { impl Block {
@ -68,13 +66,16 @@ impl Block {
pub fn drain(self) -> (BlockHeader, Vec<Transaction>) { pub fn drain(self) -> (BlockHeader, Vec<Transaction>) {
(self.block_header, self.transactions) (self.block_header, self.transactions)
} }
pub fn hash(&self) -> H256 {
self.block_header.hash()
}
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use hash::H256; use hash::H256;
use super::Block; use super::Block;
use super::super::RepresentH256;
// Block 80000 // Block 80000
// https://blockchain.info/rawblock/000000000043a8c0fd1d6f726790caa2a406010d19efd2780db27bdbbd93baf6 // https://blockchain.info/rawblock/000000000043a8c0fd1d6f726790caa2a406010d19efd2780db27bdbbd93baf6

View File

@ -10,7 +10,7 @@ mod merkle_root;
mod transaction; mod transaction;
pub trait RepresentH256 { pub trait RepresentH256 {
fn hash(&self) -> primitives::hash::H256; fn h256(&self) -> primitives::hash::H256;
} }
pub use rustc_serialize::hex; pub use rustc_serialize::hex;

View File

@ -8,7 +8,7 @@ use primitives::hash::H256;
use primitives::bytes::Bytes; use primitives::bytes::Bytes;
use super::{BlockRef, BestBlock, BlockLocation}; use super::{BlockRef, BestBlock, BlockLocation};
use serialization::{serialize, deserialize}; use serialization::{serialize, deserialize};
use chain::{self, RepresentH256}; use chain;
use parking_lot::RwLock; use parking_lot::RwLock;
use transaction_meta::TransactionMeta; use transaction_meta::TransactionMeta;
@ -610,7 +610,7 @@ mod tests {
use super::{Storage, Store}; use super::{Storage, Store};
use devtools::RandomTempPath; use devtools::RandomTempPath;
use chain::{Block, RepresentH256}; use chain::Block;
use super::super::{BlockRef, BlockLocation}; use super::super::{BlockRef, BlockLocation};
use test_data; use test_data;

View File

@ -4,7 +4,7 @@ use super::{
BlockRef, Store, Error, BestBlock, BlockLocation, BlockInsertedChain, BlockProvider, BlockRef, Store, Error, BestBlock, BlockLocation, BlockInsertedChain, BlockProvider,
BlockStapler, TransactionMetaProvider, TransactionProvider, BlockStapler, TransactionMetaProvider, TransactionProvider,
}; };
use chain::{self, Block, RepresentH256}; use chain::{self, Block};
use primitives::hash::H256; use primitives::hash::H256;
use serialization; use serialization;
use chain::bytes::Bytes; use chain::bytes::Bytes;

View File

@ -103,7 +103,7 @@ impl OrphanBlocksPool {
} }
orphans.is_empty() orphans.is_empty()
}; };
if remove_entry { if remove_entry {
orphan_entry.remove_entry(); orphan_entry.remove_entry();
} }
@ -124,7 +124,6 @@ mod tests {
use std::collections::HashSet; use std::collections::HashSet;
use test_data; use test_data;
use primitives::hash::H256; use primitives::hash::H256;
use chain::RepresentH256;
use super::OrphanBlocksPool; use super::OrphanBlocksPool;
#[test] #[test]

View File

@ -1,7 +1,7 @@
//! Block builder //! Block builder
use super::genesis; use super::genesis;
use chain::{self, RepresentH256}; use chain;
use primitives::hash::H256; use primitives::hash::H256;
use primitives::bytes::Bytes; use primitives::bytes::Bytes;
use invoke::{Invoke, Identity}; use invoke::{Invoke, Identity};

View File

@ -1,7 +1,7 @@
//! Bitcoin chain verifier //! Bitcoin chain verifier
use db::{self, BlockRef, BlockLocation}; use db::{self, BlockRef, BlockLocation};
use chain::{self, RepresentH256}; use chain;
use super::{Verify, VerificationResult, Chain, Error, TransactionError, ContinueVerify}; use super::{Verify, VerificationResult, Chain, Error, TransactionError, ContinueVerify};
use utils; use utils;
@ -277,7 +277,6 @@ mod tests {
use test_data; use test_data;
use std::sync::Arc; use std::sync::Arc;
use devtools::RandomTempPath; use devtools::RandomTempPath;
use chain::RepresentH256;
use script; use script;
#[test] #[test]

View File

@ -1,6 +1,6 @@
//! Blocks verification queue //! Blocks verification queue
use chain::{Block, RepresentH256}; use chain::Block;
use primitives::hash::H256; use primitives::hash::H256;
use super::{Chain, ContinueVerify, BlockStatus, Error as VerificationError, TransactionError}; use super::{Chain, ContinueVerify, BlockStatus, Error as VerificationError, TransactionError};
use linked_hash_map::LinkedHashMap; use linked_hash_map::LinkedHashMap;
@ -204,7 +204,7 @@ impl Queue {
mod tests { mod tests {
use super::Queue; use super::Queue;
use super::super::{BlockStatus, VerificationResult, Verify, ContinueVerify, Chain, Error as VerificationError, TransactionError}; use super::super::{BlockStatus, VerificationResult, Verify, ContinueVerify, Chain, Error as VerificationError, TransactionError};
use chain::{Block, RepresentH256}; use chain::Block;
use primitives::hash::H256; use primitives::hash::H256;
use test_data; use test_data;
use std::collections::HashMap; use std::collections::HashMap;