• R/O
  • HTTP
  • SSH
  • HTTPS

bytom: Commit

Official Go implementation of the Bytom protocol


Commit MetaInfo

Revisionc0efc8336ab3511b79658e2675e082da86fd79a9 (tree)
Zeit2021-06-30 14:55:17
Autorshenao78 <shenao.78@163....>
Commitershenao78

Log Message

add_node_xpub_for_net_info

Ändern Zusammenfassung

Diff

--- a/api/nodeinfo.go
+++ b/api/nodeinfo.go
@@ -4,6 +4,7 @@ import (
44 "context"
55 "net"
66
7+ "github.com/bytom/bytom/config"
78 "github.com/bytom/bytom/errors"
89 "github.com/bytom/bytom/netsync/peers"
910 "github.com/bytom/bytom/p2p"
@@ -21,6 +22,7 @@ type NetInfo struct {
2122 Listening bool `json:"listening"`
2223 Syncing bool `json:"syncing"`
2324 Mining bool `json:"mining"`
25+ NodeXPub string `json:"node_xpub"`
2426 PeerCount int `json:"peer_count"`
2527 CurrentBlock uint64 `json:"current_block"`
2628 HighestBlock uint64 `json:"highest_block"`
@@ -31,6 +33,7 @@ type NetInfo struct {
3133
3234 // GetNodeInfo return net information
3335 func (a *API) GetNodeInfo() (*NetInfo, error) {
36+ nodeXPub := config.CommonConfig.PrivateKey().XPub()
3437 finalizedBlockHeader, err := a.chain.LastFinalizedHeader()
3538 if err != nil {
3639 return nil, err
@@ -40,6 +43,7 @@ func (a *API) GetNodeInfo() (*NetInfo, error) {
4043 Listening: a.sync.IsListening(),
4144 Syncing: !a.sync.IsCaughtUp(),
4245 Mining: a.blockProposer.IsProposing(),
46+ NodeXPub: nodeXPub.String(),
4347 PeerCount: a.sync.PeerCount(),
4448 CurrentBlock: a.chain.BestBlockHeight(),
4549 FinalizedBlock: finalizedBlockHeader.Height,
Show on old repository browser