mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
fix: traceTx function
This commit is contained in:
parent
f88af20009
commit
ab2db597d9
2 changed files with 4 additions and 8 deletions
|
|
@ -1392,11 +1392,6 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor
|
||||||
config.BorTx = newBoolPtr(false)
|
config.BorTx = newBoolPtr(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = core.ApplyTransactionWithEVM(message, api.backend.ChainConfig(), new(core.GasPool).AddGas(message.GasLimit), statedb, vmctx.BlockNumber, txctx.BlockHash, tx, &usedGas, vmenv, context.Background())
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("tracing failed: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if *config.BorTx {
|
if *config.BorTx {
|
||||||
callmsg := prepareCallMessage(*message)
|
callmsg := prepareCallMessage(*message)
|
||||||
// nolint : contextcheck
|
// nolint : contextcheck
|
||||||
|
|
@ -1404,8 +1399,10 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor
|
||||||
return nil, fmt.Errorf("tracing failed: %w", err)
|
return nil, fmt.Errorf("tracing failed: %w", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// nolint : contextcheck
|
// Call Prepare to clear out the statedb access list
|
||||||
if _, err = core.ApplyMessage(vmenv, message, new(core.GasPool).AddGas(message.GasLimit), context.Background()); err != nil {
|
statedb.SetTxContext(txctx.TxHash, txctx.TxIndex)
|
||||||
|
_, err = core.ApplyTransactionWithEVM(message, api.backend.ChainConfig(), new(core.GasPool).AddGas(message.GasLimit), statedb, vmctx.BlockNumber, txctx.BlockHash, tx, &usedGas, vmenv, context.Background())
|
||||||
|
if err != nil {
|
||||||
return nil, fmt.Errorf("tracing failed: %w", err)
|
return nil, fmt.Errorf("tracing failed: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -469,7 +469,6 @@ func TestTraceTransaction(t *testing.T) {
|
||||||
api := NewAPI(backend)
|
api := NewAPI(backend)
|
||||||
|
|
||||||
result, err := api.TraceTransaction(context.Background(), target, nil)
|
result, err := api.TraceTransaction(context.Background(), target, nil)
|
||||||
fmt.Println("Anshal trace txn - ", result)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Failed to trace transaction %v", err)
|
t.Errorf("Failed to trace transaction %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue