@@ -3,6 +3,7 @@ package rawdb
3
3
import (
4
4
"bytes"
5
5
"encoding/binary"
6
+ "encoding/json"
6
7
"math/big"
7
8
"sync"
8
9
@@ -52,8 +53,10 @@ type SkippedTransaction struct {
52
53
Tx * types.Transaction
53
54
54
55
// Traces is the wrapped traces of the skipped transaction.
55
- // We only store it when `MinerStoreSkippedTxTracesFlag` is enabled, so it may return nil.
56
- Traces * types.BlockTrace
56
+ // We only store it when `MinerStoreSkippedTxTracesFlag` is enabled, so it might be empty.
57
+ // Note that we don't use *types.BlockTrace directly because types.BlockTrace.StorageTrace.Proofs is of
58
+ // type map[string][]hexutil.Bytes, and is not RLP-serializable.
59
+ TracesBytes []byte
57
60
58
61
// Reason is the skip reason.
59
62
Reason string
@@ -71,10 +74,14 @@ func writeSkippedTransaction(db ethdb.KeyValueWriter, tx *types.Transaction, tra
71
74
if blockHash == nil {
72
75
blockHash = & common.Hash {}
73
76
}
74
- stx := SkippedTransaction {Tx : tx , Traces : traces , Reason : reason , BlockNumber : blockNumber , BlockHash : blockHash }
77
+ b , err := json .Marshal (traces )
78
+ if err != nil {
79
+ log .Crit ("Failed to json marshal skipped transaction" , "hash" , tx .Hash ().String (), "err" , err )
80
+ }
81
+ stx := SkippedTransaction {Tx : tx , TracesBytes : b , Reason : reason , BlockNumber : blockNumber , BlockHash : blockHash }
75
82
bytes , err := rlp .EncodeToBytes (stx )
76
83
if err != nil {
77
- log .Crit ("Failed to RLP encode skipped transaction" , "err" , err )
84
+ log .Crit ("Failed to RLP encode skipped transaction" , "hash" , tx . Hash (). String (), " err" , err )
78
85
}
79
86
if err := db .Put (SkippedTransactionKey (tx .Hash ()), bytes ); err != nil {
80
87
log .Crit ("Failed to store skipped transaction" , "hash" , tx .Hash ().String (), "err" , err )
0 commit comments