add fullTx option

This commit is contained in:
Sina Mahmoodi 2024-05-28 21:50:26 +02:00
parent e3827828fd
commit 9139685944
2 changed files with 7 additions and 5 deletions

View file

@ -1241,7 +1241,7 @@ func (s *BlockChainAPI) SimulateV1(ctx context.Context, opts simOpts, blockNrOrH
if state == nil || err != nil {
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)
}

View file

@ -68,9 +68,10 @@ func (r *simCallResult) MarshalJSON() ([]byte, error) {
}
type simOpts struct {
BlockStateCalls []simBlock
TraceTransfers bool
Validation bool
BlockStateCalls []simBlock
TraceTransfers bool
Validation bool
ReturnFullTransactions bool
}
type simulator struct {
@ -80,6 +81,7 @@ type simulator struct {
base *types.Header
traceTransfers bool
validate bool
fullTx bool
}
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)
}
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))
res["calls"] = callResults