diff options
Diffstat (limited to 'core/rawdb/accessors_core_dkg_master_private_shares.go')
-rw-r--r-- | core/rawdb/accessors_core_dkg_master_private_shares.go | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/core/rawdb/accessors_core_dkg_master_private_shares.go b/core/rawdb/accessors_core_dkg_master_private_shares.go deleted file mode 100644 index 23b37f361..000000000 --- a/core/rawdb/accessors_core_dkg_master_private_shares.go +++ /dev/null @@ -1,44 +0,0 @@ -package rawdb - -import ( - "bytes" - - coreDKG "github.com/dexon-foundation/dexon-consensus/core/crypto/dkg" - "github.com/dexon-foundation/dexon/log" - "github.com/dexon-foundation/dexon/rlp" -) - -func ReadCoreDKGMasterPrivateSharesRLP(db DatabaseReader, round uint64) rlp.RawValue { - data, _ := db.Get(coreDKGMasterPrivateSharesKey(round)) - return data -} - -func WriteCoreDKGMasterPrivateSharesRLP(db DatabaseWriter, round uint64, rlp rlp.RawValue) error { - err := db.Put(coreDKGMasterPrivateSharesKey(round), rlp) - if err != nil { - log.Crit("Failed to store core DKG private key", "err", err, "round", round) - } - return err -} - -func ReadCoreDKGMasterPrivateShares(db DatabaseReader, round uint64) *coreDKG.PrivateKeyShares { - data := ReadCoreDKGMasterPrivateSharesRLP(db, round) - if len(data) == 0 { - return nil - } - shares := new(coreDKG.PrivateKeyShares) - if err := rlp.Decode(bytes.NewReader(data), shares); err != nil { - log.Error("Invalid core DKG master private shares RLP", "round", round, "err", err) - return nil - } - return shares -} - -func WriteCoreDKGMasterPrivateShares(db DatabaseWriter, round uint64, shares *coreDKG.PrivateKeyShares) error { - data, err := rlp.EncodeToBytes(shares) - if err != nil { - log.Crit("Failed to RLP encode core DKG master private shares", "round", round, "err", err) - return err - } - return WriteCoreDKGMasterPrivateSharesRLP(db, round, data) -} |