mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-13 07:23:46 +00:00
chg : standardTraceBlockToFile fix
This commit is contained in:
parent
5e574bf129
commit
3a0cedc4b1
1 changed files with 13 additions and 7 deletions
|
|
@ -213,9 +213,9 @@ type TraceCallConfig struct {
|
||||||
// StdTraceConfig holds extra parameters to standard-json trace functions.
|
// StdTraceConfig holds extra parameters to standard-json trace functions.
|
||||||
type StdTraceConfig struct {
|
type StdTraceConfig struct {
|
||||||
logger.Config
|
logger.Config
|
||||||
Reexec *uint64
|
Reexec *uint64
|
||||||
TxHash common.Hash
|
TxHash common.Hash
|
||||||
BorTrace *bool
|
BorTraceEnabled *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// txTraceResult is the result of a single transaction trace.
|
// txTraceResult is the result of a single transaction trace.
|
||||||
|
|
@ -806,9 +806,12 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
|
||||||
func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block, config *StdTraceConfig) ([]string, error) {
|
func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block, config *StdTraceConfig) ([]string, error) {
|
||||||
if config == nil {
|
if config == nil {
|
||||||
config = &StdTraceConfig{
|
config = &StdTraceConfig{
|
||||||
BorTrace: newBoolPtr(false),
|
BorTraceEnabled: defaultBorTraceEnabled,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if config.BorTraceEnabled == nil {
|
||||||
|
config.BorTraceEnabled = defaultBorTraceEnabled
|
||||||
|
}
|
||||||
// If we're tracing a single transaction, make sure it's present
|
// If we're tracing a single transaction, make sure it's present
|
||||||
if config != nil && config.TxHash != (common.Hash{}) {
|
if config != nil && config.TxHash != (common.Hash{}) {
|
||||||
if !api.containsTx(ctx, block, config.TxHash) {
|
if !api.containsTx(ctx, block, config.TxHash) {
|
||||||
|
|
@ -868,6 +871,11 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
|
||||||
}
|
}
|
||||||
|
|
||||||
txs, stateSyncPresent := api.getAllBlockTransactions(ctx, block)
|
txs, stateSyncPresent := api.getAllBlockTransactions(ctx, block)
|
||||||
|
if !*config.BorTraceEnabled && stateSyncPresent {
|
||||||
|
txs = txs[:len(txs)-1]
|
||||||
|
stateSyncPresent = false
|
||||||
|
}
|
||||||
|
|
||||||
for i, tx := range txs {
|
for i, tx := range txs {
|
||||||
// Prepare the trasaction for un-traced execution
|
// Prepare the trasaction for un-traced execution
|
||||||
var (
|
var (
|
||||||
|
|
@ -904,15 +912,13 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
|
||||||
statedb.Prepare(tx.Hash(), i)
|
statedb.Prepare(tx.Hash(), i)
|
||||||
|
|
||||||
if stateSyncPresent && i == len(txs)-1 {
|
if stateSyncPresent && i == len(txs)-1 {
|
||||||
if *config.BorTrace {
|
if *config.BorTraceEnabled {
|
||||||
callmsg := prepareCallMessage(msg)
|
callmsg := prepareCallMessage(msg)
|
||||||
_, err = statefull.ApplyBorMessage(*vmenv, callmsg)
|
_, err = statefull.ApplyBorMessage(*vmenv, callmsg)
|
||||||
|
|
||||||
if writer != nil {
|
if writer != nil {
|
||||||
writer.Flush()
|
writer.Flush()
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_, err = core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.Gas()))
|
_, err = core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.Gas()))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue