@@ -54,9 +54,11 @@ type generatorStats struct {
5454
5555// Log creates an contextual log with the given message and the context pulled
5656// 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 ) {
5858 var ctx []interface {}
59-
59+ if root != (common.Hash {}) {
60+ ctx = append (ctx , []interface {}{"root" , root }... )
61+ }
6062 // Figure out whether we're after or within an account
6163 switch len (marker ) {
6264 case common .HashLength :
@@ -120,7 +122,7 @@ func generateSnapshot(diskdb ethdb.KeyValueStore, triedb *trie.Database, cache i
120122func (dl * diskLayer ) generate (stats * generatorStats ) {
121123 // If a database wipe is in operation, wait until it's done
122124 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 )
124126 select {
125127 // If wiper is done, resume normal mode of operation
126128 case <- stats .wiping :
@@ -137,13 +139,13 @@ func (dl *diskLayer) generate(stats *generatorStats) {
137139 accTrie , err := trie .NewSecure (dl .root , dl .triedb )
138140 if err != nil {
139141 // 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 )
141143
142144 abort := <- dl .genAbort
143145 abort <- stats
144146 return
145147 }
146- stats .Log ("Resuming state snapshot generation" , dl .genMarker )
148+ stats .Log ("Resuming state snapshot generation" , dl .root , dl . genMarker )
147149
148150 var accMarker []byte
149151 if len (dl .genMarker ) > 0 { // []byte{} is the start, use nil for that
@@ -192,7 +194,7 @@ func (dl *diskLayer) generate(stats *generatorStats) {
192194 dl .lock .Unlock ()
193195 }
194196 if abort != nil {
195- stats .Log ("Aborting state snapshot generation" , accountHash [:])
197+ stats .Log ("Aborting state snapshot generation" , dl . root , accountHash [:])
196198 abort <- stats
197199 return
198200 }
@@ -230,15 +232,15 @@ func (dl *diskLayer) generate(stats *generatorStats) {
230232 dl .lock .Unlock ()
231233 }
232234 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 ... ))
234236 abort <- stats
235237 return
236238 }
237239 }
238240 }
239241 }
240242 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 )
242244 logged = time .Now ()
243245 }
244246 // Some account processed, unmark the marker
0 commit comments