Merge pull request #1340 from ethcore/sync
Fixed empty block body composition
This commit is contained in:
commit
e97f62e33c
@ -187,7 +187,7 @@ impl TestBlockChainClient {
|
|||||||
txs.append(&signed_tx);
|
txs.append(&signed_tx);
|
||||||
txs.out()
|
txs.out()
|
||||||
},
|
},
|
||||||
_ => rlp::NULL_RLP.to_vec()
|
_ => rlp::EMPTY_LIST_RLP.to_vec()
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut rlp = RlpStream::new_list(3);
|
let mut rlp = RlpStream::new_list(3);
|
||||||
|
@ -265,7 +265,7 @@ impl BlockCollection {
|
|||||||
if header_id.transactions_root == rlp::SHA3_NULL_RLP && header_id.uncles == rlp::SHA3_EMPTY_LIST_RLP {
|
if header_id.transactions_root == rlp::SHA3_NULL_RLP && header_id.uncles == rlp::SHA3_EMPTY_LIST_RLP {
|
||||||
// empty body, just mark as downloaded
|
// empty body, just mark as downloaded
|
||||||
let mut body_stream = RlpStream::new_list(2);
|
let mut body_stream = RlpStream::new_list(2);
|
||||||
body_stream.append_raw(&rlp::NULL_RLP, 1);
|
body_stream.append_raw(&rlp::EMPTY_LIST_RLP, 1);
|
||||||
body_stream.append_raw(&rlp::EMPTY_LIST_RLP, 1);
|
body_stream.append_raw(&rlp::EMPTY_LIST_RLP, 1);
|
||||||
block.body = Some(body_stream.out());
|
block.body = Some(body_stream.out());
|
||||||
}
|
}
|
||||||
|
@ -361,12 +361,12 @@ impl ChainSync {
|
|||||||
|
|
||||||
trace!(target: "sync", "New peer {} (protocol: {}, network: {:?}, difficulty: {:?}, latest:{}, genesis:{})", peer_id, peer.protocol_version, peer.network_id, peer.difficulty, peer.latest_hash, peer.genesis);
|
trace!(target: "sync", "New peer {} (protocol: {}, network: {:?}, difficulty: {:?}, latest:{}, genesis:{})", peer_id, peer.protocol_version, peer.network_id, peer.difficulty, peer.latest_hash, peer.genesis);
|
||||||
if io.is_expired() {
|
if io.is_expired() {
|
||||||
trace!("Status packet from expired session {}:{}", peer_id, io.peer_info(peer_id));
|
trace!(target: "sync", "Status packet from expired session {}:{}", peer_id, io.peer_info(peer_id));
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.peers.contains_key(&peer_id) {
|
if self.peers.contains_key(&peer_id) {
|
||||||
warn!("Unexpected status packet from {}:{}", peer_id, io.peer_info(peer_id));
|
debug!(target: "sync", "Unexpected status packet from {}:{}", peer_id, io.peer_info(peer_id));
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let chain_info = io.chain().chain_info();
|
let chain_info = io.chain().chain_info();
|
||||||
@ -1243,7 +1243,7 @@ impl ChainSync {
|
|||||||
/// propagates latest block to lagging peers
|
/// propagates latest block to lagging peers
|
||||||
fn propagate_blocks(&mut self, chain_info: &BlockChainInfo, io: &mut SyncIo) -> usize {
|
fn propagate_blocks(&mut self, chain_info: &BlockChainInfo, io: &mut SyncIo) -> usize {
|
||||||
let lucky_peers = self.select_lagging_peers(chain_info, io);
|
let lucky_peers = self.select_lagging_peers(chain_info, io);
|
||||||
trace!("Sending NewBlocks to {:?}", lucky_peers);
|
trace!(target: "sync", "Sending NewBlocks to {:?}", lucky_peers);
|
||||||
let mut sent = 0;
|
let mut sent = 0;
|
||||||
for (peer_id, _) in lucky_peers {
|
for (peer_id, _) in lucky_peers {
|
||||||
let rlp = ChainSync::create_latest_block_rlp(io.chain());
|
let rlp = ChainSync::create_latest_block_rlp(io.chain());
|
||||||
@ -1258,7 +1258,7 @@ impl ChainSync {
|
|||||||
/// propagates new known hashes to all peers
|
/// propagates new known hashes to all peers
|
||||||
fn propagate_new_hashes(&mut self, chain_info: &BlockChainInfo, io: &mut SyncIo) -> usize {
|
fn propagate_new_hashes(&mut self, chain_info: &BlockChainInfo, io: &mut SyncIo) -> usize {
|
||||||
let lucky_peers = self.select_lagging_peers(chain_info, io);
|
let lucky_peers = self.select_lagging_peers(chain_info, io);
|
||||||
trace!("Sending NewHashes to {:?}", lucky_peers);
|
trace!(target: "sync", "Sending NewHashes to {:?}", lucky_peers);
|
||||||
let mut sent = 0;
|
let mut sent = 0;
|
||||||
let last_parent = HeaderView::new(&io.chain().block_header(BlockID::Hash(chain_info.best_block_hash.clone())).unwrap()).parent_hash();
|
let last_parent = HeaderView::new(&io.chain().block_header(BlockID::Hash(chain_info.best_block_hash.clone())).unwrap()).parent_hash();
|
||||||
for (peer_id, peer_number) in lucky_peers {
|
for (peer_id, peer_number) in lucky_peers {
|
||||||
|
Loading…
Reference in New Issue
Block a user