From a09d947763d043c8672233b67afb283253e68b3c Mon Sep 17 00:00:00 2001
From: Sonic <sonic@dexon.org>
Date: Mon, 6 May 2019 14:58:20 +0800
Subject: lds: rename LesOdr to LdsOdr

---
 lds/backend.go     |  2 +-
 lds/fetcher.go     |  2 +-
 lds/handler.go     |  4 ++--
 lds/helper_test.go |  4 ++--
 lds/odr.go         | 24 ++++++++++++------------
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/lds/backend.go b/lds/backend.go
index 06c734791..bc0fe0bff 100644
--- a/lds/backend.go
+++ b/lds/backend.go
@@ -48,7 +48,7 @@ import (
 type LightDexon struct {
 	ldsCommons
 
-	odr         *LesOdr
+	odr         *LdsOdr
 	relay       *LesTxRelay
 	chainConfig *params.ChainConfig
 	// Channel for shutting down the service
diff --git a/lds/fetcher.go b/lds/fetcher.go
index fd1ba19a9..f96bd1d79 100644
--- a/lds/fetcher.go
+++ b/lds/fetcher.go
@@ -42,7 +42,7 @@ const (
 // and announced that block.
 type lightFetcher struct {
 	pm    *ProtocolManager
-	odr   *LesOdr
+	odr   *LdsOdr
 	chain *light.LightChain
 
 	lock            sync.Mutex // lock protects access to the fetcher's internal state variables except sent requests
diff --git a/lds/handler.go b/lds/handler.go
index 1f3513fc8..a86fd7c4d 100644
--- a/lds/handler.go
+++ b/lds/handler.go
@@ -97,7 +97,7 @@ type ProtocolManager struct {
 	iConfig     *light.IndexerConfig
 	blockchain  BlockChain
 	chainDb     ethdb.Database
-	odr         *LesOdr
+	odr         *LdsOdr
 	server      *LesServer
 	serverPool  *serverPool
 	clientPool  *freeClientPool
@@ -124,7 +124,7 @@ type ProtocolManager struct {
 
 // NewProtocolManager returns a new ethereum sub protocol manager. The Ethereum sub protocol manages peers capable
 // with the ethereum network.
-func NewProtocolManager(chainConfig *params.ChainConfig, indexerConfig *light.IndexerConfig, lightSync bool, networkId uint64, mux *event.TypeMux, engine consensus.Engine, peers *peerSet, blockchain BlockChain, txpool txPool, chainDb ethdb.Database, odr *LesOdr, txrelay *LesTxRelay, serverPool *serverPool, quitSync chan struct{}, wg *sync.WaitGroup) (*ProtocolManager, error) {
+func NewProtocolManager(chainConfig *params.ChainConfig, indexerConfig *light.IndexerConfig, lightSync bool, networkId uint64, mux *event.TypeMux, engine consensus.Engine, peers *peerSet, blockchain BlockChain, txpool txPool, chainDb ethdb.Database, odr *LdsOdr, txrelay *LesTxRelay, serverPool *serverPool, quitSync chan struct{}, wg *sync.WaitGroup) (*ProtocolManager, error) {
 	// Create the protocol manager with the base fields
 	manager := &ProtocolManager{
 		lightSync:   lightSync,
diff --git a/lds/helper_test.go b/lds/helper_test.go
index 66cd069d3..a9cf7ad1c 100644
--- a/lds/helper_test.go
+++ b/lds/helper_test.go
@@ -146,7 +146,7 @@ func testRCL() RequestCostList {
 // newTestProtocolManager creates a new protocol manager for testing purposes,
 // with the given number of blocks already known, potential notification
 // channels for different events and relative chain indexers array.
-func newTestProtocolManager(lightSync bool, blocks int, generator func(int, *core.BlockGen), odr *LesOdr, peers *peerSet, db ethdb.Database) (*ProtocolManager, error) {
+func newTestProtocolManager(lightSync bool, blocks int, generator func(int, *core.BlockGen), odr *LdsOdr, peers *peerSet, db ethdb.Database) (*ProtocolManager, error) {
 	var (
 		evmux  = new(event.TypeMux)
 		engine = ethash.NewFaker()
@@ -200,7 +200,7 @@ func newTestProtocolManager(lightSync bool, blocks int, generator func(int, *cor
 // with the given number of blocks already known, potential notification
 // channels for different events and relative chain indexers array. In case of an error, the constructor force-
 // fails the test.
-func newTestProtocolManagerMust(t *testing.T, lightSync bool, blocks int, generator func(int, *core.BlockGen), odr *LesOdr, peers *peerSet, db ethdb.Database) *ProtocolManager {
+func newTestProtocolManagerMust(t *testing.T, lightSync bool, blocks int, generator func(int, *core.BlockGen), odr *LdsOdr, peers *peerSet, db ethdb.Database) *ProtocolManager {
 	pm, err := newTestProtocolManager(lightSync, blocks, generator, odr, peers, db)
 	if err != nil {
 		t.Fatalf("Failed to create protocol manager: %v", err)
diff --git a/lds/odr.go b/lds/odr.go
index 40cbb9455..706301cfb 100644
--- a/lds/odr.go
+++ b/lds/odr.go
@@ -25,8 +25,8 @@ import (
 	"github.com/dexon-foundation/dexon/log"
 )
 
-// LesOdr implements light.OdrBackend
-type LesOdr struct {
+// LdsOdr implements light.OdrBackend
+type LdsOdr struct {
 	db                                         ethdb.Database
 	indexerConfig                              *light.IndexerConfig
 	chtIndexer, bloomTrieIndexer, bloomIndexer *core.ChainIndexer
@@ -34,8 +34,8 @@ type LesOdr struct {
 	stop                                       chan struct{}
 }
 
-func NewLesOdr(db ethdb.Database, config *light.IndexerConfig, retriever *retrieveManager) *LesOdr {
-	return &LesOdr{
+func NewLesOdr(db ethdb.Database, config *light.IndexerConfig, retriever *retrieveManager) *LdsOdr {
+	return &LdsOdr{
 		db:            db,
 		indexerConfig: config,
 		retriever:     retriever,
@@ -44,39 +44,39 @@ func NewLesOdr(db ethdb.Database, config *light.IndexerConfig, retriever *retrie
 }
 
 // Stop cancels all pending retrievals
-func (odr *LesOdr) Stop() {
+func (odr *LdsOdr) Stop() {
 	close(odr.stop)
 }
 
 // Database returns the backing database
-func (odr *LesOdr) Database() ethdb.Database {
+func (odr *LdsOdr) Database() ethdb.Database {
 	return odr.db
 }
 
 // SetIndexers adds the necessary chain indexers to the ODR backend
-func (odr *LesOdr) SetIndexers(chtIndexer, bloomTrieIndexer, bloomIndexer *core.ChainIndexer) {
+func (odr *LdsOdr) SetIndexers(chtIndexer, bloomTrieIndexer, bloomIndexer *core.ChainIndexer) {
 	odr.chtIndexer = chtIndexer
 	odr.bloomTrieIndexer = bloomTrieIndexer
 	odr.bloomIndexer = bloomIndexer
 }
 
 // ChtIndexer returns the CHT chain indexer
-func (odr *LesOdr) ChtIndexer() *core.ChainIndexer {
+func (odr *LdsOdr) ChtIndexer() *core.ChainIndexer {
 	return odr.chtIndexer
 }
 
 // BloomTrieIndexer returns the bloom trie chain indexer
-func (odr *LesOdr) BloomTrieIndexer() *core.ChainIndexer {
+func (odr *LdsOdr) BloomTrieIndexer() *core.ChainIndexer {
 	return odr.bloomTrieIndexer
 }
 
 // BloomIndexer returns the bloombits chain indexer
-func (odr *LesOdr) BloomIndexer() *core.ChainIndexer {
+func (odr *LdsOdr) BloomIndexer() *core.ChainIndexer {
 	return odr.bloomIndexer
 }
 
 // IndexerConfig returns the indexer config.
-func (odr *LesOdr) IndexerConfig() *light.IndexerConfig {
+func (odr *LdsOdr) IndexerConfig() *light.IndexerConfig {
 	return odr.indexerConfig
 }
 
@@ -99,7 +99,7 @@ type Msg struct {
 
 // Retrieve tries to fetch an object from the LES network.
 // If the network retrieval was successful, it stores the object in local db.
-func (odr *LesOdr) Retrieve(ctx context.Context, req light.OdrRequest) (err error) {
+func (odr *LdsOdr) Retrieve(ctx context.Context, req light.OdrRequest) (err error) {
 	lreq := LesRequest(req)
 
 	reqID := genReqID()
-- 
cgit v1.2.3