@@ -383,7 +383,7 @@ func (d *Downloader) syncWithPeer(p *peer, hash common.Hash, td *big.Int) (err e
383383 return errTooOld
384384 }
385385
386- log .Debug ("Synchronising with the network" , "peer" , p .id , "eth" , p .version , "head" , hash . Hex ()[ 2 : 10 ] , "td" , td , "mode" , d .mode )
386+ log .Debug ("Synchronising with the network" , "peer" , p .id , "eth" , p .version , "head" , hash , "td" , td , "mode" , d .mode )
387387 defer func (start time.Time ) {
388388 log .Debug ("Synchronisation terminated" , "elapsed" , time .Since (start ))
389389 }(time .Now ())
@@ -544,7 +544,7 @@ func (d *Downloader) fetchHeight(p *peer) (*types.Header, error) {
544544 return nil , errBadPeer
545545 }
546546 head := headers [0 ]
547- p .logger .Debug ("Remote head header identified" , "number" , head .Number , "hash" , head .Hash (). Hex ()[ 2 : 10 ] )
547+ p .logger .Debug ("Remote head header identified" , "number" , head .Number , "hash" , head .Hash ())
548548 return head , nil
549549
550550 case <- timeout :
@@ -657,10 +657,10 @@ func (d *Downloader) findAncestor(p *peer, height uint64) (uint64, error) {
657657 // If the head fetch already found an ancestor, return
658658 if ! common .EmptyHash (hash ) {
659659 if int64 (number ) <= floor {
660- p .logger .Warn ("Ancestor below allowance" , "number" , number , "hash" , hash . Hex ()[ 2 : 10 ] , "allowance" , floor )
660+ p .logger .Warn ("Ancestor below allowance" , "number" , number , "hash" , hash , "allowance" , floor )
661661 return 0 , errInvalidAncestor
662662 }
663- p .logger .Debug ("Found common ancestor" , "number" , number , "hash" , hash . Hex ()[ 2 : 10 ] )
663+ p .logger .Debug ("Found common ancestor" , "number" , number , "hash" , hash )
664664 return number , nil
665665 }
666666 // Ancestor not found, we need to binary search over our chain
@@ -704,7 +704,7 @@ func (d *Downloader) findAncestor(p *peer, height uint64) (uint64, error) {
704704 }
705705 header := d .getHeader (headers [0 ].Hash ()) // Independent of sync mode, header surely exists
706706 if header .Number .Uint64 () != check {
707- p .logger .Debug ("Received non requested header" , "number" , header .Number , "hash" , header .Hash (). Hex ()[ 2 : 10 ] , "request" , check )
707+ p .logger .Debug ("Received non requested header" , "number" , header .Number , "hash" , header .Hash (), "request" , check )
708708 return 0 , errBadPeer
709709 }
710710 start = check
@@ -722,10 +722,10 @@ func (d *Downloader) findAncestor(p *peer, height uint64) (uint64, error) {
722722 }
723723 // Ensure valid ancestry and return
724724 if int64 (start ) <= floor {
725- p .logger .Warn ("Ancestor below allowance" , "number" , start , "hash" , hash . Hex ()[ 2 : 10 ] , "allowance" , floor )
725+ p .logger .Warn ("Ancestor below allowance" , "number" , start , "hash" , hash , "allowance" , floor )
726726 return 0 , errInvalidAncestor
727727 }
728- p .logger .Debug ("Found common ancestor" , "number" , start , "hash" , hash . Hex ()[ 2 : 10 ] )
728+ p .logger .Debug ("Found common ancestor" , "number" , start , "hash" , hash )
729729 return start , nil
730730}
731731
@@ -1208,7 +1208,7 @@ func (d *Downloader) processHeaders(origin uint64, td *big.Int) error {
12081208 if atomic .LoadUint32 (& d .fsPivotFails ) == 0 {
12091209 for _ , header := range rollback {
12101210 if header .Number .Uint64 () == pivot {
1211- log .Warn ("Fast-sync critical section failure, locked pivot to header" , "number" , pivot , "hash" , header .Hash (). Hex ()[ 2 : 10 ] )
1211+ log .Warn ("Fast-sync critical section failure, locked pivot to header" , "number" , pivot , "hash" , header .Hash ())
12121212 d .fsPivotLock = header
12131213 }
12141214 }
@@ -1304,7 +1304,7 @@ func (d *Downloader) processHeaders(origin uint64, td *big.Int) error {
13041304 if n > 0 {
13051305 rollback = append (rollback , chunk [:n ]... )
13061306 }
1307- log .Debug ("Invalid header encountered" , "number" , chunk [n ].Number , "hash" , chunk [n ].Hash (). Hex ()[ 2 : 10 ] , "err" , err )
1307+ log .Debug ("Invalid header encountered" , "number" , chunk [n ].Number , "hash" , chunk [n ].Hash (), "err" , err )
13081308 return errInvalidChain
13091309 }
13101310 // All verifications passed, store newly found uncertain headers
@@ -1316,7 +1316,7 @@ func (d *Downloader) processHeaders(origin uint64, td *big.Int) error {
13161316 // If we're fast syncing and just pulled in the pivot, make sure it's the one locked in
13171317 if d .mode == FastSync && d .fsPivotLock != nil && chunk [0 ].Number .Uint64 () <= pivot && chunk [len (chunk )- 1 ].Number .Uint64 () >= pivot {
13181318 if pivot := chunk [int (pivot - chunk [0 ].Number .Uint64 ())]; pivot .Hash () != d .fsPivotLock .Hash () {
1319- log .Warn ("Pivot doesn't match locked in one" , "remoteNumber" , pivot .Number , "remoteHash" , pivot .Hash (). Hex ()[ 2 : 10 ] , "localNumber" , d .fsPivotLock .Number , "localHash" , d .fsPivotLock .Hash (). Hex ()[ 2 : 10 ] )
1319+ log .Warn ("Pivot doesn't match locked in one" , "remoteNumber" , pivot .Number , "remoteHash" , pivot .Hash (), "localNumber" , d .fsPivotLock .Number , "localHash" , d .fsPivotLock .Hash ())
13201320 return errInvalidChain
13211321 }
13221322 }
@@ -1366,13 +1366,9 @@ func (d *Downloader) processContent() error {
13661366 // Actually import the blocks
13671367 first , last := results [0 ].Header , results [len (results )- 1 ].Header
13681368 log .Debug ("Inserting downloaded chain" , "items" , len (results ),
1369- "from" , log.Lazy {Fn : func () string {
1370- return fmt .Sprintf ("#%d [%x…]" , first .Number , first .Hash ().Bytes ()[:4 ])
1371- }},
1372- "till" , log.Lazy {Fn : func () string {
1373- return fmt .Sprintf ("#%d [%x…]" , last .Number , last .Hash ().Bytes ()[:4 ])
1374- }})
1375-
1369+ "firstnum" , first .Number , "firsthash" , first .Hash (),
1370+ "lastnum" , last .Number , "lasthash" , last .Hash (),
1371+ )
13761372 for len (results ) != 0 {
13771373 // Check for any termination requests
13781374 select {
@@ -1406,14 +1402,14 @@ func (d *Downloader) processContent() error {
14061402 case len (receipts ) > 0 :
14071403 index , err = d .insertReceipts (blocks , receipts )
14081404 if err == nil && blocks [len (blocks )- 1 ].NumberU64 () == pivot {
1409- log .Debug ("Committing block as new head" , "number" , blocks [len (blocks )- 1 ].Number (), "hash" , blocks [len (blocks )- 1 ].Hash (). Hex ()[ 2 : 10 ] )
1405+ log .Debug ("Committing block as new head" , "number" , blocks [len (blocks )- 1 ].Number (), "hash" , blocks [len (blocks )- 1 ].Hash ())
14101406 index , err = len (blocks )- 1 , d .commitHeadBlock (blocks [len (blocks )- 1 ].Hash ())
14111407 }
14121408 default :
14131409 index , err = d .insertBlocks (blocks )
14141410 }
14151411 if err != nil {
1416- log .Debug ("Downloaded item processing failed" , "number" , results [index ].Header .Number , "hash" , results [index ].Header .Hash (). Hex ()[ 2 : 10 ] , "err" , err )
1412+ log .Debug ("Downloaded item processing failed" , "number" , results [index ].Header .Number , "hash" , results [index ].Header .Hash (), "err" , err )
14171413 return errInvalidChain
14181414 }
14191415 // Shift the results to the next batch
0 commit comments