Skip to content

Commit

Permalink
chore: Use older version of thread_local api.
Browse files Browse the repository at this point in the history
  • Loading branch information
vldm committed Feb 22, 2025
1 parent d262a21 commit 8a12715
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ledger/src/evm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use {
collections::BTreeMap,
ops::Deref,
path::{Path, PathBuf},
str,
sync::{atomic::AtomicU64, Arc},
},
triedb::gc::DbCounter,
Expand Down Expand Up @@ -215,10 +216,11 @@ impl EvmArchiveInner {
thread_local! {
pub static CHAIN_NAME: RefCell<BTreeMap<ChainID, &'static str>> = RefCell::new(BTreeMap::new());
}
let val = CHAIN_NAME.with_borrow_mut(|m| {
let val = CHAIN_NAME.with(|cell| {
let mut m = cell.borrow_mut();
if !m.contains_key(&chain_id) {
let val = format!("evm_archive_subchain_{}", chain_id);
m.insert(chain_id, val.leak());
m.insert(chain_id, Box::leak(val.into_boxed_str()));
}
*m.get(&chain_id).expect("Chain should be inserted")
});
Expand Down

0 comments on commit 8a12715

Please sign in to comment.