les: minor fix and remove heavy unit test

This commit is contained in:
rjl493456442 2019-11-01 10:52:02 +08:00
parent 522009b9e9
commit 622caeaa7b
2 changed files with 7 additions and 7 deletions

View file

@ -288,13 +288,16 @@ func (f *clientPool) connect(peer clientPeer, capacity uint64) bool {
f.connectedQueue.Push(e)
f.connectedCap += e.capacity
// If the current client is a paid client, notify it to update the capacity.
// And also monitor the status of client, downgrade it to normal client if
// positive balance is used up.
// If the current client is a paid client, monitor the status of client,
// downgrade it to normal client if positive balance is used up.
if e.priority {
e.peer.updateCapacity(e.capacity)
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))
clientConnectedMeter.Mark(1)
log.Debug("Client accepted", "address", freeID)

View file

@ -30,17 +30,14 @@ import (
)
// 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) }
// Test legacy checkpoint syncing which will download tail headers
// based on a hardcoded checkpoint.
func TestLegacyCheckpointSyncingLes2(t *testing.T) { testCheckpointSyncing(t, 2, 1) }
func TestLegacyCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 1) }
// Test checkpoint syncing which will download tail headers based
// on a verified checkpoint.
func TestCheckpointSyncingLes2(t *testing.T) { testCheckpointSyncing(t, 2, 2) }
func TestCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 2) }
func testCheckpointSyncing(t *testing.T, protocol int, syncMode int) {