les: fix panic in ultralight client sync (#24641)

This commit is contained in:
rjl493456442
2022-04-08 21:48:52 +08:00
committed by GitHub
parent 8d066f1f42
commit c1b69bd121
3 changed files with 47 additions and 9 deletions

View File

@ -55,7 +55,7 @@ func testULCAnnounceThreshold(t *testing.T, protocol int) {
ids []string
)
for i := 0; i < len(testcase.height); i++ {
s, n, teardown := newTestServerPeer(t, 0, protocol)
s, n, teardown := newTestServerPeer(t, 0, protocol, nil)
servers = append(servers, s)
nodes = append(nodes, n)
@ -132,10 +132,11 @@ func connect(server *serverHandler, serverId enode.ID, client *clientHandler, pr
}
// newTestServerPeer creates server peer.
func newTestServerPeer(t *testing.T, blocks int, protocol int) (*testServer, *enode.Node, func()) {
func newTestServerPeer(t *testing.T, blocks int, protocol int, indexFn indexerCallback) (*testServer, *enode.Node, func()) {
netconfig := testnetConfig{
blocks: blocks,
protocol: protocol,
indexFn: indexFn,
nopruning: true,
}
s, _, teardown := newClientServerEnv(t, netconfig)