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"
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"`
return false, errors.Wrap(err, "query chain")
}
- height, err := s.node.GetBlockCount()
+ netInfo, err := s.node.GetNetInfo()
if err != nil {
return false, err
}
- if height <= chain.BlockHeight+s.cfg.Confirmations {
+ if netInfo.IrreversibleBlock <= chain.BlockHeight {
return false, nil
}