diff options
author | obscuren <geffobscura@gmail.com> | 2014-08-20 19:36:54 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-08-20 19:36:54 +0800 |
commit | 89c442cadbf995f09259b6a30a6d51989bd3d777 (patch) | |
tree | a5bad231311f2d6d5c709b97c1469622212bfd61 | |
parent | 55a2f35a648ef70cdcc88bd751265e30831b54e5 (diff) | |
download | dexon-89c442cadbf995f09259b6a30a6d51989bd3d777.tar.gz dexon-89c442cadbf995f09259b6a30a6d51989bd3d777.tar.zst dexon-89c442cadbf995f09259b6a30a6d51989bd3d777.zip |
Added block by number
-rw-r--r-- | ethpipe/js_pipe.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ethpipe/js_pipe.go b/ethpipe/js_pipe.go index 4b0d6a849..51de4ddbe 100644 --- a/ethpipe/js_pipe.go +++ b/ethpipe/js_pipe.go @@ -28,6 +28,14 @@ func (self *JSPipe) BlockByHash(strHash string) *JSBlock { return NewJSBlock(block) } +func (self *JSPipe) GetBlockByNumber(num int32) *JSBlock { + if num == -1 { + return NewJSBlock(self.obj.BlockChain().CurrentBlock) + } + + return NewJSBlock(self.obj.BlockChain().GetBlockByNumber(uint64(num))) +} + func (self *JSPipe) Key() *JSKey { return NewJSKey(self.obj.KeyManager().KeyPair()) } |