From 9ed8dc7384deb932be624699d9f628d3d00ba31e Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 25 Sep 2014 16:57:49 +0200 Subject: Attempt to catch up from unknown block --- ethpipe/js_types.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'ethpipe') diff --git a/ethpipe/js_types.go b/ethpipe/js_types.go index ccd585cf0..7266a5be4 100644 --- a/ethpipe/js_types.go +++ b/ethpipe/js_types.go @@ -23,12 +23,13 @@ type JSBlock struct { Name string `json:"name"` GasLimit string `json:"gasLimit"` GasUsed string `json:"gasUsed"` + PrevHash string `json:"prevHash"` } // Creates a new QML Block from a chain block func NewJSBlock(block *ethchain.Block) *JSBlock { if block == nil { - return nil + return &JSBlock{} } var ptxs []JSTransaction @@ -38,7 +39,14 @@ func NewJSBlock(block *ethchain.Block) *JSBlock { list := ethutil.NewList(ptxs) - return &JSBlock{ref: block, Size: block.Size().String(), Number: int(block.Number.Uint64()), GasUsed: block.GasUsed.String(), GasLimit: block.GasLimit.String(), Hash: ethutil.Bytes2Hex(block.Hash()), Transactions: list, Time: block.Time, Coinbase: ethutil.Bytes2Hex(block.Coinbase)} + return &JSBlock{ + ref: block, Size: block.Size().String(), + Number: int(block.Number.Uint64()), GasUsed: block.GasUsed.String(), + GasLimit: block.GasLimit.String(), Hash: ethutil.Bytes2Hex(block.Hash()), + Transactions: list, Time: block.Time, + Coinbase: ethutil.Bytes2Hex(block.Coinbase), + PrevHash: ethutil.Bytes2Hex(block.PrevHash), + } } func (self *JSBlock) ToString() string { -- cgit v1.2.3