Merge pull request #3695 from ethcore/snapshot-share

Don't share the snapshot while downloading old blocks
This commit is contained in:
Gav Wood 2016-12-01 01:11:22 +00:00 committed by GitHub
commit ec38c68e30

View File

@ -1426,7 +1426,10 @@ impl ChainSync {
packet.append(&chain.best_block_hash); packet.append(&chain.best_block_hash);
packet.append(&chain.genesis_hash); packet.append(&chain.genesis_hash);
if warp_protocol { if warp_protocol {
let manifest = io.snapshot_service().manifest(); let manifest = match self.old_blocks.is_some() {
true => None,
false => io.snapshot_service().manifest(),
};
let block_number = manifest.as_ref().map_or(0, |m| m.block_number); let block_number = manifest.as_ref().map_or(0, |m| m.block_number);
let manifest_hash = manifest.map_or(H256::new(), |m| m.into_rlp().sha3()); let manifest_hash = manifest.map_or(H256::new(), |m| m.into_rlp().sha3());
packet.append(&manifest_hash); packet.append(&manifest_hash);