MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / TestClient_NewClientFromTrustedStore

Function TestClient_NewClientFromTrustedStore

light/client_test.go:889–909  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

887}
888
889func 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
911func TestClientRemovesWitnessIfItSendsUsIncorrectHeader(t *testing.T) {
912 // different headers hash then primary plus less than 1/3 signed (no fork)

Callers

nothing calls this directly

Calls 3

SaveLightBlockMethod · 0.65
TrustedLightBlockMethod · 0.65

Tested by

no test coverage detected