mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
add fullTx option
This commit is contained in:
parent
e3827828fd
commit
9139685944
2 changed files with 7 additions and 5 deletions
|
|
@ -1241,7 +1241,7 @@ func (s *BlockChainAPI) SimulateV1(ctx context.Context, opts simOpts, blockNrOrH
|
||||||
if state == nil || err != nil {
|
if state == nil || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
sim := &simulator{b: s.b, state: state, base: base, traceTransfers: opts.TraceTransfers, validate: opts.Validation}
|
sim := &simulator{b: s.b, state: state, base: base, traceTransfers: opts.TraceTransfers, validate: opts.Validation, fullTx: opts.ReturnFullTransactions}
|
||||||
return sim.execute(ctx, opts.BlockStateCalls)
|
return sim.execute(ctx, opts.BlockStateCalls)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,10 @@ func (r *simCallResult) MarshalJSON() ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type simOpts struct {
|
type simOpts struct {
|
||||||
BlockStateCalls []simBlock
|
BlockStateCalls []simBlock
|
||||||
TraceTransfers bool
|
TraceTransfers bool
|
||||||
Validation bool
|
Validation bool
|
||||||
|
ReturnFullTransactions bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type simulator struct {
|
type simulator struct {
|
||||||
|
|
@ -80,6 +81,7 @@ type simulator struct {
|
||||||
base *types.Header
|
base *types.Header
|
||||||
traceTransfers bool
|
traceTransfers bool
|
||||||
validate bool
|
validate bool
|
||||||
|
fullTx bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sim *simulator) execute(ctx context.Context, blocks []simBlock) ([]map[string]interface{}, error) {
|
func (sim *simulator) execute(ctx context.Context, blocks []simBlock) ([]map[string]interface{}, error) {
|
||||||
|
|
@ -233,7 +235,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
|
||||||
withdrawals = make([]*types.Withdrawal, 0)
|
withdrawals = make([]*types.Withdrawal, 0)
|
||||||
}
|
}
|
||||||
b := types.NewBlockWithWithdrawals(header, txes, nil, receipts, withdrawals, trie.NewStackTrie(nil))
|
b := types.NewBlockWithWithdrawals(header, txes, nil, receipts, withdrawals, trie.NewStackTrie(nil))
|
||||||
res := RPCMarshalBlock(b, true, false, config)
|
res := RPCMarshalBlock(b, true, sim.fullTx, config)
|
||||||
repairLogs(callResults, res["hash"].(common.Hash))
|
repairLogs(callResults, res["hash"].(common.Hash))
|
||||||
res["calls"] = callResults
|
res["calls"] = callResults
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue