mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 20:31:04 +00:00
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:
@@ -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();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -478,22 +478,7 @@ async fn handle_new_activations(
|
||||
new_activations: impl IntoIterator<Item = Hash>,
|
||||
) -> Result<(), Error> {
|
||||
for new_leaf in new_activations {
|
||||
let block_header = {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
ctx.send_message(ChainApiMessage::BlockHeader(new_leaf, tx)).await;
|
||||
|
||||
match rx.await?? {
|
||||
None => continue,
|
||||
Some(header) => header,
|
||||
}
|
||||
};
|
||||
|
||||
match state
|
||||
.rolling_session_window
|
||||
.cache_session_info_for_head(ctx, new_leaf, &block_header)
|
||||
.await
|
||||
{
|
||||
match state.rolling_session_window.cache_session_info_for_head(ctx, new_leaf).await {
|
||||
Err(e) => {
|
||||
tracing::warn!(
|
||||
target: LOG_TARGET,
|
||||
|
||||
Reference in New Issue
Block a user