OSDN Git Service

add net info (#548)
[bytom/vapor.git] / toolbar / federation / service / node.go
index 5ca0042..48aac54 100644 (file)
@@ -3,6 +3,7 @@ package service
 import (
        "encoding/json"
 
+       "github.com/bytom/vapor/api"
        "github.com/bytom/vapor/errors"
        "github.com/bytom/vapor/protocol/bc"
        "github.com/bytom/vapor/toolbar/common"
@@ -36,6 +37,12 @@ func (n *Node) GetBlockCount() (uint64, error) {
        return res.BlockCount, n.request(url, nil, res)
 }
 
+func (n *Node) GetNetInfo() (*api.NetInfo, error) {
+       url := "/net-info"
+       res := &api.NetInfo{}
+       return res, n.request(url, nil, res)
+}
+
 type getRawBlockReq struct {
        BlockHeight uint64 `json:"block_height"`
        BlockHash   string `json:"block_hash"`