mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-29 02:07:25 +00:00
Make sure that on_before_session_ending is called (#3487)
* Make sure that `on_before_session_ending` is called * Move the call above the validtor set being set * Bump spec_version
This commit is contained in:
@@ -53,6 +53,8 @@ thread_local! {
|
||||
pub static SESSION_CHANGED: RefCell<bool> = RefCell::new(false);
|
||||
pub static TEST_SESSION_CHANGED: RefCell<bool> = RefCell::new(false);
|
||||
pub static DISABLED: RefCell<bool> = RefCell::new(false);
|
||||
// Stores if `on_before_session_end` was called
|
||||
pub static BEFORE_SESSION_END_CALLED: RefCell<bool> = RefCell::new(false);
|
||||
}
|
||||
|
||||
pub struct TestShouldEndSession;
|
||||
@@ -81,6 +83,9 @@ impl SessionHandler<u64> for TestSessionHandler {
|
||||
fn on_disabled(_validator_index: usize) {
|
||||
DISABLED.with(|l| *l.borrow_mut() = true)
|
||||
}
|
||||
fn on_before_session_ending() {
|
||||
BEFORE_SESSION_END_CALLED.with(|b| *b.borrow_mut() = true);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TestOnSessionEnding;
|
||||
@@ -134,8 +139,17 @@ pub fn set_next_validators(next: Vec<u64>) {
|
||||
NEXT_VALIDATORS.with(|v| *v.borrow_mut() = next);
|
||||
}
|
||||
|
||||
pub fn before_session_end_called() -> bool {
|
||||
BEFORE_SESSION_END_CALLED.with(|b| *b.borrow())
|
||||
}
|
||||
|
||||
pub fn reset_before_session_end_called() {
|
||||
BEFORE_SESSION_END_CALLED.with(|b| *b.borrow_mut() = false);
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct Test;
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
pub const MaximumBlockWeight: u32 = 1024;
|
||||
|
||||
Reference in New Issue
Block a user