cli: show timestamp of the block

This commit is contained in:
Wei Yang 2017-10-11 23:19:44 +08:00
parent cb32e7ca13
commit c0accf31e0
1 changed files with 2 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"strconv" "strconv"
"time"
) )
func (cli *CLI) printChain(nodeID string) { func (cli *CLI) printChain(nodeID string) {
@ -17,6 +18,7 @@ func (cli *CLI) printChain(nodeID string) {
fmt.Printf("============ Block %x ============\n", block.Hash) fmt.Printf("============ Block %x ============\n", block.Hash)
fmt.Printf("Height: %d\n", block.Height) fmt.Printf("Height: %d\n", block.Height)
fmt.Printf("Prev. block: %x\n", block.PrevBlockHash) fmt.Printf("Prev. block: %x\n", block.PrevBlockHash)
fmt.Printf("Created at : %s\n", time.Unix(block.Timestamp, 0))
pow := NewProofOfWork(block) pow := NewProofOfWork(block)
fmt.Printf("PoW: %s\n\n", strconv.FormatBool(pow.Validate())) fmt.Printf("PoW: %s\n\n", strconv.FormatBool(pow.Validate()))
for _, tx := range block.Transactions { for _, tx := range block.Transactions {