From a31ae3fde50d3402e838483c985dbe50d753b48c Mon Sep 17 00:00:00 2001 From: Sonic Date: Fri, 9 Nov 2018 14:49:23 +0800 Subject: dex: use dex/downloader in dex To compatible with ethereum code base, make Downloader a interface in internal/ethapi --- dex/api_backend.go | 4 ++-- dex/backend.go | 20 ++++++++++---------- dex/config.go | 2 +- dex/handler.go | 4 ++-- dex/handler_test.go | 2 +- dex/helper_test.go | 2 +- dex/protocol_test.go | 2 +- dex/sync.go | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) (limited to 'dex') diff --git a/dex/api_backend.go b/dex/api_backend.go index c6c1d214d..9929b062d 100644 --- a/dex/api_backend.go +++ b/dex/api_backend.go @@ -29,8 +29,8 @@ import ( "github.com/dexon-foundation/dexon/core/state" "github.com/dexon-foundation/dexon/core/types" "github.com/dexon-foundation/dexon/core/vm" - "github.com/dexon-foundation/dexon/eth/downloader" "github.com/dexon-foundation/dexon/eth/gasprice" + "github.com/dexon-foundation/dexon/internal/ethapi" "github.com/dexon-foundation/dexon/ethdb" "github.com/dexon-foundation/dexon/event" @@ -186,7 +186,7 @@ func (b *DexAPIBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.S return b.dex.TxPool().SubscribeNewTxsEvent(ch) } -func (b *DexAPIBackend) Downloader() *downloader.Downloader { +func (b *DexAPIBackend) Downloader() ethapi.Downloader { return b.dex.Downloader() } diff --git a/dex/backend.go b/dex/backend.go index 36b28345c..8fe9e9ea3 100644 --- a/dex/backend.go +++ b/dex/backend.go @@ -33,7 +33,7 @@ import ( "github.com/dexon-foundation/dexon/core/rawdb" "github.com/dexon-foundation/dexon/core/vm" "github.com/dexon-foundation/dexon/dex/blockdb" - "github.com/dexon-foundation/dexon/eth/downloader" + "github.com/dexon-foundation/dexon/dex/downloader" "github.com/dexon-foundation/dexon/eth/filters" "github.com/dexon-foundation/dexon/eth/gasprice" "github.com/dexon-foundation/dexon/ethdb" @@ -266,12 +266,12 @@ func CreateDB(ctx *node.ServiceContext, config *Config, name string) (ethdb.Data return db, nil } -func (d *Dexon) AccountManager() *accounts.Manager { return d.accountManager } -func (d *Dexon) BlockChain() *core.BlockChain { return d.blockchain } -func (d *Dexon) TxPool() *core.TxPool { return d.txPool } -func (d *Dexon) DexVersion() int { return int(d.protocolManager.SubProtocols[0].Version) } -func (d *Dexon) EventMux() *event.TypeMux { return d.eventMux } -func (d *Dexon) Engine() consensus.Engine { return d.engine } -func (d *Dexon) ChainDb() ethdb.Database { return d.chainDb } -func (d *Dexon) Downloader() *downloader.Downloader { return d.protocolManager.downloader } -func (d *Dexon) NetVersion() uint64 { return d.networkID } +func (d *Dexon) AccountManager() *accounts.Manager { return d.accountManager } +func (d *Dexon) BlockChain() *core.BlockChain { return d.blockchain } +func (d *Dexon) TxPool() *core.TxPool { return d.txPool } +func (d *Dexon) DexVersion() int { return int(d.protocolManager.SubProtocols[0].Version) } +func (d *Dexon) EventMux() *event.TypeMux { return d.eventMux } +func (d *Dexon) Engine() consensus.Engine { return d.engine } +func (d *Dexon) ChainDb() ethdb.Database { return d.chainDb } +func (d *Dexon) Downloader() ethapi.Downloader { return d.protocolManager.downloader } +func (d *Dexon) NetVersion() uint64 { return d.networkID } diff --git a/dex/config.go b/dex/config.go index b90a344c8..b6ce76992 100644 --- a/dex/config.go +++ b/dex/config.go @@ -26,7 +26,7 @@ import ( "time" "github.com/dexon-foundation/dexon/core" - "github.com/dexon-foundation/dexon/eth/downloader" + "github.com/dexon-foundation/dexon/dex/downloader" "github.com/dexon-foundation/dexon/eth/gasprice" "github.com/dexon-foundation/dexon/params" ) diff --git a/dex/handler.go b/dex/handler.go index a1a158560..d66403fe6 100644 --- a/dex/handler.go +++ b/dex/handler.go @@ -54,8 +54,8 @@ import ( "github.com/dexon-foundation/dexon/core" "github.com/dexon-foundation/dexon/core/types" "github.com/dexon-foundation/dexon/crypto" - "github.com/dexon-foundation/dexon/eth/downloader" - "github.com/dexon-foundation/dexon/eth/fetcher" + "github.com/dexon-foundation/dexon/dex/downloader" + "github.com/dexon-foundation/dexon/dex/fetcher" "github.com/dexon-foundation/dexon/ethdb" "github.com/dexon-foundation/dexon/event" "github.com/dexon-foundation/dexon/log" diff --git a/dex/handler_test.go b/dex/handler_test.go index 981362bb5..dc1ea1d73 100644 --- a/dex/handler_test.go +++ b/dex/handler_test.go @@ -27,7 +27,7 @@ import ( "github.com/dexon-foundation/dexon/core/state" "github.com/dexon-foundation/dexon/core/types" "github.com/dexon-foundation/dexon/crypto" - "github.com/dexon-foundation/dexon/eth/downloader" + "github.com/dexon-foundation/dexon/dex/downloader" "github.com/dexon-foundation/dexon/ethdb" "github.com/dexon-foundation/dexon/p2p" "github.com/dexon-foundation/dexon/params" diff --git a/dex/helper_test.go b/dex/helper_test.go index 9a135d3e3..f57f3eff4 100644 --- a/dex/helper_test.go +++ b/dex/helper_test.go @@ -33,7 +33,7 @@ import ( "github.com/dexon-foundation/dexon/core/types" "github.com/dexon-foundation/dexon/core/vm" "github.com/dexon-foundation/dexon/crypto" - "github.com/dexon-foundation/dexon/eth/downloader" + "github.com/dexon-foundation/dexon/dex/downloader" "github.com/dexon-foundation/dexon/ethdb" "github.com/dexon-foundation/dexon/event" "github.com/dexon-foundation/dexon/p2p" diff --git a/dex/protocol_test.go b/dex/protocol_test.go index b0e89230a..64d7fa3e7 100644 --- a/dex/protocol_test.go +++ b/dex/protocol_test.go @@ -34,7 +34,7 @@ import ( "github.com/dexon-foundation/dexon/common" "github.com/dexon-foundation/dexon/core/types" "github.com/dexon-foundation/dexon/crypto" - "github.com/dexon-foundation/dexon/eth/downloader" + "github.com/dexon-foundation/dexon/dex/downloader" "github.com/dexon-foundation/dexon/p2p" "github.com/dexon-foundation/dexon/rlp" ) diff --git a/dex/sync.go b/dex/sync.go index 5af6076bc..b6a8035d4 100644 --- a/dex/sync.go +++ b/dex/sync.go @@ -23,7 +23,7 @@ import ( "github.com/dexon-foundation/dexon/common" "github.com/dexon-foundation/dexon/core/types" - "github.com/dexon-foundation/dexon/eth/downloader" + "github.com/dexon-foundation/dexon/dex/downloader" "github.com/dexon-foundation/dexon/log" "github.com/dexon-foundation/dexon/p2p/enode" ) -- cgit