approval-voting: populate session cache in advance (#3954)

* try populating session cache in advance

* remove unused arg

* fmt

* fix compilation

* fix tests

* Revert "fix tests"

This reverts commit e8222b1108e09a39727a38e3b4e4c3061642a213.

* fix tests

* bump dispute window const by 1

* fix tests
This commit is contained in:
Andronik Ordian
2021-09-29 11:53:44 +02:00
committed by GitHub
parent 4549e1a1b0
commit cb89dfc039
5 changed files with 18 additions and 37 deletions
@@ -324,7 +324,7 @@ pub(crate) async fn handle_new_head(
}
};
match state.session_window.cache_session_info_for_head(ctx, head, &header).await {
match state.session_window.cache_session_info_for_head(ctx, head).await {
Err(e) => {
tracing::debug!(
target: LOG_TARGET,
@@ -1236,7 +1236,7 @@ pub(crate) mod tests {
h,
RuntimeApiRequest::SessionIndexForChild(c_tx),
)) => {
assert_eq!(h, parent_hash.clone());
assert_eq!(h, hash);
let _ = c_tx.send(Ok(session));
}
);
@@ -786,8 +786,8 @@ async fn import_block(
RuntimeApiRequest::SessionIndexForChild(s_tx)
)
) => {
let hash = &hashes[number.saturating_sub(1) as usize];
assert_eq!(req_block_hash, hash.0.clone());
let hash = &hashes[number as usize];
assert_eq!(req_block_hash, hash.0);
s_tx.send(Ok(number.into())).unwrap();
}
);