cli: show timestamp of the block
This commit is contained in:
parent
cb32e7ca13
commit
c0accf31e0
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue