mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
eth/tracers: fix memory logging
This commit is contained in:
parent
f853b5dc60
commit
e90755697c
2 changed files with 7 additions and 3 deletions
|
|
@ -889,11 +889,11 @@ func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer release()
|
defer release()
|
||||||
|
|
||||||
msg, err := core.TransactionToMessage(tx, types.MakeSigner(api.backend.ChainConfig(), block.Number(), block.Time()), block.BaseFee())
|
msg, err := core.TransactionToMessage(tx, types.MakeSigner(api.backend.ChainConfig(), block.Number(), block.Time()), block.BaseFee())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
txctx := &Context{
|
txctx := &Context{
|
||||||
BlockHash: blockHash,
|
BlockHash: blockHash,
|
||||||
BlockNumber: block.Number(),
|
BlockNumber: block.Number(),
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,12 @@ func (s *StructLog) toLegacyJSON() json.RawMessage {
|
||||||
}
|
}
|
||||||
if len(s.Memory) > 0 {
|
if len(s.Memory) > 0 {
|
||||||
memory := make([]string, 0, (len(s.Memory)+31)/32)
|
memory := make([]string, 0, (len(s.Memory)+31)/32)
|
||||||
for i := 0; i+32 <= len(s.Memory); i += 32 {
|
for i := 0; i < len(s.Memory); i += 32 {
|
||||||
memory = append(memory, fmt.Sprintf("%x", s.Memory[i:i+32]))
|
end := i + 32
|
||||||
|
if end > len(s.Memory) {
|
||||||
|
end = len(s.Memory)
|
||||||
|
}
|
||||||
|
memory = append(memory, fmt.Sprintf("%x", s.Memory[i:end]))
|
||||||
}
|
}
|
||||||
msg.Memory = &memory
|
msg.Memory = &memory
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue