@@ -24,7 +24,7 @@ import (
2424
2525 "github.com/ethereum/go-ethereum/common/mclock"
2626 "github.com/ethereum/go-ethereum/core/rawdb"
27- lps "github.com/ethereum/go-ethereum/les/lespay /server"
27+ vfs "github.com/ethereum/go-ethereum/les/vflux /server"
2828 "github.com/ethereum/go-ethereum/p2p/enode"
2929 "github.com/ethereum/go-ethereum/p2p/enr"
3030 "github.com/ethereum/go-ethereum/p2p/nodestate"
@@ -100,7 +100,7 @@ func getBalance(pool *clientPool, p *poolTestPeer) (pos, neg uint64) {
100100 if temp {
101101 pool .ns .SetField (p .node , connAddressField , p .freeClientId ())
102102 }
103- n , _ := pool .ns .GetField (p .node , pool .BalanceField ).(* lps .NodeBalance )
103+ n , _ := pool .ns .GetField (p .node , pool .BalanceField ).(* vfs .NodeBalance )
104104 pos , neg = n .GetBalance ()
105105 if temp {
106106 pool .ns .SetField (p .node , connAddressField , nil )
@@ -138,7 +138,7 @@ func testClientPool(t *testing.T, activeLimit, clientCount, paidCount int, rando
138138 pool .ns .Start ()
139139
140140 pool .setLimits (activeLimit , uint64 (activeLimit ))
141- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
141+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
142142
143143 // pool should accept new peers up to its connected limit
144144 for i := 0 ; i < activeLimit ; i ++ {
@@ -243,7 +243,7 @@ func TestConnectPaidClient(t *testing.T) {
243243 pool .ns .Start ()
244244 defer pool .stop ()
245245 pool .setLimits (10 , uint64 (10 ))
246- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
246+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
247247
248248 // Add balance for an external client and mark it as paid client
249249 addBalance (pool , newPoolTestPeer (0 , nil ).node .ID (), int64 (time .Minute ))
@@ -259,7 +259,7 @@ func TestConnectPaidClientToSmallPool(t *testing.T) {
259259 pool .ns .Start ()
260260 defer pool .stop ()
261261 pool .setLimits (10 , uint64 (10 )) // Total capacity limit is 10
262- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
262+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
263263
264264 // Add balance for an external client and mark it as paid client
265265 addBalance (pool , newPoolTestPeer (0 , nil ).node .ID (), int64 (time .Minute ))
@@ -278,7 +278,7 @@ func TestConnectPaidClientToFullPool(t *testing.T) {
278278 pool .ns .Start ()
279279 defer pool .stop ()
280280 pool .setLimits (10 , uint64 (10 )) // Total capacity limit is 10
281- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
281+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
282282
283283 for i := 0 ; i < 10 ; i ++ {
284284 addBalance (pool , newPoolTestPeer (i , nil ).node .ID (), int64 (time .Second * 20 ))
@@ -309,7 +309,7 @@ func TestPaidClientKickedOut(t *testing.T) {
309309 pool .bt .SetExpirationTCs (0 , 0 )
310310 defer pool .stop ()
311311 pool .setLimits (10 , uint64 (10 )) // Total capacity limit is 10
312- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
312+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
313313
314314 for i := 0 ; i < 10 ; i ++ {
315315 addBalance (pool , newPoolTestPeer (i , kickedCh ).node .ID (), 10000000000 ) // 10 second allowance
@@ -339,7 +339,7 @@ func TestConnectFreeClient(t *testing.T) {
339339 pool .ns .Start ()
340340 defer pool .stop ()
341341 pool .setLimits (10 , uint64 (10 ))
342- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
342+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
343343 if cap , _ := pool .connect (newPoolTestPeer (0 , nil )); cap == 0 {
344344 t .Fatalf ("Failed to connect free client" )
345345 }
@@ -356,7 +356,7 @@ func TestConnectFreeClientToFullPool(t *testing.T) {
356356 pool .ns .Start ()
357357 defer pool .stop ()
358358 pool .setLimits (10 , uint64 (10 )) // Total capacity limit is 10
359- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
359+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
360360
361361 for i := 0 ; i < 10 ; i ++ {
362362 pool .connect (newPoolTestPeer (i , nil ))
@@ -386,7 +386,7 @@ func TestFreeClientKickedOut(t *testing.T) {
386386 pool .ns .Start ()
387387 defer pool .stop ()
388388 pool .setLimits (10 , uint64 (10 )) // Total capacity limit is 10
389- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
389+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
390390
391391 for i := 0 ; i < 10 ; i ++ {
392392 pool .connect (newPoolTestPeer (i , kicked ))
@@ -428,7 +428,7 @@ func TestPositiveBalanceCalculation(t *testing.T) {
428428 pool .ns .Start ()
429429 defer pool .stop ()
430430 pool .setLimits (10 , uint64 (10 )) // Total capacity limit is 10
431- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
431+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
432432
433433 addBalance (pool , newPoolTestPeer (0 , kicked ).node .ID (), int64 (time .Minute * 3 ))
434434 testPriorityConnect (t , pool , newPoolTestPeer (0 , kicked ), 10 , true )
@@ -452,7 +452,7 @@ func TestDowngradePriorityClient(t *testing.T) {
452452 pool .ns .Start ()
453453 defer pool .stop ()
454454 pool .setLimits (10 , uint64 (10 )) // Total capacity limit is 10
455- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
455+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 }, vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 1 })
456456
457457 p := newPoolTestPeer (0 , kicked )
458458 addBalance (pool , p .node .ID (), int64 (time .Minute ))
@@ -487,7 +487,7 @@ func TestNegativeBalanceCalculation(t *testing.T) {
487487 pool .ns .Start ()
488488 defer pool .stop ()
489489 pool .setLimits (10 , uint64 (10 )) // Total capacity limit is 10
490- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1e-3 , CapacityFactor : 0 , RequestFactor : 1 }, lps .PriceFactors {TimeFactor : 1e-3 , CapacityFactor : 0 , RequestFactor : 1 })
490+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1e-3 , CapacityFactor : 0 , RequestFactor : 1 }, vfs .PriceFactors {TimeFactor : 1e-3 , CapacityFactor : 0 , RequestFactor : 1 })
491491
492492 for i := 0 ; i < 10 ; i ++ {
493493 pool .connect (newPoolTestPeer (i , nil ))
@@ -564,7 +564,7 @@ func TestInactiveClient(t *testing.T) {
564564 if p2 .cap != 0 {
565565 t .Fatalf ("Failed to deactivate peer #2" )
566566 }
567- pool .setDefaultFactors (lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 0 }, lps .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 0 })
567+ pool .setDefaultFactors (vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 0 }, vfs .PriceFactors {TimeFactor : 1 , CapacityFactor : 0 , RequestFactor : 0 })
568568 p4 := newPoolTestPeer (4 , nil )
569569 addBalance (pool , p4 .node .ID (), 1500 * int64 (time .Second ))
570570 // p1: 1000 p2: 500 p3: 2000 p4: 1500
0 commit comments