mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
Adding individual gasUsed
This commit is contained in:
parent
b88353c27d
commit
20d99d94df
2 changed files with 6 additions and 4 deletions
|
|
@ -23,10 +23,10 @@ type EventRecordWithTime struct {
|
||||||
Time time.Time `json:"record_time" yaml:"record_time"`
|
Time time.Time `json:"record_time" yaml:"record_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns the string representatin of span
|
// String returns the string representation of EventRecord
|
||||||
func (e *EventRecordWithTime) String() string {
|
func (e *EventRecordWithTime) String(gasUsed uint64) string {
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"id %v, contract %v, data: %v, txHash: %v, logIndex: %v, chainId: %v, time %s",
|
"id %v, contract %v, data: %v, txHash: %v, logIndex: %v, chainId: %v, time %s, gasUsed %d",
|
||||||
e.ID,
|
e.ID,
|
||||||
e.Contract.String(),
|
e.Contract.String(),
|
||||||
e.Data.String(),
|
e.Data.String(),
|
||||||
|
|
@ -34,6 +34,7 @@ func (e *EventRecordWithTime) String() string {
|
||||||
e.LogIndex,
|
e.LogIndex,
|
||||||
e.ChainID,
|
e.ChainID,
|
||||||
e.Time.Format(time.RFC3339),
|
e.Time.Format(time.RFC3339),
|
||||||
|
gasUsed,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,9 +66,10 @@ func (gc *GenesisContractsClient) CommitState(
|
||||||
log.Error("Unable to pack tx for commitState", "error", err)
|
log.Error("Unable to pack tx for commitState", "error", err)
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
log.Info("→ committing new state", "eventRecord", event.String())
|
|
||||||
msg := getSystemMessage(common.HexToAddress(gc.StateReceiverContract), data)
|
msg := getSystemMessage(common.HexToAddress(gc.StateReceiverContract), data)
|
||||||
gasUsed, err := applyMessage(msg, state, header, gc.chainConfig, chCtx)
|
gasUsed, err := applyMessage(msg, state, header, gc.chainConfig, chCtx)
|
||||||
|
// Logging event log with time and individual gasUsed
|
||||||
|
log.Info("→ committing new state", "eventRecord", event.String(gasUsed))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue