aboutsummaryrefslogtreecommitdiffstats
path: root/core/types/dkg.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-10-19 18:39:17 +0800
committerGitHub <noreply@github.com>2018-10-19 18:39:17 +0800
commit1f7491df37caf974ffa0c824c4c02a8fe2aafcd9 (patch)
tree55c6e653c3d78ab34e3fbe8627ba1c0a62cb53a8 /core/types/dkg.go
parentbec97aadfa95ebb42ef042bd53c7976ae410c496 (diff)
downloaddexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar.gz
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar.bz2
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar.lz
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar.xz
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.tar.zst
dexon-consensus-1f7491df37caf974ffa0c824c4c02a8fe2aafcd9.zip
core: initial commit for logger (#228)
* Replace "log.*" with logger. * Add simple logger to log with log package. * Add debug logs to all calls to these interfaces: - core.Application - core.Governance - core.Network * Add Stringer to these types: - types.DKGComplaint - types.AgreementResult - types.DKGMasterPublicKey - types.DKGFinalize
Diffstat (limited to 'core/types/dkg.go')
-rw-r--r--core/types/dkg.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/types/dkg.go b/core/types/dkg.go
index c13740b..6018ebd 100644
--- a/core/types/dkg.go
+++ b/core/types/dkg.go
@@ -53,6 +53,12 @@ type DKGMasterPublicKey struct {
Signature crypto.Signature `json:"signature"`
}
+func (d *DKGMasterPublicKey) String() string {
+ return fmt.Sprintf("MasterPublicKey[%s:%d]",
+ d.ProposerID.String()[:6],
+ d.Round)
+}
+
// NewDKGMasterPublicKey returns a new DKGMasterPublicKey instance.
func NewDKGMasterPublicKey() *DKGMasterPublicKey {
return &DKGMasterPublicKey{
@@ -75,6 +81,11 @@ type DKGComplaint struct {
Signature crypto.Signature `json:"signature"`
}
+func (c *DKGComplaint) String() string {
+ return fmt.Sprintf("DKGComplaint[%s:%d]%s",
+ c.ProposerID.String()[:6], c.Round, &c.PrivateShare)
+}
+
// DKGPartialSignature describe a partial signature in DKG protocol.
type DKGPartialSignature struct {
ProposerID NodeID `json:"proposer_id"`
@@ -91,6 +102,12 @@ type DKGFinalize struct {
Signature crypto.Signature `json:"signature"`
}
+func (final *DKGFinalize) String() string {
+ return fmt.Sprintf("DKGFinal[%s:%d]",
+ final.ProposerID.String()[:6],
+ final.Round)
+}
+
// IsNack returns true if it's a nack complaint in DKG protocol.
func (c *DKGComplaint) IsNack() bool {
return len(c.PrivateShare.Signature.Signature) == 0