les: improved header fetcher and server statistics
This commit is contained in:
@ -71,6 +71,8 @@ func testAccess(t *testing.T, protocol int, fn accessTestFn) {
|
||||
pm, db, _ := newTestProtocolManagerMust(t, false, 4, testChainGen)
|
||||
lpm, ldb, odr := newTestProtocolManagerMust(t, true, 0, nil)
|
||||
_, err1, lpeer, err2 := newTestPeerPair("peer", protocol, pm, lpm)
|
||||
pool := (*testServerPool)(lpeer)
|
||||
odr.serverPool = pool
|
||||
select {
|
||||
case <-time.After(time.Millisecond * 100):
|
||||
case err := <-err1:
|
||||
@ -100,11 +102,10 @@ func testAccess(t *testing.T, protocol int, fn accessTestFn) {
|
||||
}
|
||||
|
||||
// temporarily remove peer to test odr fails
|
||||
odr.UnregisterPeer(lpeer)
|
||||
odr.serverPool = nil
|
||||
// expect retrievals to fail (except genesis block) without a les peer
|
||||
test(0)
|
||||
odr.RegisterPeer(lpeer)
|
||||
odr.serverPool = pool
|
||||
// expect all retrievals to pass
|
||||
test(5)
|
||||
odr.UnregisterPeer(lpeer)
|
||||
}
|
||||
|
Reference in New Issue
Block a user