mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 06:17:56 +00:00
Persist block announcements (#3826)
* Persist block announcements * Renamed sync requests to fork targets * Fixed pruning detection condition
This commit is contained in:
committed by
Gavin Wood
parent
3437d64115
commit
3963bb58ff
@@ -704,7 +704,9 @@ pub trait TestNetFactory: Sized {
|
||||
fn poll(&mut self) {
|
||||
self.mut_peers(|peers| {
|
||||
for peer in peers {
|
||||
trace!(target: "sync", "-- Polling {}", peer.id());
|
||||
peer.network.poll().unwrap();
|
||||
trace!(target: "sync", "-- Polling complete {}", peer.id());
|
||||
|
||||
// We poll `imported_blocks_stream`.
|
||||
while let Ok(Async::Ready(Some(notification))) = peer.imported_blocks_stream.poll() {
|
||||
|
||||
@@ -457,6 +457,17 @@ fn can_sync_small_non_best_forks() {
|
||||
}
|
||||
Ok(Async::Ready(()))
|
||||
})).unwrap();
|
||||
net.block_until_sync(&mut runtime);
|
||||
|
||||
let another_fork = net.peer(0).push_blocks_at(BlockId::Number(35), 2, true);
|
||||
net.peer(0).announce_block(another_fork, Vec::new());
|
||||
runtime.block_on(futures::future::poll_fn::<(), (), _>(|| -> Result<_, ()> {
|
||||
net.poll();
|
||||
if net.peer(1).client().header(&BlockId::Hash(another_fork)).unwrap().is_none() {
|
||||
return Ok(Async::NotReady)
|
||||
}
|
||||
Ok(Async::Ready(()))
|
||||
})).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user