Skip to content

Commit

Permalink
fix: EthGetBalance: lookup balance at correct state
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Feb 28, 2023
1 parent 2b6da17 commit 0b5e5c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/submodule/eth/eth_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,12 @@ func (a *ethAPI) EthGetBalance(ctx context.Context, address types.EthAddress, bl
return types.EthBigInt{}, fmt.Errorf("cannot parse block param: %s", blkParam)
}

actor, err := a.chain.StateGetActor(ctx, filAddr, ts.Key())
_, view, err := a.em.chainModule.Stmgr.StateView(ctx, ts)
if err != nil {
return types.EthBigInt{}, fmt.Errorf("failed to compute tipset state: %w", err)
}

actor, err := view.LoadActor(ctx, filAddr)
if err != nil {
if errors.Is(err, types.ErrActorNotFound) {
return types.EthBigIntZero, nil
Expand Down

0 comments on commit 0b5e5c4

Please sign in to comment.