From 89c442cadbf995f09259b6a30a6d51989bd3d777 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 20 Aug 2014 13:36:54 +0200 Subject: Added block by number --- ethpipe/js_pipe.go | 8 ++++++++ 1 file changed, 8 insertions(+) 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()) } -- cgit