aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-08-20 19:36:54 +0800
committerobscuren <geffobscura@gmail.com>2014-08-20 19:36:54 +0800
commit89c442cadbf995f09259b6a30a6d51989bd3d777 (patch)
treea5bad231311f2d6d5c709b97c1469622212bfd61
parent55a2f35a648ef70cdcc88bd751265e30831b54e5 (diff)
downloadgo-tangerine-89c442cadbf995f09259b6a30a6d51989bd3d777.tar.gz
go-tangerine-89c442cadbf995f09259b6a30a6d51989bd3d777.tar.zst
go-tangerine-89c442cadbf995f09259b6a30a6d51989bd3d777.zip
Added block by number
-rw-r--r--ethpipe/js_pipe.go8
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())
}