"best_height": 1024,
"policy": {
"confirmations": 150,
- "lantency_ms": 500
+ "required_lantency_ms": 500
}
}
```
{
"alias": "cobo",
"pubkey": "...",
+ "host": "vapornode.cobo.com",
+ "port": 123,
"best_height": 1023,
"lantency_ms": 300,
- "active_minutes": 4096
+ "active_minutes": 4096,
+ "status": "healthy"
},
{
"alias": "matpool",
"pubkey": "...",
+ "host": "vapornode.matpool.io",
+ "port": 321,
"best_height": 1024,
"lantency_ms": 299,
- "active_minutes": 4097
+ "active_minutes": 4097,
+ "status": "healthy"
}
]
}
type Config struct {
MySQLConfig common.MySQLConfig `json:"mysql"`
- CheckFreqSeconds uint64 `json:"check_seconds"`
+ CheckFreqSeconds uint64 `json:"check_frequency_seconds"`
Policy Policy `json:"policy"`
Nodes []Node `json:"bootstrap_nodes"`
API API `json:"api"`
}
type Policy struct {
- LantencyMS uint64 `json:"lantency_ms"`
+ Confirmations uint64 `json:"confirmations"`
+ RequiredLantencyMS uint64 `json:"required_lantency_ms"`
}
type Node struct {
- Alias string `json:"alias"`
- HostPort string `json:"host_port"`
- PubKey chainkd.XPub `json:"pubkey"`
+ Alias string `json:"alias"`
+ PubKey chainkd.XPub `json:"pubkey"`
+ Host string `json:"host"`
+ Port uint16 `json:"port"`
}
type API struct {
- HostPort bool `json:"host_port"`
+ ListeningPort bool `json:"listening_port"`
AccessToken string `json:"access_token"`
IsReleaseMode bool `json:"is_release_mode"`
}
func (n *Node) MarshalJSON() ([]byte, error) {
status := common.StatusMap[n.Status]
var lantency uint64
- var activeTime time.Duration
+ var activeMinutes uint64
if n.Status != common.NodeOfflineStatus {
lantency = n.LantencyMS
- activeTime = time.Since(n.ActiveBeginTime)
+ activeMinutes = uint64(time.Since(n.ActiveBeginTime).Minutes())
}
return json.Marshal(&struct {
- Alias string `json:"alias"`
- PubKey chainkd.XPub `json:"pubkey"`
- Host string `json:"host"`
- Port uint16 `json:"port"`
- BestHeight uint64 `json:"best_height"`
- LantencyMS uint64 `json:"lantency_ms,omitempty"`
- ActiveTime time.Duration `json:"active_time,omitempty"`
- Status string `json:"status"`
+ Alias string `json:"alias"`
+ PubKey chainkd.XPub `json:"pubkey"`
+ Host string `json:"host"`
+ Port uint16 `json:"port"`
+ BestHeight uint64 `json:"best_height"`
+ LantencyMS uint64 `json:"lantency_ms,omitempty"`
+ ActiveMinutes uint64 `json:"active_minutes,omitempty"`
+ Status string `json:"status"`
}{
- Alias: n.Alias,
- PubKey: n.PubKey,
- Host: n.Host,
- Port: n.Port,
- BestHeight: n.BestHeight,
- LantencyMS: lantency,
- activeTime: activeTime,
- Status: status,
+ Alias: n.Alias,
+ PubKey: n.PubKey,
+ Host: n.Host,
+ Port: n.Port,
+ BestHeight: n.BestHeight,
+ LantencyMS: lantency,
+ ActiveMinutes: activeMinutes,
+ Status: status,
})
}