aboutsummaryrefslogtreecommitdiffstats
path: root/core/interfaces.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-09-26 16:55:15 +0800
committerGitHub <noreply@github.com>2018-09-26 16:55:15 +0800
commit663817d3e0d5a3c28cb0c5e378a533e242af5fdf (patch)
tree8d1952cc04a5735ce7cd060445667160bb21fc60 /core/interfaces.go
parente8468d7206dbee2a8dfb34bfccc29d0d7273a777 (diff)
downloadtangerine-consensus-663817d3e0d5a3c28cb0c5e378a533e242af5fdf.tar
tangerine-consensus-663817d3e0d5a3c28cb0c5e378a533e242af5fdf.tar.gz
tangerine-consensus-663817d3e0d5a3c28cb0c5e378a533e242af5fdf.tar.bz2
tangerine-consensus-663817d3e0d5a3c28cb0c5e378a533e242af5fdf.tar.lz
tangerine-consensus-663817d3e0d5a3c28cb0c5e378a533e242af5fdf.tar.xz
tangerine-consensus-663817d3e0d5a3c28cb0c5e378a533e242af5fdf.tar.zst
tangerine-consensus-663817d3e0d5a3c28cb0c5e378a533e242af5fdf.zip
core: move crypto to core/crypto (#140)
- Move key-holder to authenticator Make core.keyHolder public as core.Authenticator, it is not required to make this part an interface. - Make private when there is no need to go public. - Fix data race
Diffstat (limited to 'core/interfaces.go')
-rw-r--r--core/interfaces.go36
1 files changed, 3 insertions, 33 deletions
diff --git a/core/interfaces.go b/core/interfaces.go
index 7f6ff2b..eebf8ff 100644
--- a/core/interfaces.go
+++ b/core/interfaces.go
@@ -21,8 +21,8 @@ import (
"time"
"github.com/dexon-foundation/dexon-consensus-core/common"
+ "github.com/dexon-foundation/dexon-consensus-core/core/crypto"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
- "github.com/dexon-foundation/dexon-consensus-core/crypto"
)
// Application describes the application interface that interacts with DEXON
@@ -56,7 +56,7 @@ type Debug interface {
// TotalOrderingDelivered is called when the total ordering algorithm deliver
// a set of block.
- TotalOrderingDelivered(blockHashes common.Hashes, early bool)
+ TotalOrderingDelivered(common.Hashes, bool)
}
// Network describs the network interface that interacts with DEXON consensus
@@ -101,7 +101,7 @@ type Governance interface {
ProposeThresholdSignature(round uint64, signature crypto.Signature)
// Get a ThresholdSignature of round.
- GetThresholdSignature(round uint64) (sig crypto.Signature, exist bool)
+ GetThresholdSignature(round uint64) (crypto.Signature, bool)
//// DKG-related methods.
@@ -126,33 +126,3 @@ type Ticker interface {
// Stop the ticker.
Stop()
}
-
-// Signer defines a role to sign data.
-type Signer interface {
- // SignBlock signs a block.
- SignBlock(b *types.Block) error
-
- // SignVote signs a vote.
- SignVote(v *types.Vote) error
-
- // SignCRS sign a block's CRS signature.
- SignCRS(b *types.Block, crs common.Hash) error
-}
-
-// CryptoVerifier defines a role to verify data in crypto's way.
-type CryptoVerifier interface {
- // VerifyBlock verifies if a block is properly signed or not.
- VerifyBlock(b *types.Block) (ok bool, err error)
-
- // VerifyVote verfies if a vote is properly signed or not.
- VerifyVote(v *types.Vote) (ok bool, err error)
-
- // VerifyCRS verifies if a CRS signature of one block is valid or not.
- VerifyCRS(b *types.Block, crs common.Hash) (ok bool, err error)
-}
-
-// Authenticator verify/sign who own the data.
-type Authenticator interface {
- Signer
- CryptoVerifier
-}