all: gofmt -w -s
This commit is contained in:
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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++
|
||||
}
|
||||
|
@ -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])
|
||||
}
|
||||
|
@ -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)
|
||||
|
12
les/sync.go
12
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())
|
||||
|
@ -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++
|
||||
}
|
||||
|
Reference in New Issue
Block a user