@@ -187,7 +187,7 @@ func NewChainWithContext(ctx context.Context, cfg *Config) (c *Chain, err error)
187187 "irre_count" : irre .count ,
188188 "head_hash" : v .hash .Short (4 ),
189189 "head_count" : v .count ,
190- }).Debug ("Checking head" )
190+ }).Debug ("checking head" )
191191 if v .hasAncestor (irre ) {
192192 if br , ierr = fork (irre , v , immutable , txPool ); ierr != nil {
193193 err = errors .Wrapf (ierr , "failed to rebuild branch with head %s" , v .hash .Short (4 ))
@@ -341,7 +341,7 @@ func (c *Chain) produceBlock(now time.Time) (err error) {
341341 "block_time" : b .Timestamp (),
342342 "block_hash" : b .BlockHash ().Short (4 ),
343343 "parent_hash" : b .ParentHash ().Short (4 ),
344- }).WithError (err ).Debug ("Broadcasting new block to other peers" )
344+ }).WithError (err ).Debug ("broadcasting new block to other peers" )
345345 }, c .period )
346346 }(s )
347347 }
@@ -436,7 +436,7 @@ func (c *Chain) syncHeads() {
436436 log .WithFields (log.Fields {
437437 "next_height" : c .getNextHeight (),
438438 "height" : h ,
439- }).Debug ("Synchronizing head blocks" )
439+ }).Debug ("synchronizing head blocks" )
440440 c .syncCurrentHead (c .ctx )
441441 }
442442 c .increaseNextHeight ()
@@ -502,7 +502,7 @@ func (c *Chain) addTx(tx pi.Transaction) {
502502 "remote" : id ,
503503 "tx_hash" : tx .Hash ().Short (4 ),
504504 "tx_type" : tx .GetTransactionType (),
505- }).WithError (err ).Debug ("Broadcasting transaction to other peers" )
505+ }).WithError (err ).Debug ("broadcasting transaction to other peers" )
506506 }, c .period )
507507 }(v )
508508 }
@@ -511,17 +511,17 @@ func (c *Chain) addTx(tx pi.Transaction) {
511511 select {
512512 case c .pendingTxs <- tx :
513513 case <- c .ctx .Done ():
514- log .WithError (c .ctx .Err ()).Error ("Add transaction aborted" )
514+ log .WithError (c .ctx .Err ()).Error ("add transaction aborted" )
515515 }
516516}
517517
518518func (c * Chain ) processTx (tx pi.Transaction ) {
519519 if err := tx .Verify (); err != nil {
520- log .WithError (err ).Error ("Failed to verify transaction" )
520+ log .WithError (err ).Error ("failed to verify transaction" )
521521 return
522522 }
523523 if err := c .storeTx (tx ); err != nil {
524- log .WithError (err ).Error ("Failed to add transaction" )
524+ log .WithError (err ).Error ("failed to add transaction" )
525525 }
526526}
527527
@@ -540,7 +540,7 @@ func (c *Chain) mainCycle(ctx context.Context) {
540540 for {
541541 select {
542542 case <- ctx .Done ():
543- log .WithError (ctx .Err ()).Debug ("Abort main cycle" )
543+ log .WithError (ctx .Err ()).Debug ("abort main cycle" )
544544 return
545545 default :
546546 c .syncCurrentHead (ctx ) // Try to fetch block at height `nextHeight-1`
@@ -553,7 +553,7 @@ func (c *Chain) mainCycle(ctx context.Context) {
553553 "head_block" : c .head ().hash .Short (4 ),
554554 "now_time" : t .Format (time .RFC3339Nano ),
555555 "duration" : d ,
556- }).Debug ("Main cycle" )
556+ }).Debug ("main cycle" )
557557 time .Sleep (d )
558558 } else {
559559 // Try to produce block at `nextHeight` if it's my turn, and increase height by 1
@@ -603,7 +603,7 @@ func (c *Chain) syncCurrentHead(ctx context.Context) {
603603 "local" : c .peerInfo (),
604604 "remote" : id ,
605605 "height" : h ,
606- }).WithError (err ).Warn ("Failed to fetch block" )
606+ }).WithError (err ).Warn ("failed to fetch block" )
607607 return
608608 }
609609 log .WithFields (log.Fields {
@@ -612,11 +612,11 @@ func (c *Chain) syncCurrentHead(ctx context.Context) {
612612 "height" : h ,
613613 "parent" : resp .Block .ParentHash ().Short (4 ),
614614 "hash" : resp .Block .BlockHash ().Short (4 ),
615- }).Debug ("Fetched new block from remote peer" )
615+ }).Debug ("fetched new block from remote peer" )
616616 select {
617617 case c .pendingBlocks <- resp .Block :
618618 case <- cld .Done ():
619- log .WithError (cld .Err ()).Warn ("Add pending block aborted" )
619+ log .WithError (cld .Err ()).Warn ("add pending block aborted" )
620620 }
621621 }(v )
622622 }
@@ -626,11 +626,11 @@ func (c *Chain) syncCurrentHead(ctx context.Context) {
626626// Stop stops the main process of the sql-chain.
627627func (c * Chain ) Stop () (err error ) {
628628 // Stop main process
629- log .WithFields (log.Fields {"peer" : c .peerInfo ()}).Debug ("Stopping chain" )
629+ log .WithFields (log.Fields {"peer" : c .peerInfo ()}).Debug ("stopping chain" )
630630 c .stop ()
631- log .WithFields (log.Fields {"peer" : c .peerInfo ()}).Debug ("Chain service stopped" )
631+ log .WithFields (log.Fields {"peer" : c .peerInfo ()}).Debug ("chain service stopped" )
632632 c .st .Close ()
633- log .WithFields (log.Fields {"peer" : c .peerInfo ()}).Debug ("Chain database closed" )
633+ log .WithFields (log.Fields {"peer" : c .peerInfo ()}).Debug ("chain database closed" )
634634 close (c .pendingBlocks )
635635 close (c .pendingTxs )
636636 return
@@ -694,7 +694,7 @@ func (c *Chain) switchBranch(bl *types.BPBlock, origin int, head *branch) (err e
694694 for _ , b := range newIrres {
695695 for _ , tx := range b .block .Transactions {
696696 if err := c .immutable .apply (tx ); err != nil {
697- log .WithError (err ).Fatal ("Failed to apply block to immutable database" )
697+ log .WithError (err ).Fatal ("failed to apply block to immutable database" )
698698 }
699699 }
700700 }
@@ -753,7 +753,7 @@ func (c *Chain) switchBranch(bl *types.BPBlock, origin int, head *branch) (err e
753753 }
754754 return fmt .Sprintf ("[%04d]" , i )
755755 }(),
756- }).Debugf ("Pruning branch" )
756+ }).Debugf ("pruning branch" )
757757 }
758758 }
759759 // Replace current branches
@@ -793,7 +793,7 @@ func (c *Chain) stat() {
793793 buff += v .sprint (c .lastIrre .count )
794794 log .WithFields (log.Fields {
795795 "branch" : buff ,
796- }).Info ("Runtime state" )
796+ }).Info ("runtime state" )
797797 }
798798 return
799799}
0 commit comments