cmd/get-info: add missing fields

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
This commit is contained in:
Ciro S. Costa 2021-08-03 17:44:33 -04:00
parent 0094b0481e
commit c0cee1b176
2 changed files with 54 additions and 31 deletions

View file

@ -2,7 +2,9 @@ package daemon
import (
"fmt"
"time"
"github.com/dustin/go-humanize"
"github.com/spf13/cobra"
"github.com/cirocosta/go-monero/cmd/monero/display"
@ -53,32 +55,42 @@ func (c *getInfoCommand) RunE(_ *cobra.Command, _ []string) error {
func (c *getInfoCommand) pretty(v *daemon.GetInfoResult) {
table := display.NewTable()
table.AddRow("Adjusted Time:", time.Unix(int64(v.AdjustedTime), 0))
table.AddRow("Alternative Blocks:", v.AltBlocksCount)
table.AddRow("Block Size Limit:", v.BlockSizeLimit)
table.AddRow("Block Size Median:", v.BlockSizeMedian)
table.AddRow("Block Size Limit:", humanize.Bytes(v.BlockSizeLimit))
table.AddRow("Block Size Median:", humanize.Bytes(v.BlockSizeMedian))
table.AddRow("Block Size Limit:", humanize.Bytes(v.BlockWeightLimit))
table.AddRow("Block Size Median:", humanize.Bytes(v.BlockWeightMedian))
table.AddRow("Bootstrap Daemon Address:", v.BootstrapDaemonAddress)
table.AddRow("Busy Syncing:", v.BusySyncing)
table.AddRow("Cumulative Difficulty:", v.CumulativeDifficulty)
table.AddRow("DatabaseSize:", humanize.Bytes(v.DatabaseSize))
table.AddRow("Difficulty:", v.Difficulty)
table.AddRow("Free Space:", v.FreeSpace)
table.AddRow("Free Space:", humanize.Bytes(v.FreeSpace))
table.AddRow("Grey Peer List Size:", v.GreyPeerlistSize)
table.AddRow("Height:", v.Height)
table.AddRow("Height Without Bootstrap:", v.HeightWithoutBootstrap)
table.AddRow("Incoming Connections:", v.IncomingConnectionsCount)
table.AddRow("Mainnet:", v.Mainnet)
table.AddRow("Nettype:", v.Nettype)
table.AddRow("Offline:", v.Offline)
table.AddRow("Outgoing Connections:", v.OutgoingConnectionsCount)
table.AddRow("RPC Connections:", v.RPCConnectionsCount)
table.AddRow("Stagenet:", v.Stagenet)
table.AddRow("Start Time:", v.StartTime)
table.AddRow("Start Time:", time.Unix(int64(v.StartTime), 0))
table.AddRow("Synchronized:", v.Synchronized)
table.AddRow("Target:", v.Target)
table.AddRow("Target Height:", v.TargetHeight)
table.AddRow("Testnet:", v.Testnet)
table.AddRow("TopBlockHash:", v.TopBlockHash)
table.AddRow("Transactions:", v.TxCount)
table.AddRow("Transaction Pool Size:", v.TxPoolSize)
table.AddRow("Update Available:", v.UpdateAvailable)
table.AddRow("Version:", v.Version)
table.AddRow("Was Bootstrap Ever Used:", v.WasBootstrapEverUsed)
table.AddRow("White Peer List:", v.WhitePeerlistSize)
table.AddRow("WideCumulativeDifficulty:", v.WideCumulativeDifficulty)
table.AddRow("WideDifficulty:", v.WideDifficulty)
fmt.Println(table)
}

View file

@ -203,33 +203,44 @@ type GetFeeEstimateResult struct {
// GetInfoResult is the result of a call to the GetInfo RPC method.
//
type GetInfoResult struct {
AltBlocksCount int `json:"alt_blocks_count"`
BlockSizeLimit int `json:"block_size_limit"`
BlockSizeMedian int `json:"block_size_median"`
BootstrapDaemonAddress string `json:"bootstrap_daemon_address"`
BusySyncing bool `json:"busy_syncing"`
CumulativeDifficulty int64 `json:"cumulative_difficulty"`
Difficulty int64 `json:"difficulty"`
FreeSpace uint64 `json:"free_space"`
GreyPeerlistSize int `json:"grey_peerlist_size"`
Height uint64 `json:"height"`
HeightWithoutBootstrap int `json:"height_without_bootstrap"`
IncomingConnectionsCount int `json:"incoming_connections_count"`
Mainnet bool `json:"mainnet"`
Offline bool `json:"offline"`
OutgoingConnectionsCount int `json:"outgoing_connections_count"`
RPCConnectionsCount int `json:"rpc_connections_count"`
Stagenet bool `json:"stagenet"`
StartTime int `json:"start_time"`
Synchronized bool `json:"synchronized"`
Target int `json:"target"`
TargetHeight int `json:"target_height"`
Testnet bool `json:"testnet"`
TopBlockHash string `json:"top_block_hash"`
TxCount int `json:"tx_count"`
TxPoolSize int `json:"tx_pool_size"`
WasBootstrapEverUsed bool `json:"was_bootstrap_ever_used"`
WhitePeerlistSize int `json:"white_peerlist_size"`
AdjustedTime uint64 `json:"adjusted_time"`
AltBlocksCount int `json:"alt_blocks_count"`
BlockSizeLimit uint64 `json:"block_size_limit"`
BlockSizeMedian uint64 `json:"block_size_median"`
BlockWeightLimit uint64 `json:"block_weight_limit"`
BlockWeightMedian uint64 `json:"block_weight_median"`
BootstrapDaemonAddress string `json:"bootstrap_daemon_address"`
BusySyncing bool `json:"busy_syncing"`
CumulativeDifficulty int64 `json:"cumulative_difficulty"`
CumulativeDifficultyTop64 uint64 `json:"cumulative_difficulty_top64"`
DatabaseSize uint64 `json:"database_size"`
Difficulty uint64 `json:"difficulty"`
DifficultyTop64 uint64 `json:"difficulty_top64"`
FreeSpace uint64 `json:"free_space"`
GreyPeerlistSize uint `json:"grey_peerlist_size"`
Height uint64 `json:"height"`
HeightWithoutBootstrap uint64 `json:"height_without_bootstrap"`
IncomingConnectionsCount uint `json:"incoming_connections_count"`
Mainnet bool `json:"mainnet"`
Nettype string `json:"nettype"`
Offline bool `json:"offline"`
OutgoingConnectionsCount uint `json:"outgoing_connections_count"`
RPCConnectionsCount uint `json:"rpc_connections_count"`
Stagenet bool `json:"stagenet"`
StartTime uint64 `json:"start_time"`
Synchronized bool `json:"synchronized"`
Target uint64 `json:"target"`
TargetHeight uint64 `json:"target_height"`
Testnet bool `json:"testnet"`
TopBlockHash string `json:"top_block_hash"`
TxCount uint64 `json:"tx_count"`
TxPoolSize uint64 `json:"tx_pool_size"`
UpdateAvailable bool `json:"update_available"`
Version string `json:"version"`
WasBootstrapEverUsed bool `json:"was_bootstrap_ever_used"`
WhitePeerlistSize uint `json:"white_peerlist_size"`
WideCumulativeDifficulty string `json:"wide_cumulative_difficulty"`
WideDifficulty string `json:"wide_difficulty"`
RPCResultFooter `json:",inline"`
}