MCPcopy Create free account
hub / github.com/CPChain/chain / TestClient_BlockByNumber

Function TestClient_BlockByNumber

api/cpclient/cpclient_test.go:130–146  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

128}
129
130func TestClient_BlockByNumber(t *testing.T) {
131 t.Skip("must start chain to test")
132 client, err := cpclient.Dial("http://localhost:8501")
133 // local
134 if err != nil {
135 log.Fatal(err.Error())
136 }
137 block, err := client.BlockByNumber(context.Background(), big.NewInt(138))
138 if err != nil {
139 log.Fatal("BlockByNumber is error: ", err)
140 }
141 Number := block.Number()
142 tx := block.Transactions()
143 fmt.Println("block Transactions is :", tx)
144 fmt.Println("the blcok number is :", Number)
145
146}
147
148func TestClient_ChainConfig(t *testing.T) {
149 t.Skip("must start chain to test")

Callers

nothing calls this directly

Calls 5

TransactionsMethod · 0.80
FatalMethod · 0.65
ErrorMethod · 0.65
BlockByNumberMethod · 0.65
NumberMethod · 0.45

Tested by

no test coverage detected