diff options
author | Sonic <sonic@dexon.org> | 2019-05-06 14:59:06 +0800 |
---|---|---|
committer | Sonic <sonic@dexon.org> | 2019-05-06 14:59:06 +0800 |
commit | b4720965641332435d13cc3d3f54d3c17e7ed4e7 (patch) | |
tree | 9f60c7289aa4e944c177923451c64b7dc8ed3e1f | |
parent | a09d947763d043c8672233b67afb283253e68b3c (diff) | |
download | dexon-b4720965641332435d13cc3d3f54d3c17e7ed4e7.tar dexon-b4720965641332435d13cc3d3f54d3c17e7ed4e7.tar.gz dexon-b4720965641332435d13cc3d3f54d3c17e7ed4e7.tar.bz2 dexon-b4720965641332435d13cc3d3f54d3c17e7ed4e7.tar.lz dexon-b4720965641332435d13cc3d3f54d3c17e7ed4e7.tar.xz dexon-b4720965641332435d13cc3d3f54d3c17e7ed4e7.tar.zst dexon-b4720965641332435d13cc3d3f54d3c17e7ed4e7.zip |
lds: rename LesTxRelay to LdsTxRelay
-rw-r--r-- | lds/backend.go | 2 | ||||
-rw-r--r-- | lds/handler.go | 4 | ||||
-rw-r--r-- | lds/txrelay.go | 18 |
3 files changed, 12 insertions, 12 deletions
diff --git a/lds/backend.go b/lds/backend.go index bc0fe0bff..d3bbe0e03 100644 --- a/lds/backend.go +++ b/lds/backend.go @@ -49,7 +49,7 @@ type LightDexon struct { ldsCommons odr *LdsOdr - relay *LesTxRelay + relay *LdsTxRelay chainConfig *params.ChainConfig // Channel for shutting down the service shutdownChan chan bool diff --git a/lds/handler.go b/lds/handler.go index a86fd7c4d..8bc374a24 100644 --- a/lds/handler.go +++ b/lds/handler.go @@ -91,7 +91,7 @@ type txPool interface { type ProtocolManager struct { lightSync bool txpool txPool - txrelay *LesTxRelay + txrelay *LdsTxRelay networkId uint64 chainConfig *params.ChainConfig iConfig *light.IndexerConfig @@ -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 *LdsOdr, 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 *LdsTxRelay, 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/txrelay.go b/lds/txrelay.go index d1fe80dc8..20d137850 100644 --- a/lds/txrelay.go +++ b/lds/txrelay.go @@ -28,7 +28,7 @@ type ltrInfo struct { sentTo map[*peer]struct{} } -type LesTxRelay struct { +type LdsTxRelay struct { txSent map[common.Hash]*ltrInfo txPending map[common.Hash]struct{} ps *peerSet @@ -39,8 +39,8 @@ type LesTxRelay struct { reqDist *requestDistributor } -func NewLesTxRelay(ps *peerSet, reqDist *requestDistributor) *LesTxRelay { - r := &LesTxRelay{ +func NewLesTxRelay(ps *peerSet, reqDist *requestDistributor) *LdsTxRelay { + r := &LdsTxRelay{ txSent: make(map[common.Hash]*ltrInfo), txPending: make(map[common.Hash]struct{}), ps: ps, @@ -50,14 +50,14 @@ func NewLesTxRelay(ps *peerSet, reqDist *requestDistributor) *LesTxRelay { return r } -func (self *LesTxRelay) registerPeer(p *peer) { +func (self *LdsTxRelay) registerPeer(p *peer) { self.lock.Lock() defer self.lock.Unlock() self.peerList = self.ps.AllPeers() } -func (self *LesTxRelay) unregisterPeer(p *peer) { +func (self *LdsTxRelay) unregisterPeer(p *peer) { self.lock.Lock() defer self.lock.Unlock() @@ -66,7 +66,7 @@ func (self *LesTxRelay) unregisterPeer(p *peer) { // send sends a list of transactions to at most a given number of peers at // once, never resending any particular transaction to the same peer twice -func (self *LesTxRelay) send(txs types.Transactions, count int) { +func (self *LdsTxRelay) send(txs types.Transactions, count int) { sendTo := make(map[*peer]types.Transactions) self.peerStartPos++ // rotate the starting position of the peer list @@ -134,14 +134,14 @@ func (self *LesTxRelay) send(txs types.Transactions, count int) { } } -func (self *LesTxRelay) Send(txs types.Transactions) { +func (self *LdsTxRelay) Send(txs types.Transactions) { self.lock.Lock() defer self.lock.Unlock() self.send(txs, 3) } -func (self *LesTxRelay) NewHead(head common.Hash, mined []common.Hash, rollback []common.Hash) { +func (self *LdsTxRelay) NewHead(head common.Hash, mined []common.Hash, rollback []common.Hash) { self.lock.Lock() defer self.lock.Unlock() @@ -164,7 +164,7 @@ func (self *LesTxRelay) NewHead(head common.Hash, mined []common.Hash, rollback } } -func (self *LesTxRelay) Discard(hashes []common.Hash) { +func (self *LdsTxRelay) Discard(hashes []common.Hash) { self.lock.Lock() defer self.lock.Unlock() |