fix debug.traceTransaction VM in read-only mode error for public tx (#875)

This commit is contained in:
Zhou Zhiyao 2019-11-07 21:44:33 +08:00 committed by Samer Falah
parent e1e3e4a781
commit 356cf0da8f
1 changed files with 6 additions and 0 deletions

View File

@ -633,6 +633,12 @@ func (api *PrivateDebugAPI) traceTx(ctx context.Context, message core.Message, v
default:
tracer = vm.NewStructLogger(config.LogConfig)
}
// Set the private state to public state if it is not a private message
if msg, ok := message.(core.PrivateMessage); !ok || !api.config.IsQuorum || !msg.IsPrivate() {
privateStateDb = statedb
}
// Run the transaction with tracing enabled.
vmenv := vm.NewEVM(vmctx, statedb, privateStateDb, api.config, vm.Config{Debug: true, Tracer: tracer})