mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: minor fix and remove heavy unit test
This commit is contained in:
parent
522009b9e9
commit
622caeaa7b
2 changed files with 7 additions and 7 deletions
|
|
@ -288,13 +288,16 @@ func (f *clientPool) connect(peer clientPeer, capacity uint64) bool {
|
||||||
f.connectedQueue.Push(e)
|
f.connectedQueue.Push(e)
|
||||||
f.connectedCap += e.capacity
|
f.connectedCap += e.capacity
|
||||||
|
|
||||||
// If the current client is a paid client, notify it to update the capacity.
|
// If the current client is a paid client, monitor the status of client,
|
||||||
// And also monitor the status of client, downgrade it to normal client if
|
// downgrade it to normal client if positive balance is used up.
|
||||||
// positive balance is used up.
|
|
||||||
if e.priority {
|
if e.priority {
|
||||||
e.peer.updateCapacity(e.capacity)
|
|
||||||
e.balanceTracker.addCallback(balanceCallbackZero, 0, func() { f.balanceExhausted(id) })
|
e.balanceTracker.addCallback(balanceCallbackZero, 0, func() { f.balanceExhausted(id) })
|
||||||
}
|
}
|
||||||
|
// If the capacity of client is not the default value(free capacity), notify
|
||||||
|
// it to update capacity.
|
||||||
|
if e.capacity != f.freeClientCap {
|
||||||
|
e.peer.updateCapacity(e.capacity)
|
||||||
|
}
|
||||||
totalConnectedGauge.Update(int64(f.connectedCap))
|
totalConnectedGauge.Update(int64(f.connectedCap))
|
||||||
clientConnectedMeter.Mark(1)
|
clientConnectedMeter.Mark(1)
|
||||||
log.Debug("Client accepted", "address", freeID)
|
log.Debug("Client accepted", "address", freeID)
|
||||||
|
|
|
||||||
|
|
@ -30,17 +30,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test light syncing which will download all headers from genesis.
|
// Test light syncing which will download all headers from genesis.
|
||||||
func TestLightSyncingLes2(t *testing.T) { testCheckpointSyncing(t, 2, 0) }
|
|
||||||
func TestLightSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 0) }
|
func TestLightSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 0) }
|
||||||
|
|
||||||
// Test legacy checkpoint syncing which will download tail headers
|
// Test legacy checkpoint syncing which will download tail headers
|
||||||
// based on a hardcoded checkpoint.
|
// based on a hardcoded checkpoint.
|
||||||
func TestLegacyCheckpointSyncingLes2(t *testing.T) { testCheckpointSyncing(t, 2, 1) }
|
|
||||||
func TestLegacyCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 1) }
|
func TestLegacyCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 1) }
|
||||||
|
|
||||||
// Test checkpoint syncing which will download tail headers based
|
// Test checkpoint syncing which will download tail headers based
|
||||||
// on a verified checkpoint.
|
// on a verified checkpoint.
|
||||||
func TestCheckpointSyncingLes2(t *testing.T) { testCheckpointSyncing(t, 2, 2) }
|
|
||||||
func TestCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 2) }
|
func TestCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 2) }
|
||||||
|
|
||||||
func testCheckpointSyncing(t *testing.T, protocol int, syncMode int) {
|
func testCheckpointSyncing(t *testing.T, protocol int, syncMode int) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue