Block 0 is valid in queries (#8891)
Early exit for block nr 0 leads to spurious error about pruning: `…your node is running with state pruning…`. Fixes #7547, #8762
This commit is contained in:
parent
fd57100190
commit
05e7c133fb
@ -1047,7 +1047,8 @@ impl Client {
|
|||||||
/// Otherwise, this can fail (but may not) if the DB prunes state.
|
/// Otherwise, this can fail (but may not) if the DB prunes state.
|
||||||
pub fn state_at_beginning(&self, id: BlockId) -> Option<State<StateDB>> {
|
pub fn state_at_beginning(&self, id: BlockId) -> Option<State<StateDB>> {
|
||||||
match self.block_number(id) {
|
match self.block_number(id) {
|
||||||
None | Some(0) => None,
|
None => None,
|
||||||
|
Some(0) => self.state_at(id),
|
||||||
Some(n) => self.state_at(BlockId::Number(n - 1)),
|
Some(n) => self.state_at(BlockId::Number(n - 1)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user