aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2019-04-03 16:43:14 +0800
committerMission Liao <mission.liao@dexon.org>2019-04-15 14:41:19 +0800
commit2a1d46ebb1a0e620edfae791b72c72b7d212b06a (patch)
tree2a2f13fc64bb7aded5f9349465b3e685ff1f7fee
parent52bf529c57ec881cb2eb9498e56a09029ac00d67 (diff)
downloaddexon-consensus-2a1d46ebb1a0e620edfae791b72c72b7d212b06a.tar.gz
dexon-consensus-2a1d46ebb1a0e620edfae791b72c72b7d212b06a.tar.zst
dexon-consensus-2a1d46ebb1a0e620edfae791b72c72b7d212b06a.zip
Log vote type in name
-rw-r--r--core/types/vote.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/core/types/vote.go b/core/types/vote.go
index 8bc0c78..8bb27c1 100644
--- a/core/types/vote.go
+++ b/core/types/vote.go
@@ -39,6 +39,23 @@ const (
MaxVoteType
)
+func (t VoteType) String() string {
+ switch t {
+ case VoteInit:
+ return "Init"
+ case VotePreCom:
+ return "PreCom"
+ case VoteCom:
+ return "Com"
+ case VoteFast:
+ return "Fast"
+ case VoteFastCom:
+ return "FastCom"
+ default:
+ return fmt.Sprintf("Unknown-%d", t)
+ }
+}
+
// NullBlockHash is the blockHash for ⊥ value.
var NullBlockHash common.Hash
@@ -68,7 +85,7 @@ type Vote struct {
}
func (v *Vote) String() string {
- return fmt.Sprintf("Vote{VP:%s %s Period:%d Type:%d Hash:%s}",
+ return fmt.Sprintf("Vote{VP:%s %s Period:%d Type:%s Hash:%s}",
v.ProposerID.String()[:6],
v.Position, v.Period, v.Type, v.BlockHash.String()[:6])
}