diff options
author | Wei-Ning Huang <w@cobinhood.com> | 2018-10-13 13:53:42 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:23:39 +0800 |
commit | e205d3e8dbc0e6e8878dd184afcfee931260a11f (patch) | |
tree | 45b4ac223f7babbcdc5a45aa3ecbf3c93091a65f /dex/backend.go | |
parent | 912acafdcb9cba8c8036e8ae96b6b48c2c885238 (diff) | |
download | go-tangerine-e205d3e8dbc0e6e8878dd184afcfee931260a11f.tar go-tangerine-e205d3e8dbc0e6e8878dd184afcfee931260a11f.tar.gz go-tangerine-e205d3e8dbc0e6e8878dd184afcfee931260a11f.tar.bz2 go-tangerine-e205d3e8dbc0e6e8878dd184afcfee931260a11f.tar.lz go-tangerine-e205d3e8dbc0e6e8878dd184afcfee931260a11f.tar.xz go-tangerine-e205d3e8dbc0e6e8878dd184afcfee931260a11f.tar.zst go-tangerine-e205d3e8dbc0e6e8878dd184afcfee931260a11f.zip |
dex: pass p2p nodeKey to Dexon instance
Diffstat (limited to 'dex/backend.go')
-rw-r--r-- | dex/backend.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/dex/backend.go b/dex/backend.go index b6a7bdc4d..2396f0f71 100644 --- a/dex/backend.go +++ b/dex/backend.go @@ -22,7 +22,7 @@ import ( dexCore "github.com/dexon-foundation/dexon-consensus-core/core" "github.com/dexon-foundation/dexon-consensus-core/core/blockdb" - "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa" + coreEcdsa "github.com/dexon-foundation/dexon-consensus-core/core/crypto/ecdsa" "github.com/dexon-foundation/dexon/accounts" "github.com/dexon-foundation/dexon/consensus" @@ -87,12 +87,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Dexon, error) { } network := NewDexconNetwork() - // TODO(w): replace this with node key. - privKey, err := ecdsa.NewPrivateKey() - if err != nil { - panic(err) - } - chainDb, err := CreateDB(ctx, config, "chaindata") if err != nil { return nil, err @@ -154,8 +148,10 @@ func New(ctx *node.ServiceContext, config *Config) (*Dexon, error) { //} dex.APIBackend.gpo = gasprice.NewOracle(dex.APIBackend, gpoParams) - dex.governance = NewDexconGovernance(dex.APIBackend) + dex.governance = NewDexconGovernance(dex.APIBackend, config.PrivateKey) dex.app = NewDexconApp(dex.txPool, dex.blockchain, dex.governance, chainDb, config, vmConfig) + + privKey := coreEcdsa.NewPrivateKeyFromECDSA(config.PrivateKey) dex.consensus = dexCore.NewConsensus(dex.app, dex.governance, db, network, privKey) return dex, nil |