forked from FISCO-BCOS/go-sdk
/
sync_status.go
91 lines (75 loc) · 2.28 KB
/
sync_status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package types
type SyncStatus struct {
BlockNumber int `json:"blockNumber"`
GenesisHash string `json:"genesisHash"`
IsSyncing bool `json:"isSyncing"`
KnownHighestNumber int `json:"knownHighestNumber"`
KnownLatestHash string `json:"knownLatestHash"`
LatestHash string `json:"latestHash"`
NodeId string `json:"nodeId"`
Peers []Peer `json:"peers"`
ProtocolId int `json:"protocolId"`
TxPoolSize string `json:"txPoolSize"`
}
type Peer struct {
BlockNumber int `json:"blockNumber"`
GenesisHash string `json:"genesisHash"`
LatestHash string `json:"latestHash"`
NodeId string `json:"nodeId"`
}
// GetBlockNumber returns the laster block number int
func (p *Peer) GetBlockNumber() int {
return p.BlockNumber
}
// GetGenesisHash returns the original block hash string
func (p *Peer) GetGenesisHash() string {
return p.GenesisHash
}
// GetLatestHash returns the laster block hash string
func (p *Peer) GetLatestHash() string {
return p.LatestHash
}
// GetNodeId returns the node id string
func (p *Peer) GetNodeId() string {
return p.NodeId
}
// GetBlockNumber returns the block number int
func (s *SyncStatus) GetBlockNumber() int {
return s.BlockNumber
}
// GetGenesisHash returns the original block hash string
func (s *SyncStatus) GetGenesisHash() string {
return s.GenesisHash
}
// GetIsSyncing returns sync status
func (s *SyncStatus) GetIsSyncing() bool {
return s.IsSyncing
}
// GetKnownHighestNumber returns the known highest number int
func (s *SyncStatus) GetKnownHighestNumber() int {
return s.KnownHighestNumber
}
// GetKnownLatestHash returns the known latest Hash string
func (s *SyncStatus) GetKnownLatestHash() string {
return s.KnownLatestHash
}
// GetLatestHash returns the last hash string
func (s *SyncStatus) GetLatestHash() string {
return s.LatestHash
}
// GetNodeId returns the node id string
func (s *SyncStatus) GetNodeId() string {
return s.NodeId
}
// GetPeers returns the peers
func (s *SyncStatus) GetPeers() []Peer {
return s.Peers
}
// GetProtocolId returns the transaction protocol id int
func (s *SyncStatus) GetProtocolId() int {
return s.ProtocolId
}
// GetTxPoolSize returns the transaction pool size
func (s *SyncStatus) GetTxPoolSize() string {
return s.TxPoolSize
}