system_syncState: Always return highest block (#11979)

Before `highestBlock` was an optional that was omitted when it was `None`. We recently changed the
way the `highestBlock` is determined, this resulted in having this value in 99.99% of the time being
`None` when the node is syncing blocks at the tip. Now we always return a block for `highestBlock`.
If sync doesn't return us any best seen block, we return our own local best block as `highestBlock`.
This should mainly reflect the same behavior to before we changed the way the best seen block is determined.
This commit is contained in:
Bastian Köcher
2022-08-05 19:53:56 +02:00
committed by GitHub
parent a1ee0fca0b
commit a314484865
3 changed files with 12 additions and 13 deletions
+2 -5
View File
@@ -123,7 +123,7 @@ fn api<T: Into<Option<Status>>>(sync: T) -> RpcModule<System<Block>> {
let _ = sender.send(SyncState {
starting_block: 1,
current_block: 2,
highest_block: Some(3),
highest_block: 3,
});
},
};
@@ -297,10 +297,7 @@ async fn system_node_roles() {
async fn system_sync_state() {
let sync_state: SyncState<i32> =
api(None).call("system_syncState", EmptyParams::new()).await.unwrap();
assert_eq!(
sync_state,
SyncState { starting_block: 1, current_block: 2, highest_block: Some(3) }
);
assert_eq!(sync_state, SyncState { starting_block: 1, current_block: 2, highest_block: 3 });
}
#[tokio::test]