Skip to content

Commit

Permalink
fix: handle error when setting account information
Browse files Browse the repository at this point in the history
  • Loading branch information
peara committed Jul 24, 2024
1 parent 70a1f19 commit cf2b54a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions x/evm/keeper/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,19 @@ func (k *Keeper) SetAccount(ctx sdk.Context, addr common.Address, account stated
panic(err)
}
newBaseAccount := newAcct.GetBaseAccount()
newBaseAccount.SetAccountNumber(acct.GetAccountNumber())
newBaseAccount.SetPubKey(acct.GetPubKey())
newBaseAccount.SetSequence(acct.GetSequence())
errAN := newBaseAccount.SetAccountNumber(acct.GetAccountNumber())
errPK := newBaseAccount.SetPubKey(acct.GetPubKey())
errSq := newBaseAccount.SetSequence(acct.GetSequence())

if errAN != nil || errPK != nil || errSq != nil {
panic(fmt.Sprintf("error setting account number, pubkey or sequence: %s, %s, %s", errAN, errPK, errSq))
}

k.accountKeeper.SetAccount(ctx, &newAcct)

acct = k.accountKeeper.GetAccount(ctx, cosmosAddr)
}


if ethAcct, ok := acct.(evmostypes.EthAccountI); ok {
if err := ethAcct.SetCodeHash(codeHash); err != nil {
return err
Expand Down

0 comments on commit cf2b54a

Please sign in to comment.