fix cache miss justified balances calculation (#2852)
## Issue Addressed We were calculating justified balances incorrectly on cache misses in `set_justified_checkpoint` ## Proposed Changes Use the `get_effective_balances` method as opposed to `state.balances`, which returns exact balances Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
parent
a80ccc3a33
commit
b5f2764bae
@ -321,14 +321,13 @@ where
|
|||||||
.deconstruct()
|
.deconstruct()
|
||||||
.0;
|
.0;
|
||||||
|
|
||||||
self.justified_balances = self
|
let state = self
|
||||||
.store
|
.store
|
||||||
.get_state(&justified_block.state_root(), Some(justified_block.slot()))
|
.get_state(&justified_block.state_root(), Some(justified_block.slot()))
|
||||||
.map_err(Error::FailedToReadState)?
|
.map_err(Error::FailedToReadState)?
|
||||||
.ok_or_else(|| Error::MissingState(justified_block.state_root()))?
|
.ok_or_else(|| Error::MissingState(justified_block.state_root()))?;
|
||||||
.balances()
|
|
||||||
.clone()
|
self.justified_balances = get_effective_balances(&state);
|
||||||
.into();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user