Use number of downloaded blocks for test (#6234)

This commit is contained in:
Arkadiy Paronyan
2020-06-04 23:41:48 +02:00
committed by GitHub
parent 7f1f811cf9
commit 31921c4eb9
5 changed files with 18 additions and 20 deletions
+3 -3
View File
@@ -221,9 +221,9 @@ impl<D> Peer<D> {
self.network.num_connected_peers()
}
/// Returns the number of processed blocks.
pub fn num_processed_blocks(&self) -> usize {
self.network.num_processed_blocks()
/// Returns the number of downloaded blocks.
pub fn num_downloaded_blocks(&self) -> usize {
self.network.num_downloaded_blocks()
}
/// Returns true if we have no peer.
+2 -2
View File
@@ -673,12 +673,12 @@ fn imports_stale_once() {
// check that NEW block is imported from announce message
let new_hash = net.peer(0).push_blocks(1, false);
import_with_announce(&mut net, new_hash);
assert_eq!(net.peer(1).num_processed_blocks(), 1);
assert_eq!(net.peer(1).num_downloaded_blocks(), 1);
// check that KNOWN STALE block is imported from announce message
let known_stale_hash = net.peer(0).push_blocks_at(BlockId::Number(0), 1, true);
import_with_announce(&mut net, known_stale_hash);
assert_eq!(net.peer(1).num_processed_blocks(), 2);
assert_eq!(net.peer(1).num_downloaded_blocks(), 2);
}
#[test]