aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-21 08:37:33 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:58 +0800
commit9ad0e05b15f8b36f38f19cc1b24dc8b93e845844 (patch)
tree8dd2847c1003a1de9757990ebb53a8322cba333b /dex
parent86eb10fc5f853507baafde992b81647d41f2a587 (diff)
downloaddexon-9ad0e05b15f8b36f38f19cc1b24dc8b93e845844.tar
dexon-9ad0e05b15f8b36f38f19cc1b24dc8b93e845844.tar.gz
dexon-9ad0e05b15f8b36f38f19cc1b24dc8b93e845844.tar.bz2
dexon-9ad0e05b15f8b36f38f19cc1b24dc8b93e845844.tar.lz
dexon-9ad0e05b15f8b36f38f19cc1b24dc8b93e845844.tar.xz
dexon-9ad0e05b15f8b36f38f19cc1b24dc8b93e845844.tar.zst
dexon-9ad0e05b15f8b36f38f19cc1b24dc8b93e845844.zip
core/vm: remove round from addDKG functions (#279)
* vendor: sync to latest core * core/vm: remove addDKG functions * core: fix conflict
Diffstat (limited to 'dex')
-rw-r--r--dex/db/db.go18
-rw-r--r--dex/downloader/testchain_test.go6
-rw-r--r--dex/governance.go16
3 files changed, 20 insertions, 20 deletions
diff --git a/dex/db/db.go b/dex/db/db.go
index b172f924b..2930400b2 100644
--- a/dex/db/db.go
+++ b/dex/db/db.go
@@ -104,18 +104,18 @@ func (d *DB) GetCompactionChainTipInfo() (hash coreCommon.Hash, height uint64) {
return rawdb.ReadCoreCompactionChainTip(d.db)
}
-func (d *DB) PutOrUpdateDKGMasterPrivateShares(
- round uint64, shares coreDKG.PrivateKeyShares) error {
- return rawdb.WriteCoreDKGMasterPrivateShares(d.db, round, &shares)
+func (d *DB) PutOrUpdateDKGProtocol(
+ protocol coreDb.DKGProtocolInfo) error {
+ return rawdb.WriteCoreDKGProtocol(d.db, &protocol)
}
-func (d *DB) GetDKGMasterPrivateShares(round uint64) (
- shares coreDKG.PrivateKeyShares, err error) {
- mpk := rawdb.ReadCoreDKGMasterPrivateShares(d.db, round)
- if mpk == nil {
- return coreDKG.PrivateKeyShares{}, coreDb.ErrDKGMasterPrivateSharesDoesNotExist
+func (d *DB) GetDKGProtocol() (
+ protocol coreDb.DKGProtocolInfo, err error) {
+ dkgProtocol := rawdb.ReadCoreDKGProtocol(d.db)
+ if dkgProtocol == nil {
+ return coreDb.DKGProtocolInfo{}, coreDb.ErrDKGProtocolDoesNotExist
}
- return *mpk, nil
+ return *dkgProtocol, nil
}
func (d *DB) Close() error { return nil }
diff --git a/dex/downloader/testchain_test.go b/dex/downloader/testchain_test.go
index 15528c509..b59a83b2c 100644
--- a/dex/downloader/testchain_test.go
+++ b/dex/downloader/testchain_test.go
@@ -192,7 +192,7 @@ func (tc *testChain) generate(n int, seed byte, parent *types.Block, nodes *dexc
// Add DKG MasterPublicKeys
for _, node := range testNodes.Nodes(round + 1) {
- data, err := vm.PackAddDKGMasterPublicKey(round+1, node.MasterPublicKey(round+1))
+ data, err := vm.PackAddDKGMasterPublicKey(node.MasterPublicKey(round + 1))
if err != nil {
panic(err)
}
@@ -201,7 +201,7 @@ func (tc *testChain) generate(n int, seed byte, parent *types.Block, nodes *dexc
case half + 2:
// Add DKG MPKReady
for _, node := range testNodes.Nodes(round + 1) {
- data, err := vm.PackAddDKGMPKReady(round+1, node.DKGMPKReady(round+1))
+ data, err := vm.PackAddDKGMPKReady(node.DKGMPKReady(round + 1))
if err != nil {
panic(err)
}
@@ -210,7 +210,7 @@ func (tc *testChain) generate(n int, seed byte, parent *types.Block, nodes *dexc
case half + 3:
// Add DKG Finalize
for _, node := range testNodes.Nodes(round + 1) {
- data, err := vm.PackAddDKGFinalize(round+1, node.DKGFinalize(round+1))
+ data, err := vm.PackAddDKGFinalize(node.DKGFinalize(round + 1))
if err != nil {
panic(err)
}
diff --git a/dex/governance.go b/dex/governance.go
index 0d6ca0eba..0614ae910 100644
--- a/dex/governance.go
+++ b/dex/governance.go
@@ -122,8 +122,8 @@ func (d *DexconGovernance) ProposeCRS(round uint64, signedCRS []byte) {
}
// AddDKGComplaint adds a DKGComplaint.
-func (d *DexconGovernance) AddDKGComplaint(round uint64, complaint *dkgTypes.Complaint) {
- data, err := vm.PackAddDKGComplaint(round, complaint)
+func (d *DexconGovernance) AddDKGComplaint(complaint *dkgTypes.Complaint) {
+ data, err := vm.PackAddDKGComplaint(complaint)
if err != nil {
log.Error("failed to pack addDKGComplaint input", "err", err)
return
@@ -136,8 +136,8 @@ func (d *DexconGovernance) AddDKGComplaint(round uint64, complaint *dkgTypes.Com
}
// AddDKGMasterPublicKey adds a DKGMasterPublicKey.
-func (d *DexconGovernance) AddDKGMasterPublicKey(round uint64, masterPublicKey *dkgTypes.MasterPublicKey) {
- data, err := vm.PackAddDKGMasterPublicKey(round, masterPublicKey)
+func (d *DexconGovernance) AddDKGMasterPublicKey(masterPublicKey *dkgTypes.MasterPublicKey) {
+ data, err := vm.PackAddDKGMasterPublicKey(masterPublicKey)
if err != nil {
log.Error("failed to pack addDKGMasterPublicKey input", "err", err)
return
@@ -150,8 +150,8 @@ func (d *DexconGovernance) AddDKGMasterPublicKey(round uint64, masterPublicKey *
}
// AddDKGMPKReady adds a DKG mpk ready message.
-func (d *DexconGovernance) AddDKGMPKReady(round uint64, ready *dkgTypes.MPKReady) {
- data, err := vm.PackAddDKGMPKReady(round, ready)
+func (d *DexconGovernance) AddDKGMPKReady(ready *dkgTypes.MPKReady) {
+ data, err := vm.PackAddDKGMPKReady(ready)
if err != nil {
log.Error("failed to pack addDKGMPKReady input", "err", err)
return
@@ -164,8 +164,8 @@ func (d *DexconGovernance) AddDKGMPKReady(round uint64, ready *dkgTypes.MPKReady
}
// AddDKGFinalize adds a DKG finalize message.
-func (d *DexconGovernance) AddDKGFinalize(round uint64, final *dkgTypes.Finalize) {
- data, err := vm.PackAddDKGFinalize(round, final)
+func (d *DexconGovernance) AddDKGFinalize(final *dkgTypes.Finalize) {
+ data, err := vm.PackAddDKGFinalize(final)
if err != nil {
log.Error("failed to pack addDKGFinalize input", "err", err)
return