diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-31 17:50:16 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-31 17:50:16 +0800 |
commit | 8e0a39f33f9d24ebeca9cc88edf24cc6294552d7 (patch) | |
tree | 347eecc28183ddb9ac81c1e7ae97c755d2e747ba /ethpipe | |
parent | df5603de0a34e80a1af6ad03e37ce43728baad35 (diff) | |
download | go-tangerine-8e0a39f33f9d24ebeca9cc88edf24cc6294552d7.tar go-tangerine-8e0a39f33f9d24ebeca9cc88edf24cc6294552d7.tar.gz go-tangerine-8e0a39f33f9d24ebeca9cc88edf24cc6294552d7.tar.bz2 go-tangerine-8e0a39f33f9d24ebeca9cc88edf24cc6294552d7.tar.lz go-tangerine-8e0a39f33f9d24ebeca9cc88edf24cc6294552d7.tar.xz go-tangerine-8e0a39f33f9d24ebeca9cc88edf24cc6294552d7.tar.zst go-tangerine-8e0a39f33f9d24ebeca9cc88edf24cc6294552d7.zip |
Updated to use ethereum.js
Diffstat (limited to 'ethpipe')
-rw-r--r-- | ethpipe/js_types.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/ethpipe/js_types.go b/ethpipe/js_types.go index 05c12fbf6..956a49ab7 100644 --- a/ethpipe/js_types.go +++ b/ethpipe/js_types.go @@ -19,6 +19,7 @@ type JSBlock struct { Number int `json:"number"` Hash string `json:"hash"` Transactions *ethutil.List `json:"transactions"` + Uncles *ethutil.List `json:"uncles"` Time int64 `json:"time"` Coinbase string `json:"coinbase"` Name string `json:"name"` @@ -33,18 +34,24 @@ func NewJSBlock(block *ethchain.Block) *JSBlock { return &JSBlock{} } - var ptxs []*JSTransaction - for _, tx := range block.Transactions() { - ptxs = append(ptxs, NewJSTx(tx, block.State())) + ptxs := make([]*JSTransaction, len(block.Transactions())) + for i, tx := range block.Transactions() { + ptxs[i] = NewJSTx(tx, block.State()) } + txlist := ethutil.NewList(ptxs) - list := ethutil.NewList(ptxs) + puncles := make([]*JSBlock, len(block.Uncles)) + for i, uncle := range block.Uncles { + puncles[i] = NewJSBlock(uncle) + } + ulist := ethutil.NewList(puncles) 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, + Transactions: txlist, Uncles: ulist, + Time: block.Time, Coinbase: ethutil.Bytes2Hex(block.Coinbase), PrevHash: ethutil.Bytes2Hex(block.PrevHash), } |