@@ -54,9 +54,11 @@ type generatorStats struct {
54
54
55
55
// Log creates an contextual log with the given message and the context pulled
56
56
// from the internally maintained statistics.
57
- func (gs * generatorStats ) Log (msg string , marker []byte ) {
57
+ func (gs * generatorStats ) Log (msg string , root common. Hash , marker []byte ) {
58
58
var ctx []interface {}
59
-
59
+ if root != (common.Hash {}) {
60
+ ctx = append (ctx , []interface {}{"root" , root }... )
61
+ }
60
62
// Figure out whether we're after or within an account
61
63
switch len (marker ) {
62
64
case common .HashLength :
@@ -120,7 +122,7 @@ func generateSnapshot(diskdb ethdb.KeyValueStore, triedb *trie.Database, cache i
120
122
func (dl * diskLayer ) generate (stats * generatorStats ) {
121
123
// If a database wipe is in operation, wait until it's done
122
124
if stats .wiping != nil {
123
- stats .Log ("Wiper running, state snapshotting paused" , dl .genMarker )
125
+ stats .Log ("Wiper running, state snapshotting paused" , common. Hash {}, dl .genMarker )
124
126
select {
125
127
// If wiper is done, resume normal mode of operation
126
128
case <- stats .wiping :
@@ -137,13 +139,13 @@ func (dl *diskLayer) generate(stats *generatorStats) {
137
139
accTrie , err := trie .NewSecure (dl .root , dl .triedb )
138
140
if err != nil {
139
141
// The account trie is missing (GC), surf the chain until one becomes available
140
- stats .Log ("Trie missing, state snapshotting paused" , dl .genMarker )
142
+ stats .Log ("Trie missing, state snapshotting paused" , dl .root , dl . genMarker )
141
143
142
144
abort := <- dl .genAbort
143
145
abort <- stats
144
146
return
145
147
}
146
- stats .Log ("Resuming state snapshot generation" , dl .genMarker )
148
+ stats .Log ("Resuming state snapshot generation" , dl .root , dl . genMarker )
147
149
148
150
var accMarker []byte
149
151
if len (dl .genMarker ) > 0 { // []byte{} is the start, use nil for that
@@ -192,7 +194,7 @@ func (dl *diskLayer) generate(stats *generatorStats) {
192
194
dl .lock .Unlock ()
193
195
}
194
196
if abort != nil {
195
- stats .Log ("Aborting state snapshot generation" , accountHash [:])
197
+ stats .Log ("Aborting state snapshot generation" , dl . root , accountHash [:])
196
198
abort <- stats
197
199
return
198
200
}
@@ -230,15 +232,15 @@ func (dl *diskLayer) generate(stats *generatorStats) {
230
232
dl .lock .Unlock ()
231
233
}
232
234
if abort != nil {
233
- stats .Log ("Aborting state snapshot generation" , append (accountHash [:], storeIt .Key ... ))
235
+ stats .Log ("Aborting state snapshot generation" , dl . root , append (accountHash [:], storeIt .Key ... ))
234
236
abort <- stats
235
237
return
236
238
}
237
239
}
238
240
}
239
241
}
240
242
if time .Since (logged ) > 8 * time .Second {
241
- stats .Log ("Generating state snapshot" , accIt .Key )
243
+ stats .Log ("Generating state snapshot" , dl . root , accIt .Key )
242
244
logged = time .Now ()
243
245
}
244
246
// Some account processed, unmark the marker
0 commit comments