z1h_create_client_filetest.gno
0.94 Kb · 29 lines
1// PKGPATH: gno.land/r/aib/main
2package main
3
4import (
5 "time"
6
7 tmtesting "gno.land/p/aib/ibc/lightclient/tendermint/testing"
8 "gno.land/p/aib/ibc/types"
9 "gno.land/r/aib/ibc/core"
10)
11
12// RegisterCounterparty twice
13func main(cur realm) {
14 var (
15 chainID = "chain-id-2"
16 clientState = tmtesting.NewClientState(chainID, types.NewHeight(2, 2))
17 apphash = tmtesting.Hash("apphash")
18 trustedValset = tmtesting.GenValset()
19 consensusState = tmtesting.GenConsensusState(time.Now(), apphash, trustedValset.Hash())
20 )
21 clientID := core.CreateClient(cross(cur), clientState, consensusState)
22 core.RegisterCounterparty(cross(cur), clientID, [][]byte{[]byte("iavlStoreKey"), []byte("prefix2")}, "07-tendermint-2")
23
24 // Second RegisterCounterparty on clientID
25 core.RegisterCounterparty(cross(cur), clientID, [][]byte{[]byte("iavlStoreKey"), []byte("prefix2")}, "07-tendermint-2")
26}
27
28// Error:
29// cannot register counterparty once it is already set