Replace mutate with get + set

I'm legitimately unsure why mutate doesn't work. Reading the impls, it should...
This commit is contained in:
Luke Parker
2023-10-11 02:10:35 -04:00
parent ed90d1752a
commit 2401266374
2 changed files with 18 additions and 14 deletions

View File

@@ -169,10 +169,11 @@ pub mod pallet {
fn new_set(network: NetworkId) {
// Update CurrentSession
let session = if network != NetworkId::Serai {
CurrentSession::<T>::mutate(network, |session| {
Some(session.map(|session| Session(session.0 + 1)).unwrap_or(Session(0)))
})
.unwrap()
let new_session = CurrentSession::<T>::get(network)
.map(|session| Session(session.0 + 1))
.unwrap_or(Session(0));
CurrentSession::<T>::set(network, Some(new_session));
new_session
} else {
Self::session(network)
};