Removed Copy trait from H256

This commit is contained in:
arkpar
2016-01-04 13:25:32 +01:00
parent b925df2cd9
commit 8d37ef7d8e
4 changed files with 27 additions and 26 deletions

View File

@@ -257,7 +257,7 @@ impl ChainSync {
BlockStatus::InChain => {
self.have_common_block = true;
self.last_imported_block = number;
self.last_imported_hash = hash;
self.last_imported_hash = hash.clone();
trace!(target: "sync", "Found common header {} ({})", number, hash);
},
_ => {
@@ -283,7 +283,7 @@ impl ChainSync {
}
let hdr = Header {
data: r.at(i).raw().to_vec(),
hash: hash,
hash: hash.clone(),
parent: info.parent_hash(),
};
self.headers.insert_item(number, hdr);
@@ -597,17 +597,17 @@ impl ChainSync {
ImportResult::AlreadyInChain => {
trace!(target: "sync", "Block already in chain {:?}", h);
self.last_imported_block = headers.0 + i as BlockNumber;
self.last_imported_hash = *h;
self.last_imported_hash = h.clone();
},
ImportResult::AlreadyQueued(_) => {
trace!(target: "sync", "Block already queued {:?}", h);
self.last_imported_block = headers.0 + i as BlockNumber;
self.last_imported_hash = *h;
self.last_imported_hash = h.clone();
},
ImportResult::Queued(QueueStatus::Known) => {
trace!(target: "sync", "Block queued {:?}", h);
self.last_imported_block = headers.0 + i as BlockNumber;
self.last_imported_hash = *h;
self.last_imported_hash = h.clone();
imported += 1;
},
ImportResult::Queued(QueueStatus::Unknown) => {

View File

@@ -5,7 +5,8 @@ use util::uint::{U256};
use util::sha3::Hashable;
use util::rlp::{self, Rlp, RlpStream, View, Stream};
use util::network::{PeerId, PacketId, Error as NetworkError};
use eth::{BlockChainClient, BlockStatus, BlockNumber, TreeRoute, BlockQueueStatus, BlockChainInfo, ImportResult, BlockHeader, QueueStatus};
use eth::{BlockChainClient, BlockStatus, BlockNumber, TreeRoute, BlockQueueStatus, BlockChainInfo, ImportResult, QueueStatus};
use header::Header as BlockHeader;
use sync::{SyncIo};
use sync::chain::{ChainSync};
@@ -28,7 +29,7 @@ impl TestBlockChainClient {
difficulty: From::from(0),
};
client.add_blocks(1, true); // add genesis block
client.genesis_hash = client.last_hash;
client.genesis_hash = client.last_hash.clone();
client
}
@@ -36,7 +37,7 @@ impl TestBlockChainClient {
for n in self.numbers.len()..(self.numbers.len() + count) {
let mut header = BlockHeader::new();
header.difficulty = From::from(n);
header.parent_hash = self.last_hash;
header.parent_hash = self.last_hash.clone();
header.number = From::from(n);
let mut uncles = RlpStream::new_list(if empty {0} else {1});
if !empty {
@@ -142,7 +143,7 @@ impl BlockChainClient for TestBlockChainClient {
if number > 0 {
let mut n = number - 1;
while n > 0 && self.numbers[&n] != parent_hash {
*self.numbers.get_mut(&n).unwrap() = parent_hash;
*self.numbers.get_mut(&n).unwrap() = parent_hash.clone();
n -= 1;
parent_hash = Rlp::new(&self.blocks[&parent_hash]).val_at::<BlockHeader>(0).parent_hash;
}
@@ -167,8 +168,8 @@ impl BlockChainClient for TestBlockChainClient {
BlockChainInfo {
total_difficulty: self.difficulty,
pending_total_difficulty: self.difficulty,
genesis_hash: self.genesis_hash,
last_block_hash: self.last_hash,
genesis_hash: self.genesis_hash.clone(),
last_block_hash: self.last_hash.clone(),
last_block_number: self.blocks.len() as BlockNumber - 1,
}
}