Nonce increase in ante handler (#165)

* Change nonce to be incremented in pending state during ante handler instead of skipping

* remove unnecessary sim check
This commit is contained in:
Austin Abell 2020-01-08 10:13:19 +13:00 committed by GitHub
parent 51adade59f
commit 35b16abe51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,15 +155,12 @@ func ethAnteHandler(
gas, _ := ethcore.IntrinsicGas(ethTxMsg.Data.Payload, ethTxMsg.To() == nil, true) gas, _ := ethcore.IntrinsicGas(ethTxMsg.Data.Payload, ethTxMsg.To() == nil, true)
newCtx.GasMeter().ConsumeGas(gas, "eth intrinsic gas") newCtx.GasMeter().ConsumeGas(gas, "eth intrinsic gas")
// no need to increment sequence on CheckTx or RecheckTx // Increment sequence of sender
if !(ctx.IsCheckTx() && !sim) {
// increment sequence of sender
acc := ak.GetAccount(ctx, senderAddr) acc := ak.GetAccount(ctx, senderAddr)
if err := acc.SetSequence(acc.GetSequence() + 1); err != nil { if err := acc.SetSequence(acc.GetSequence() + 1); err != nil {
panic(err) panic(err)
} }
ak.SetAccount(ctx, acc) ak.SetAccount(ctx, acc)
}
return newCtx, nil return newCtx, nil
} }