start from a large light block to make sure that the pivot height doesn't select a height outside the appropriate range
(t *testing.T)
| 382 | // start from a large light block to make sure that the pivot height doesn't select a height outside |
| 383 | // the appropriate range |
| 384 | func TestClientLargeBisectionVerification(t *testing.T) { |
| 385 | veryLargeFullNode := mockp.New(genMockNode(chainID, 100, 3, 0, bTime)) |
| 386 | trustedLightBlock, err := veryLargeFullNode.LightBlock(ctx, 5) |
| 387 | require.NoError(t, err) |
| 388 | c, err := light.NewClient( |
| 389 | ctx, |
| 390 | chainID, |
| 391 | light.TrustOptions{ |
| 392 | Period: 4 * time.Hour, |
| 393 | Height: trustedLightBlock.Height, |
| 394 | Hash: trustedLightBlock.Hash(), |
| 395 | }, |
| 396 | veryLargeFullNode, |
| 397 | []provider.Provider{veryLargeFullNode}, |
| 398 | dbs.New(dbm.NewMemDB(), chainID), |
| 399 | light.SkippingVerification(light.DefaultTrustLevel), |
| 400 | ) |
| 401 | require.NoError(t, err) |
| 402 | h, err := c.Update(ctx, bTime.Add(100*time.Minute)) |
| 403 | assert.NoError(t, err) |
| 404 | h2, err := veryLargeFullNode.LightBlock(ctx, 100) |
| 405 | require.NoError(t, err) |
| 406 | assert.Equal(t, h, h2) |
| 407 | } |
| 408 | |
| 409 | func TestClientBisectionBetweenTrustedHeaders(t *testing.T) { |
| 410 | c, err := light.NewClient( |
nothing calls this directly
no test coverage detected