File tree 2 files changed +33
-2
lines changed
2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -534,8 +534,11 @@ func (c *Client) GetPendingTxIds() ([]string, error) {
534
534
return res , nil
535
535
}
536
536
537
- func (c * Client ) GetBlockHashList () ([]string , error ) {
538
- body , statusCode , err := c .httpGet ("/hash_list" )
537
+ func (c * Client ) GetBlockHashList (from , to int ) ([]string , error ) {
538
+ if from > to {
539
+ return nil , errors .New ("from must <= to" )
540
+ }
541
+ body , statusCode , err := c .httpGet ("/hash_list/" + strconv .Itoa (from ) + "/" + strconv .Itoa (to ))
539
542
if statusCode != 200 {
540
543
return nil , errors .New ("get block hash list failed" )
541
544
}
Original file line number Diff line number Diff line change @@ -277,3 +277,31 @@ func TestNewTempConn(t *testing.T) {
277
277
t .Logf ("offset: %s, peer: %s" , offset .Offset , peer )
278
278
}
279
279
}
280
+
281
+ func TestClient_GetBlockHashList (t * testing.T ) {
282
+ c := NewClient ("https://arweave.net" )
283
+ from := 1095730
284
+ to := 1095750
285
+ list , err := c .GetBlockHashList (from , to )
286
+ assert .NoError (t , err )
287
+ t .Log (list )
288
+ }
289
+
290
+ func TestClient_GetBlockHashList2 (t * testing.T ) {
291
+ // c := NewClient("https://arweave.net")
292
+ // peers, err := c.GetPeers()
293
+ // assert.NoError(t, err)
294
+ // pNode := NewTempConn()
295
+ // for _, peer := range peers {
296
+ // pNode.SetTempConnUrl("http://" + peer)
297
+ // from := 1095740
298
+ // to := 1095750
299
+ // list, err := c.GetBlockHashList(from, to)
300
+ // if err != nil {
301
+ // t.Log("err", err, "perr", peer)
302
+ // continue
303
+ // }
304
+ // t.Log(peer)
305
+ // t.Log(list)
306
+ // }
307
+ }
You can’t perform that action at this time.
0 commit comments