empty new block test

This commit is contained in:
Nikolay Volf 2016-02-07 23:01:09 +03:00
parent c3f23839e8
commit 3f17acca1d
2 changed files with 17 additions and 1 deletions

View File

@ -1304,4 +1304,20 @@ mod tests {
// NEW_BLOCK_PACKET // NEW_BLOCK_PACKET
assert_eq!(0x07, io.queue[0].packet_id); assert_eq!(0x07, io.queue[0].packet_id);
} }
#[test]
fn handles_empty_peer_new_block() {
let mut client = TestBlockChainClient::new();
client.add_blocks(10, false);
let mut queue = VecDeque::new();
let mut sync = dummy_sync_with_peer(client.block_hash_delta_minus(5));
let mut io = TestIo::new(&mut client, &mut queue, None);
let empty_data = vec![];
let block = UntrustedRlp::new(&empty_data);
let result = sync.on_peer_new_block(&mut io, 0, &block);
assert!(result.is_err());
}
} }

View File

@ -138,7 +138,7 @@ fn propagade_hashes() {
#[test] #[test]
fn propagade_blocks() { fn propagade_blocks() {
let mut net = TestNet::new(10); let mut net = TestNet::new(2);
net.peer_mut(1).chain.add_blocks(10, false); net.peer_mut(1).chain.add_blocks(10, false);
net.sync(); net.sync();