aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-13 18:19:53 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:22 +0800
commit43457d6a008524f9dd353fce7b12e16cd4d0e157 (patch)
tree12782a2db49a1ee4e1fa97db64901251eeed36af /vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go
parenta0684dc255fb2d3db22ea4c03957d9b7b27a0a36 (diff)
downloadgo-tangerine-43457d6a008524f9dd353fce7b12e16cd4d0e157.tar
go-tangerine-43457d6a008524f9dd353fce7b12e16cd4d0e157.tar.gz
go-tangerine-43457d6a008524f9dd353fce7b12e16cd4d0e157.tar.bz2
go-tangerine-43457d6a008524f9dd353fce7b12e16cd4d0e157.tar.lz
go-tangerine-43457d6a008524f9dd353fce7b12e16cd4d0e157.tar.xz
go-tangerine-43457d6a008524f9dd353fce7b12e16cd4d0e157.tar.zst
go-tangerine-43457d6a008524f9dd353fce7b12e16cd4d0e157.zip
vendor: sync to latest core (#253)
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go
index 6c812db73..259d07a4b 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/dkg-tsig-protocol.go
@@ -24,6 +24,7 @@ import (
"github.com/dexon-foundation/dexon-consensus/common"
"github.com/dexon-foundation/dexon-consensus/core/crypto"
"github.com/dexon-foundation/dexon-consensus/core/crypto/dkg"
+ "github.com/dexon-foundation/dexon-consensus/core/db"
"github.com/dexon-foundation/dexon-consensus/core/types"
typesDKG "github.com/dexon-foundation/dexon-consensus/core/types/dkg"
"github.com/dexon-foundation/dexon-consensus/core/utils"
@@ -164,6 +165,35 @@ func newDKGProtocol(
}
}
+func recoverDKGProtocol(
+ ID types.NodeID,
+ recv dkgReceiver,
+ round uint64,
+ threshold int,
+ coreDB db.Database) (*dkgProtocol, error) {
+ shares, err := coreDB.GetDKGMasterPrivateShares(round)
+ if err != nil {
+ if err == db.ErrDKGMasterPrivateSharesDoesNotExist {
+ return nil, nil
+ }
+
+ return nil, err
+ }
+ return &dkgProtocol{
+ ID: ID,
+ recv: recv,
+ round: round,
+ threshold: threshold,
+ idMap: make(map[types.NodeID]dkg.ID),
+ mpkMap: make(map[types.NodeID]*dkg.PublicKeyShares),
+ masterPrivateShare: &shares,
+ prvShares: dkg.NewEmptyPrivateKeyShares(),
+ prvSharesReceived: make(map[types.NodeID]struct{}),
+ nodeComplained: make(map[types.NodeID]struct{}),
+ antiComplaintReceived: make(map[types.NodeID]map[types.NodeID]struct{}),
+ }, nil
+}
+
func (d *dkgProtocol) processMasterPublicKeys(
mpks []*typesDKG.MasterPublicKey) (err error) {
d.idMap = make(map[types.NodeID]dkg.ID, len(mpks))