aboutsummaryrefslogtreecommitdiffstats
path: root/core/db/interfaces.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/db/interfaces.go')
-rw-r--r--core/db/interfaces.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/db/interfaces.go b/core/db/interfaces.go
index 3ffba4a..ebbbbd4 100644
--- a/core/db/interfaces.go
+++ b/core/db/interfaces.go
@@ -22,6 +22,7 @@ import (
"fmt"
"github.com/dexon-foundation/dexon-consensus/common"
+ "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg"
"github.com/dexon-foundation/dexon-consensus/core/types"
)
@@ -43,6 +44,12 @@ var (
// current cached one.
ErrInvalidCompactionChainTipHeight = fmt.Errorf(
"invalid compaction chain tip height")
+ // ErrDKGPrivateKeyExists raised when attempting to save DKG private key
+ // that already saved.
+ ErrDKGPrivateKeyExists = errors.New("dkg private key exists")
+ // ErrDKGPrivateKeyDoesNotExist raised when the DKG private key of the
+ // requested round does not exists.
+ ErrDKGPrivateKeyDoesNotExist = errors.New("dkg private key does not exists")
)
// Database is the interface for a Database.
@@ -65,6 +72,10 @@ type Reader interface {
// of the tip block of compaction chain. Empty hash and zero height means
// the compaction chain is empty.
GetCompactionChainTipInfo() (common.Hash, uint64)
+
+ // DKG Private Key related methods.
+ HasDKGPrivateKey(round uint64) (bool, error)
+ GetDKGPrivateKey(round uint64) (dkg.PrivateKey, error)
}
// Writer defines the interface for writing blocks into DB.
@@ -72,6 +83,7 @@ type Writer interface {
UpdateBlock(block types.Block) error
PutBlock(block types.Block) error
PutCompactionChainTipInfo(common.Hash, uint64) error
+ PutDKGPrivateKey(uint64, dkg.PrivateKey) error
}
// BlockIterator defines an iterator on blocks hold