empty new block test
This commit is contained in:
parent
c3f23839e8
commit
3f17acca1d
@ -1304,4 +1304,20 @@ mod tests {
|
||||
// NEW_BLOCK_PACKET
|
||||
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());
|
||||
}
|
||||
}
|
@ -138,7 +138,7 @@ fn propagade_hashes() {
|
||||
|
||||
#[test]
|
||||
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.sync();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user