aboutsummaryrefslogtreecommitdiffstats
path: root/ethpipe/js_pipe.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethpipe/js_pipe.go')
-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())
}