aboutsummaryrefslogtreecommitdiffstats
path: root/dex/backend.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-10-19 18:52:38 +0800
committerWei-Ning Huang <w@dexon.org>2019-03-12 12:19:09 +0800
commit271a7b680af9b62ed2cdfb25975a2aa901d9828e (patch)
treeda7f7c08d005e1374dc151100fb429e00ccad5f2 /dex/backend.go
parent3af359c1680a260bac6729bcc6c5a85ded247109 (diff)
downloaddexon-271a7b680af9b62ed2cdfb25975a2aa901d9828e.tar.gz
dexon-271a7b680af9b62ed2cdfb25975a2aa901d9828e.tar.zst
dexon-271a7b680af9b62ed2cdfb25975a2aa901d9828e.zip
consensus: dexcon: fetch config from state
Diffstat (limited to 'dex/backend.go')
-rw-r--r--dex/backend.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/dex/backend.go b/dex/backend.go
index 7a23ba80b..2f6d8a8e5 100644
--- a/dex/backend.go
+++ b/dex/backend.go
@@ -110,6 +110,8 @@ func New(ctx *node.ServiceContext, config *Config) (*Dexon, error) {
}
rawdb.WriteDatabaseVersion(chainDb, core.BlockChainVersion)
}
+ engine := dexcon.New()
+
dex := &Dexon{
config: config,
chainDb: chainDb,
@@ -121,7 +123,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Dexon, error) {
bloomRequests: make(chan chan *bloombits.Retrieval),
bloomIndexer: NewBloomIndexer(chainDb, params.BloomBitsBlocks, params.BloomConfirms),
blockdb: db,
- engine: dexcon.New(chainConfig.Dexcon),
+ engine: engine,
}
var (
@@ -154,9 +156,13 @@ func New(ctx *node.ServiceContext, config *Config) (*Dexon, error) {
}
dex.APIBackend.gpo = gasprice.NewOracle(dex.APIBackend, gpoParams)
+ // Dexcon related objects.
dex.governance = NewDexconGovernance(dex.APIBackend, dex.chainConfig, config.PrivateKey)
dex.app = NewDexconApp(dex.txPool, dex.blockchain, dex.governance, chainDb, config, vmConfig)
+ // Set config fetcher so engine can fetch current system configuration from state.
+ engine.SetConfigFetcher(dex.governance)
+
pm, err := NewProtocolManager(dex.chainConfig, config.SyncMode,
config.NetworkId, dex.eventMux, dex.txPool, dex.engine, dex.blockchain,
chainDb, dex.governance)