diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-09-26 17:13:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-26 17:13:37 +0800 |
commit | 7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe (patch) | |
tree | 41b823a05f81615558a37567dab85e2958b59329 /core/consensus.go | |
parent | 663817d3e0d5a3c28cb0c5e378a533e242af5fdf (diff) | |
download | tangerine-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar tangerine-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar.gz tangerine-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar.bz2 tangerine-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar.lz tangerine-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar.xz tangerine-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.tar.zst tangerine-consensus-7450e6ba7f7299d03b04a7e2a9b3bc5911b94cfe.zip |
crypto: sigtopub to crypto package. remove SigToPubFn (#141)
Diffstat (limited to 'core/consensus.go')
-rw-r--r-- | core/consensus.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/core/consensus.go b/core/consensus.go index b8c8f77..f2b945b 100644 --- a/core/consensus.go +++ b/core/consensus.go @@ -31,10 +31,6 @@ import ( "github.com/dexon-foundation/dexon-consensus-core/core/types" ) -// SigToPubFn is a function to recover public key from signature. -type SigToPubFn func(hash common.Hash, signature crypto.Signature) ( - crypto.PublicKey, error) - // ErrMissingBlockInfo would be reported if some information is missing when // calling PrepareBlock. It implements error interface. type ErrMissingBlockInfo struct { @@ -199,7 +195,6 @@ type Consensus struct { gov Governance network Network tickerObj Ticker - sigToPub SigToPubFn // Misc. notarySet map[types.NodeID]struct{} @@ -214,8 +209,7 @@ func NewConsensus( gov Governance, db blockdb.BlockDatabase, network Network, - prv crypto.PrivateKey, - sigToPub SigToPubFn) *Consensus { + prv crypto.PrivateKey) *Consensus { // TODO(w): load latest blockHeight from DB, and use config at that height. var blockHeight uint64 @@ -251,8 +245,7 @@ func NewConsensus( prvKey: prv, network: network, }, - gov, - sigToPub) + gov) // Register DKG for the initial round. This is a temporary function call for // simulation. cfgModule.registerDKG(0, len(notarySet)/3) @@ -265,7 +258,7 @@ func NewConsensus( rbModule: rb, toModule: to, ctModule: newConsensusTimestamp(), - ccModule: newCompactionChain(db, sigToPub), + ccModule: newCompactionChain(db), nbModule: newNonBlocking(app, debug), gov: gov, db: db, @@ -274,7 +267,6 @@ func NewConsensus( prvKey: prv, dkgReady: sync.NewCond(&sync.Mutex{}), cfgModule: cfgModule, - sigToPub: sigToPub, notarySet: notarySet, ctx: ctx, ctxCancel: ctxCancel, @@ -298,8 +290,7 @@ func NewConsensus( con.ID, con.receivers[chainID], nodes, - newGenesisLeaderSelector(config.CRS, con.sigToPub), - con.sigToPub, + newGenesisLeaderSelector(config.CRS), blockProposer, ) } @@ -594,7 +585,7 @@ func (con *Consensus) sanityCheck(b *types.Block) (err error) { } // Check the signer. - pubKey, err := con.sigToPub(b.Hash, b.Signature) + pubKey, err := crypto.SigToPub(b.Hash, b.Signature) if err != nil { return err } |