diff options
author | Wei-Ning Huang <w@cobinhood.com> | 2018-10-13 13:53:42 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | 8dc2068251b779ea6b93a3e789a9ebdeb8497b5c (patch) | |
tree | ccb58975b5a6b8c1d079229c2bd61af43475f69d /dex/backend.go | |
parent | e64c5f223b625464eeea9415a8484eef71874534 (diff) | |
download | dexon-8dc2068251b779ea6b93a3e789a9ebdeb8497b5c.tar.gz dexon-8dc2068251b779ea6b93a3e789a9ebdeb8497b5c.tar.zst dexon-8dc2068251b779ea6b93a3e789a9ebdeb8497b5c.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 |