use crate::checkpoint::{BottomUpCheckpoint, Validators};
use fvm_shared::address::Address;
use fvm_shared::econ::TokenAmount;
use recall_fil_actors_runtime::runtime::Runtime;
impl BottomUpCheckpoint {
pub fn enforce_f0_source(&mut self, rt: &impl Runtime) -> anyhow::Result<()> {
self.data.source = self.source().f0_id(rt);
Ok(())
}
}
impl Validators {
pub fn get_validator_weight(&self, rt: &impl Runtime, addr: &Address) -> Option<TokenAmount> {
self.validators
.validators()
.iter()
.find(|x| match rt.resolve_address(&x.addr) {
Some(id) => id == *addr,
None => false,
})
.map(|v| v.weight.clone())
}
}