diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-18 16:27:18 +0800 |
---|---|---|
committer | Jimmy Hu <jimmy.hu@dexon.org> | 2018-10-18 16:27:18 +0800 |
commit | 3b3d02f94519a1fd38936d2f7f2dda09e1b5a534 (patch) | |
tree | c576acaf3ba42a12803060940d0f772b5202f3eb /core/types/dkg.go | |
parent | 43299221c586bfb55e225799aedc6d133ba97c3f (diff) | |
download | tangerine-consensus-3b3d02f94519a1fd38936d2f7f2dda09e1b5a534.tar tangerine-consensus-3b3d02f94519a1fd38936d2f7f2dda09e1b5a534.tar.gz tangerine-consensus-3b3d02f94519a1fd38936d2f7f2dda09e1b5a534.tar.bz2 tangerine-consensus-3b3d02f94519a1fd38936d2f7f2dda09e1b5a534.tar.lz tangerine-consensus-3b3d02f94519a1fd38936d2f7f2dda09e1b5a534.tar.xz tangerine-consensus-3b3d02f94519a1fd38936d2f7f2dda09e1b5a534.tar.zst tangerine-consensus-3b3d02f94519a1fd38936d2f7f2dda09e1b5a534.zip |
core: types: implements UnmarshalJSON from DKGMasterPublicKey (#223)
Diffstat (limited to 'core/types/dkg.go')
-rw-r--r-- | core/types/dkg.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/types/dkg.go b/core/types/dkg.go index c761504..c13740b 100644 --- a/core/types/dkg.go +++ b/core/types/dkg.go @@ -18,6 +18,7 @@ package types import ( + "encoding/json" "fmt" "github.com/dexon-foundation/dexon-consensus-core/common" @@ -59,6 +60,13 @@ func NewDKGMasterPublicKey() *DKGMasterPublicKey { } } +// UnmarshalJSON implements json.Unmarshaller. +func (d *DKGMasterPublicKey) UnmarshalJSON(data []byte) error { + type innertDKGMasterPublicKey DKGMasterPublicKey + d.PublicKeyShares = *dkg.NewEmptyPublicKeyShares() + return json.Unmarshal(data, (*innertDKGMasterPublicKey)(d)) +} + // DKGComplaint describe a complaint in DKG protocol. type DKGComplaint struct { ProposerID NodeID `json:"proposer_id"` |