@@ -24,7 +24,7 @@ import (
24
24
25
25
"github.com/ethereum/go-ethereum/common/mclock"
26
26
"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"
28
28
"github.com/ethereum/go-ethereum/p2p/enode"
29
29
"github.com/ethereum/go-ethereum/p2p/enr"
30
30
"github.com/ethereum/go-ethereum/p2p/nodestate"
@@ -100,7 +100,7 @@ func getBalance(pool *clientPool, p *poolTestPeer) (pos, neg uint64) {
100
100
if temp {
101
101
pool .ns .SetField (p .node , connAddressField , p .freeClientId ())
102
102
}
103
- n , _ := pool .ns .GetField (p .node , pool .BalanceField ).(* lps .NodeBalance )
103
+ n , _ := pool .ns .GetField (p .node , pool .BalanceField ).(* vfs .NodeBalance )
104
104
pos , neg = n .GetBalance ()
105
105
if temp {
106
106
pool .ns .SetField (p .node , connAddressField , nil )
@@ -138,7 +138,7 @@ func testClientPool(t *testing.T, activeLimit, clientCount, paidCount int, rando
138
138
pool .ns .Start ()
139
139
140
140
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 })
142
142
143
143
// pool should accept new peers up to its connected limit
144
144
for i := 0 ; i < activeLimit ; i ++ {
@@ -243,7 +243,7 @@ func TestConnectPaidClient(t *testing.T) {
243
243
pool .ns .Start ()
244
244
defer pool .stop ()
245
245
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 })
247
247
248
248
// Add balance for an external client and mark it as paid client
249
249
addBalance (pool , newPoolTestPeer (0 , nil ).node .ID (), int64 (time .Minute ))
@@ -259,7 +259,7 @@ func TestConnectPaidClientToSmallPool(t *testing.T) {
259
259
pool .ns .Start ()
260
260
defer pool .stop ()
261
261
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 })
263
263
264
264
// Add balance for an external client and mark it as paid client
265
265
addBalance (pool , newPoolTestPeer (0 , nil ).node .ID (), int64 (time .Minute ))
@@ -278,7 +278,7 @@ func TestConnectPaidClientToFullPool(t *testing.T) {
278
278
pool .ns .Start ()
279
279
defer pool .stop ()
280
280
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 })
282
282
283
283
for i := 0 ; i < 10 ; i ++ {
284
284
addBalance (pool , newPoolTestPeer (i , nil ).node .ID (), int64 (time .Second * 20 ))
@@ -309,7 +309,7 @@ func TestPaidClientKickedOut(t *testing.T) {
309
309
pool .bt .SetExpirationTCs (0 , 0 )
310
310
defer pool .stop ()
311
311
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 })
313
313
314
314
for i := 0 ; i < 10 ; i ++ {
315
315
addBalance (pool , newPoolTestPeer (i , kickedCh ).node .ID (), 10000000000 ) // 10 second allowance
@@ -339,7 +339,7 @@ func TestConnectFreeClient(t *testing.T) {
339
339
pool .ns .Start ()
340
340
defer pool .stop ()
341
341
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 })
343
343
if cap , _ := pool .connect (newPoolTestPeer (0 , nil )); cap == 0 {
344
344
t .Fatalf ("Failed to connect free client" )
345
345
}
@@ -356,7 +356,7 @@ func TestConnectFreeClientToFullPool(t *testing.T) {
356
356
pool .ns .Start ()
357
357
defer pool .stop ()
358
358
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 })
360
360
361
361
for i := 0 ; i < 10 ; i ++ {
362
362
pool .connect (newPoolTestPeer (i , nil ))
@@ -386,7 +386,7 @@ func TestFreeClientKickedOut(t *testing.T) {
386
386
pool .ns .Start ()
387
387
defer pool .stop ()
388
388
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 })
390
390
391
391
for i := 0 ; i < 10 ; i ++ {
392
392
pool .connect (newPoolTestPeer (i , kicked ))
@@ -428,7 +428,7 @@ func TestPositiveBalanceCalculation(t *testing.T) {
428
428
pool .ns .Start ()
429
429
defer pool .stop ()
430
430
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 })
432
432
433
433
addBalance (pool , newPoolTestPeer (0 , kicked ).node .ID (), int64 (time .Minute * 3 ))
434
434
testPriorityConnect (t , pool , newPoolTestPeer (0 , kicked ), 10 , true )
@@ -452,7 +452,7 @@ func TestDowngradePriorityClient(t *testing.T) {
452
452
pool .ns .Start ()
453
453
defer pool .stop ()
454
454
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 })
456
456
457
457
p := newPoolTestPeer (0 , kicked )
458
458
addBalance (pool , p .node .ID (), int64 (time .Minute ))
@@ -487,7 +487,7 @@ func TestNegativeBalanceCalculation(t *testing.T) {
487
487
pool .ns .Start ()
488
488
defer pool .stop ()
489
489
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 })
491
491
492
492
for i := 0 ; i < 10 ; i ++ {
493
493
pool .connect (newPoolTestPeer (i , nil ))
@@ -564,7 +564,7 @@ func TestInactiveClient(t *testing.T) {
564
564
if p2 .cap != 0 {
565
565
t .Fatalf ("Failed to deactivate peer #2" )
566
566
}
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 })
568
568
p4 := newPoolTestPeer (4 , nil )
569
569
addBalance (pool , p4 .node .ID (), 1500 * int64 (time .Second ))
570
570
// p1: 1000 p2: 500 p3: 2000 p4: 1500
0 commit comments