Skip to content

Commit

Permalink
fix: return null in MinerGetBaseInfo if miner hasn't been around fo…
Browse files Browse the repository at this point in the history
…r 900 epochs (#4820)
  • Loading branch information
lemmih authored Oct 2, 2024
1 parent 5fd1ec5 commit 1bc2f51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@

- [#4809](https://github.com/ChainSafe/forest/issues/4777) the Mac OS X build on
Apple silicons works
- [#4820](https://github.com/ChainSafe/forest/pull/4820) Fix edge-case in
`Filecoin.MinerGetBaseInfo` RPC method.

## Forest 0.20.0 "Brexit"

Expand Down
7 changes: 7 additions & 0 deletions src/state_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,14 @@ where
epoch,
)?;

// If the miner actor doesn't exist in the current tipset, it is a
// user-error and we must return an error message. If the miner exists
// in the current tipset but not in the lookback tipset, we may not
// error and should instead return None.
let actor = self.get_required_actor(&addr, *tipset.parent_state())?;
if self.get_actor(&addr, lb_state_root)?.is_none() {
return Ok(None);
}

let miner_state = miner::State::load(self.blockstore(), actor.code, actor.state)?;

Expand Down

0 comments on commit 1bc2f51

Please sign in to comment.