mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
ethapi: add timestamp to logs in eth_simulate
This commit is contained in:
parent
1e4b39ed12
commit
8fa20cea0b
2 changed files with 13 additions and 10 deletions
|
|
@ -53,15 +53,17 @@ type tracer struct {
|
||||||
count int
|
count int
|
||||||
traceTransfers bool
|
traceTransfers bool
|
||||||
blockNumber uint64
|
blockNumber uint64
|
||||||
|
blockTimestamp uint64
|
||||||
blockHash common.Hash
|
blockHash common.Hash
|
||||||
txHash common.Hash
|
txHash common.Hash
|
||||||
txIdx uint
|
txIdx uint
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTracer(traceTransfers bool, blockNumber uint64, blockHash, txHash common.Hash, txIndex uint) *tracer {
|
func newTracer(traceTransfers bool, blockNumber uint64, blockTimestamp uint64, blockHash, txHash common.Hash, txIndex uint) *tracer {
|
||||||
return &tracer{
|
return &tracer{
|
||||||
traceTransfers: traceTransfers,
|
traceTransfers: traceTransfers,
|
||||||
blockNumber: blockNumber,
|
blockNumber: blockNumber,
|
||||||
|
blockTimestamp: blockTimestamp,
|
||||||
blockHash: blockHash,
|
blockHash: blockHash,
|
||||||
txHash: txHash,
|
txHash: txHash,
|
||||||
txIdx: txIndex,
|
txIdx: txIndex,
|
||||||
|
|
@ -119,6 +121,7 @@ func (t *tracer) captureLog(address common.Address, topics []common.Hash, data [
|
||||||
Topics: topics,
|
Topics: topics,
|
||||||
Data: data,
|
Data: data,
|
||||||
BlockNumber: t.blockNumber,
|
BlockNumber: t.blockNumber,
|
||||||
|
BlockTimestamp: t.blockTimestamp,
|
||||||
BlockHash: t.blockHash,
|
BlockHash: t.blockHash,
|
||||||
TxHash: t.txHash,
|
TxHash: t.txHash,
|
||||||
TxIndex: t.txIdx,
|
TxIndex: t.txIdx,
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
|
||||||
callResults = make([]simCallResult, len(block.Calls))
|
callResults = make([]simCallResult, len(block.Calls))
|
||||||
receipts = make([]*types.Receipt, len(block.Calls))
|
receipts = make([]*types.Receipt, len(block.Calls))
|
||||||
// Block hash will be repaired after execution.
|
// Block hash will be repaired after execution.
|
||||||
tracer = newTracer(sim.traceTransfers, blockContext.BlockNumber.Uint64(), common.Hash{}, common.Hash{}, 0)
|
tracer = newTracer(sim.traceTransfers, blockContext.BlockNumber.Uint64(), blockContext.Time, common.Hash{}, common.Hash{}, 0)
|
||||||
vmConfig = &vm.Config{
|
vmConfig = &vm.Config{
|
||||||
NoBaseFee: !sim.validate,
|
NoBaseFee: !sim.validate,
|
||||||
Tracer: tracer.Hooks(),
|
Tracer: tracer.Hooks(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue