aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-28 10:56:33 +0800
committerGitHub <noreply@github.com>2019-03-28 10:56:33 +0800
commitc0995cb576b840432114011791b39aa904602570 (patch)
tree14f8caa3d77c6be71d36d156b1b8a1f9783cc3eb
parent5f5d8a58dd853f32340469681f7454b838fc4786 (diff)
downloadtangerine-consensus-c0995cb576b840432114011791b39aa904602570.tar.gz
tangerine-consensus-c0995cb576b840432114011791b39aa904602570.tar.zst
tangerine-consensus-c0995cb576b840432114011791b39aa904602570.zip
core: add log for restarting BA (#524)
* core: add log for restart BA * Add log for changing round
-rw-r--r--core/agreement.go2
-rw-r--r--core/consensus.go1
-rw-r--r--core/types/node.go5
3 files changed, 8 insertions, 0 deletions
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