cmd/get-block: display subsidy

Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
This commit is contained in:
Ciro S. Costa 2021-07-31 10:06:04 -04:00
parent 4ee9f9defa
commit e84b32b615
2 changed files with 6 additions and 5 deletions

View file

@ -109,7 +109,7 @@ func (c *getBlockCommand) pretty(ctx context.Context, v *daemon.GetBlockResult)
return fmt.Errorf("get txns: %w", err)
}
details, err := txnsResult.GetTransactions()
txnsDetails, err := txnsResult.GetTransactions()
if err != nil {
return fmt.Errorf("get transactions: %w", err)
}
@ -117,18 +117,19 @@ func (c *getBlockCommand) pretty(ctx context.Context, v *daemon.GetBlockResult)
prettyBlockHeader(table, v.BlockHeader)
fees := uint64(0)
for _, d := range details {
fees += d.RctSignatures.Txnfee
for _, txnDetails := range txnsDetails {
fees += txnDetails.RctSignatures.Txnfee
}
table.AddRow("Fees:", display.PreciseXMR(fees))
table.AddRow("Block Subsidy:", display.PreciseXMR(v.BlockHeader.Reward-fees))
fmt.Println(table)
fmt.Println("")
table = display.NewTable()
table.AddRow("HASH", "FEE (µɱ)", "FEE (µɱ per kB)", "IN/OUT", "SIZE")
for idx, txn := range txnsResult.Txs {
txnDetails := details[idx]
txnDetails := txnsDetails[idx]
fee := float64(txnDetails.RctSignatures.Txnfee)
size := len(txn.AsHex) / 2

View file

@ -32,7 +32,7 @@ func prettyBlockHeader(table *uitable.Table, header daemon.BlockHeader) {
table.AddRow("Orphan Status:", header.OrphanStatus)
table.AddRow("Proof-of-Work Hash:", header.PowHash)
table.AddRow("Previous Hash:", header.PrevHash)
table.AddRow("Reward:", display.PreciseXMR(header.Reward))
table.AddRow("Total Reward:", display.PreciseXMR(header.Reward))
table.AddRow("Timestamp:", fmt.Sprintf("%s (%s)", timestamp, humanize.Time(timestamp)))
table.AddRow("Wide Cumulative Difficulty:", header.WideCumulativeDifficulty)
table.AddRow("Wide Difficulty:", header.WideDifficulty)