(t *testing.T)
| 887 | } |
| 888 | |
| 889 | func TestClient_NewClientFromTrustedStore(t *testing.T) { |
| 890 | // 1) Initiate DB and fill with a "trusted" header |
| 891 | db := dbs.New(dbm.NewMemDB(), chainID) |
| 892 | err := db.SaveLightBlock(l1) |
| 893 | require.NoError(t, err) |
| 894 | |
| 895 | c, err := light.NewClientFromTrustedStore( |
| 896 | chainID, |
| 897 | trustPeriod, |
| 898 | deadNode, |
| 899 | []provider.Provider{deadNode}, |
| 900 | db, |
| 901 | ) |
| 902 | require.NoError(t, err) |
| 903 | |
| 904 | // 2) Check light block exists (deadNode is being used to ensure we're not getting |
| 905 | // it from primary) |
| 906 | h, err := c.TrustedLightBlock(1) |
| 907 | assert.NoError(t, err) |
| 908 | assert.EqualValues(t, l1.Height, h.Height) |
| 909 | } |
| 910 | |
| 911 | func TestClientRemovesWitnessIfItSendsUsIncorrectHeader(t *testing.T) { |
| 912 | // different headers hash then primary plus less than 1/3 signed (no fork) |
nothing calls this directly
no test coverage detected