mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
Fix BenchmarkTransactionTrace
This commit is contained in:
parent
6995ebd301
commit
ff277fb0a8
1 changed files with 3 additions and 1 deletions
|
|
@ -99,11 +99,13 @@ func BenchmarkTransactionTrace(b *testing.B) {
|
||||||
|
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
snap := state.StateDB.Snapshot()
|
snap := state.StateDB.Snapshot()
|
||||||
|
tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
||||||
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
||||||
_, err = st.TransitionDb()
|
res, err := st.TransitionDb()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
|
tracer.OnTxEnd(&types.Receipt{GasUsed: res.UsedGas}, nil)
|
||||||
state.StateDB.RevertToSnapshot(snap)
|
state.StateDB.RevertToSnapshot(snap)
|
||||||
if have, want := len(tracer.StructLogs()), 244752; have != want {
|
if have, want := len(tracer.StructLogs()), 244752; have != want {
|
||||||
b.Fatalf("trace wrong, want %d steps, have %d", want, have)
|
b.Fatalf("trace wrong, want %d steps, have %d", want, have)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue