fix: EthGetBalance: lookup balance at correct state

This commit is contained in:
Aayush
2023-02-27 14:43:57 -05:00
parent 9fba14b6b1
commit 17e680ea3c
2 changed files with 44 additions and 1 deletions
+6 -1
View File
@@ -636,7 +636,12 @@ func (a *EthModule) EthGetBalance(ctx context.Context, address ethtypes.EthAddre
return ethtypes.EthBigInt{}, xerrors.Errorf("cannot parse block param: %s", blkParam)
}
actor, err := a.StateGetActor(ctx, filAddr, ts.Key())
st, _, err := a.StateManager.TipSetState(ctx, ts)
if err != nil {
return ethtypes.EthBigInt{}, xerrors.Errorf("failed to compute tipset state: %w", err)
}
actor, err := a.StateManager.LoadActorRaw(ctx, filAddr, st)
if xerrors.Is(err, types.ErrActorNotFound) {
return ethtypes.EthBigIntZero, nil
} else if err != nil {