From c0995cb576b840432114011791b39aa904602570 Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Thu, 28 Mar 2019 10:56:33 +0800 Subject: core: add log for restarting BA (#524) * core: add log for restart BA * Add log for changing round --- core/agreement.go | 2 ++ core/consensus.go | 1 + core/types/node.go | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/core/agreement.go b/core/agreement.go index d4f1bbd..6727ecb 100644 --- a/core/agreement.go +++ b/core/agreement.go @@ -171,6 +171,8 @@ func (a *agreement) restart( return false } } + a.logger.Debug("Restarting BA", + "notarySet", notarySet, "position", aID, "leader", leader) a.data.lock.Lock() defer a.data.lock.Unlock() a.data.blocksLock.Lock() diff --git a/core/consensus.go b/core/consensus.go index a02f8c1..19ba74c 100644 --- a/core/consensus.go +++ b/core/consensus.go @@ -391,6 +391,7 @@ CleanChannelLoop: } newPos := block.Position if block.Position.Height+1 == recv.changeNotaryHeight() { + recv.consensus.logger.Info("Round will change", "block", block) newPos.Round++ recv.updateRound(newPos.Round) } diff --git a/core/types/node.go b/core/types/node.go index 2c90f65..18b6831 100644 --- a/core/types/node.go +++ b/core/types/node.go @@ -19,6 +19,7 @@ package types import ( "bytes" + "encoding/hex" "github.com/dexon-foundation/dexon-consensus/common" "github.com/dexon-foundation/dexon-consensus/core/crypto" @@ -40,6 +41,10 @@ func (v NodeID) Equal(v2 NodeID) bool { return v.Hash == v2.Hash } +func (v NodeID) String() string { + return hex.EncodeToString(v.Hash[:])[:6] +} + // NodeIDs implements sort.Interface for NodeID. type NodeIDs []NodeID -- cgit v1.2.3