aboutsummaryrefslogtreecommitdiffstats
path: root/les
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-01-06 22:52:03 +0800
committerFelix Lange <fjl@twurst.com>2017-01-06 22:52:03 +0800
commit35a7dcb162546f7f31cb6492f716cb93159218d7 (patch)
tree4828026948031719a703a87e0ce909e82da21d3b /les
parente0fde022909d272e55fb9ea2d4f8cfe9f178dba8 (diff)
downloaddexon-35a7dcb162546f7f31cb6492f716cb93159218d7.tar.gz
dexon-35a7dcb162546f7f31cb6492f716cb93159218d7.tar.zst
dexon-35a7dcb162546f7f31cb6492f716cb93159218d7.zip
all: gofmt -w -s
Diffstat (limited to 'les')
-rw-r--r--les/fetcher.go2
-rw-r--r--les/flowcontrol/manager.go6
-rw-r--r--les/handler_test.go14
-rw-r--r--les/peer.go2
-rw-r--r--les/randselect_test.go2
-rw-r--r--les/serverpool.go2
-rw-r--r--les/sync.go12
-rw-r--r--les/txrelay.go2
8 files changed, 21 insertions, 21 deletions
diff --git a/les/fetcher.go b/les/fetcher.go
index c23af8da3..4a0830a8a 100644
--- a/les/fetcher.go
+++ b/les/fetcher.go
@@ -664,7 +664,7 @@ func (f *lightFetcher) updateMaxConfirmedTd(td *big.Int) {
f.lastUpdateStats.next = newEntry
}
f.lastUpdateStats = newEntry
- for p, _ := range f.peers {
+ for p := range f.peers {
f.checkUpdateStats(p, newEntry)
}
}
diff --git a/les/flowcontrol/manager.go b/les/flowcontrol/manager.go
index 786884437..f9f029466 100644
--- a/les/flowcontrol/manager.go
+++ b/les/flowcontrol/manager.go
@@ -126,7 +126,7 @@ func (self *ClientManager) removeNode(node *cmNode) {
// recalc sumWeight
func (self *ClientManager) updateNodes(time int64) (rce bool) {
var sumWeight, rcSum uint64
- for node, _ := range self.nodes {
+ for node := range self.nodes {
rc := node.recharging
node.update(time)
if rc && !node.recharging {
@@ -145,13 +145,13 @@ func (self *ClientManager) updateNodes(time int64) (rce bool) {
func (self *ClientManager) update(time int64) {
for {
firstTime := time
- for node, _ := range self.nodes {
+ for node := range self.nodes {
if node.recharging && node.finishRecharge < firstTime {
firstTime = node.finishRecharge
}
}
if self.updateNodes(firstTime) {
- for node, _ := range self.nodes {
+ for node := range self.nodes {
if node.recharging {
node.set(node.serving, self.simReqCnt, self.sumWeight)
}
diff --git a/les/handler_test.go b/les/handler_test.go
index 37c5dd226..0b94d0d30 100644
--- a/les/handler_test.go
+++ b/les/handler_test.go
@@ -49,7 +49,7 @@ func testGetBlockHeaders(t *testing.T, protocol int) {
// Create a "random" unknown hash for testing
var unknown common.Hash
- for i, _ := range unknown {
+ for i := range unknown {
unknown[i] = byte(i)
}
// Create a batch of tests for various scenarios
@@ -189,17 +189,17 @@ func testGetBlockBodies(t *testing.T, protocol int) {
//{limit + 1, nil, nil, limit}, // No more than the possible block count should be returned
{0, []common.Hash{bc.Genesis().Hash()}, []bool{true}, 1}, // The genesis block should be retrievable
{0, []common.Hash{bc.CurrentBlock().Hash()}, []bool{true}, 1}, // The chains head block should be retrievable
- {0, []common.Hash{common.Hash{}}, []bool{false}, 0}, // A non existent block should not be returned
+ {0, []common.Hash{{}}, []bool{false}, 0}, // A non existent block should not be returned
// Existing and non-existing blocks interleaved should not cause problems
{0, []common.Hash{
- common.Hash{},
+ {},
bc.GetBlockByNumber(1).Hash(),
- common.Hash{},
+ {},
bc.GetBlockByNumber(10).Hash(),
- common.Hash{},
+ {},
bc.GetBlockByNumber(100).Hash(),
- common.Hash{},
+ {},
}, []bool{false, true, false, true, false, true, false}, 3},
}
// Run each of the tests and verify the results against the chain
@@ -312,7 +312,7 @@ func testGetProofs(t *testing.T, protocol int) {
var proofreqs []ProofReq
var proofs [][]rlp.RawValue
- accounts := []common.Address{testBankAddress, acc1Addr, acc2Addr, common.Address{}}
+ accounts := []common.Address{testBankAddress, acc1Addr, acc2Addr, {}}
for i := uint64(0); i <= bc.CurrentBlock().NumberU64(); i++ {
header := bc.GetHeaderByNumber(i)
root := header.Root
diff --git a/les/peer.go b/les/peer.go
index 0a8db4975..8d4a83f59 100644
--- a/les/peer.go
+++ b/les/peer.go
@@ -467,7 +467,7 @@ func (ps *peerSet) AllPeerIDs() []string {
res := make([]string, len(ps.peers))
idx := 0
- for id, _ := range ps.peers {
+ for id := range ps.peers {
res[idx] = id
idx++
}
diff --git a/les/randselect_test.go b/les/randselect_test.go
index f3c34305e..9ae7726dd 100644
--- a/les/randselect_test.go
+++ b/les/randselect_test.go
@@ -39,7 +39,7 @@ func TestWeightedRandomSelect(t *testing.T) {
s := newWeightedRandomSelect()
w := -1
list := make([]testWrsItem, cnt)
- for i, _ := range list {
+ for i := range list {
list[i] = testWrsItem{idx: i, widx: &w}
s.update(&list[i])
}
diff --git a/les/serverpool.go b/les/serverpool.go
index f5e880460..80c446eef 100644
--- a/les/serverpool.go
+++ b/les/serverpool.go
@@ -414,7 +414,7 @@ func (pool *serverPool) loadNodes() {
// ordered from least to most recently connected.
func (pool *serverPool) saveNodes() {
list := make([]*poolEntry, len(pool.knownQueue.queue))
- for i, _ := range list {
+ for i := range list {
list[i] = pool.knownQueue.fetchOldest()
}
enc, err := rlp.EncodeToBytes(list)
diff --git a/les/sync.go b/les/sync.go
index 72c979c61..c143cb145 100644
--- a/les/sync.go
+++ b/les/sync.go
@@ -43,12 +43,12 @@ func (pm *ProtocolManager) syncer() {
for {
select {
case <-pm.newPeerCh:
-/* // Make sure we have peers to select from, then sync
- if pm.peers.Len() < minDesiredPeerCount {
- break
- }
- go pm.synchronise(pm.peers.BestPeer())
-*/
+ /* // Make sure we have peers to select from, then sync
+ if pm.peers.Len() < minDesiredPeerCount {
+ break
+ }
+ go pm.synchronise(pm.peers.BestPeer())
+ */
/*case <-forceSync:
// Force a sync even if not enough peers are present
go pm.synchronise(pm.peers.BestPeer())
diff --git a/les/txrelay.go b/les/txrelay.go
index 036158f5d..84d049b45 100644
--- a/les/txrelay.go
+++ b/les/txrelay.go
@@ -138,7 +138,7 @@ func (self *LesTxRelay) NewHead(head common.Hash, mined []common.Hash, rollback
if len(self.txPending) > 0 {
txs := make(types.Transactions, len(self.txPending))
i := 0
- for hash, _ := range self.txPending {
+ for hash := range self.txPending {
txs[i] = self.txSent[hash].tx
i++
}