mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Revert prior commit
An archive of all GlobalSessions is necessary to check for faults. The storage cost is also minimal. While it should be avoided if it can be, it can't be here.
This commit is contained in:
@@ -26,7 +26,7 @@ pub(crate) struct BlockEventData {
|
||||
|
||||
db_channel! {
|
||||
CosignIntendChannels {
|
||||
GlobalSessions: () -> ([u8; 32], GlobalSession),
|
||||
GlobalSessionsChannel: () -> ([u8; 32], GlobalSession),
|
||||
BlockEvents: () -> BlockEventData,
|
||||
IntendedCosigns: (set: ValidatorSet) -> CosignIntent,
|
||||
}
|
||||
@@ -128,14 +128,12 @@ impl<D: Db> ContinuallyRan for CosignIntendTask<D> {
|
||||
stakes,
|
||||
total_stake,
|
||||
};
|
||||
if let Some((ending_global_session, _ending_global_session_info)) = global_session_for_this_block {
|
||||
GlobalSessions::set(&mut txn, global_session, &global_session_info);
|
||||
if let Some(ending_global_session) = global_session_for_this_block {
|
||||
GlobalSessionsLastBlock::set(&mut txn, ending_global_session, &block_number);
|
||||
}
|
||||
LatestGlobalSessionIntended::set(
|
||||
&mut txn,
|
||||
&(global_session, global_session_info.clone()),
|
||||
);
|
||||
GlobalSessions::send(&mut txn, &(global_session, global_session_info));
|
||||
LatestGlobalSessionIntended::set(&mut txn, &global_session);
|
||||
GlobalSessionsChannel::send(&mut txn, &(global_session, global_session_info));
|
||||
}
|
||||
|
||||
// If there isn't anyone available to cosign this block, meaning it'll never be cosigned,
|
||||
@@ -147,9 +145,10 @@ impl<D: Db> ContinuallyRan for CosignIntendTask<D> {
|
||||
|
||||
match has_events {
|
||||
HasEvents::Notable | HasEvents::NonNotable => {
|
||||
let (global_session_for_this_block, global_session_info) =
|
||||
global_session_for_this_block
|
||||
.expect("global session for this block was None but still attempting to cosign it");
|
||||
let global_session_for_this_block = global_session_for_this_block
|
||||
.expect("global session for this block was None but still attempting to cosign it");
|
||||
let global_session_info = GlobalSessions::get(&txn, global_session_for_this_block)
|
||||
.expect("last global session intended wasn't saved to the database");
|
||||
|
||||
// Tell each set of their expectation to cosign this block
|
||||
for set in global_session_info.sets {
|
||||
|
||||
Reference in New Issue
Block a user