Skip to content

Commit

Permalink
tx index should start from 0
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Sep 22, 2021
1 parent 6ed83ac commit 16124b2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ func (k *Keeper) ApplyTransaction(tx *ethtypes.Transaction) (*types.MsgEthereumT
// set the transaction hash and index to the impermanent (transient) block state so that it's also
// available on the StateDB functions (eg: AddLog)
k.SetTxHashTransient(txHash)
k.IncreaseTxIndexTransient()

if !k.ctxStack.IsEmpty() {
panic("context stack shouldn't be dirty before apply message")
Expand All @@ -186,6 +185,8 @@ func (k *Keeper) ApplyTransaction(tx *ethtypes.Transaction) (*types.MsgEthereumT
return nil, stacktrace.Propagate(err, "failed to apply ethereum core message")
}

k.IncreaseTxIndexTransient()

res.Hash = txHash.Hex()
logs := k.GetTxLogsTransient(txHash)

Expand Down

0 comments on commit 16124b2

Please sign in to comment.