aboutsummaryrefslogtreecommitdiffstats
path: root/dex/backend.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-15 13:30:50 +0800
committerWei-Ning Huang <w@dexon.org>2018-12-19 20:54:27 +0800
commitadb04994560c2558fc93c85ea5976b3744ca6b6b (patch)
tree6fb38620a06572fc5d51eefbee2e2646b807449f /dex/backend.go
parent61c27beb30c6b8919e3f83bee490bc75426dfa48 (diff)
downloaddexon-adb04994560c2558fc93c85ea5976b3744ca6b6b.tar
dexon-adb04994560c2558fc93c85ea5976b3744ca6b6b.tar.gz
dexon-adb04994560c2558fc93c85ea5976b3744ca6b6b.tar.bz2
dexon-adb04994560c2558fc93c85ea5976b3744ca6b6b.tar.lz
dexon-adb04994560c2558fc93c85ea5976b3744ca6b6b.tar.xz
dexon-adb04994560c2558fc93c85ea5976b3744ca6b6b.tar.zst
dexon-adb04994560c2558fc93c85ea5976b3744ca6b6b.zip
core: refactor validator and fix light node sync (#25)
Remove custom Dexon validator by adding a new `ValidateWitnessData` method into the validator interface. This allow us to properly detect know blocks. This also allow other gdex "light" client to sync compaction chain. Also, setup a standalone RPC node for handling RPC reqeusts.
Diffstat (limited to 'dex/backend.go')
-rw-r--r--dex/backend.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/dex/backend.go b/dex/backend.go
index 87d8c3a35..79b97b4ba 100644
--- a/dex/backend.go
+++ b/dex/backend.go
@@ -134,8 +134,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Dexon, error) {
}
cacheConfig = &core.CacheConfig{Disabled: config.NoPruning, TrieCleanLimit: config.TrieCleanCache, TrieDirtyLimit: config.TrieDirtyCache, TrieTimeLimit: config.TrieTimeout}
)
- dex.blockchain, err = core.NewBlockChainWithDexonValidator(chainDb, cacheConfig,
- dex.chainConfig, dex.engine, vmConfig, nil)
+ dex.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, dex.chainConfig, dex.engine, vmConfig, nil)
// Rewind the chain in case of an incompatible config upgrade.
if compat, ok := genesisErr.(*params.ConfigCompatError); ok {
@@ -148,7 +147,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Dexon, error) {
if config.TxPool.Journal != "" {
config.TxPool.Journal = ctx.ResolvePath(config.TxPool.Journal)
}
- dex.txPool = core.NewTxPool(config.TxPool, dex.chainConfig, dex.blockchain)
+ dex.txPool = core.NewTxPool(config.TxPool, dex.chainConfig, dex.blockchain, config.BlockProposerEnabled)
dex.APIBackend = &DexAPIBackend{dex, nil}
gpoParams := config.GPO
@@ -166,7 +165,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Dexon, error) {
pm, err := NewProtocolManager(dex.chainConfig, config.SyncMode,
config.NetworkId, dex.eventMux, dex.txPool, dex.engine, dex.blockchain,
- chainDb, dex.governance)
+ chainDb, config.BlockProposerEnabled, dex.governance)
if err != nil {
return nil, err
}