Added block by number

This commit is contained in:
obscuren 2014-08-20 13:36:54 +02:00
parent 55a2f35a64
commit 89c442cadb
1 changed files with 8 additions and 0 deletions

View File

@ -28,6 +28,14 @@ func (self *JSPipe) BlockByHash(strHash string) *JSBlock {
return NewJSBlock(block) 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 { func (self *JSPipe) Key() *JSKey {
return NewJSKey(self.obj.KeyManager().KeyPair()) return NewJSKey(self.obj.KeyManager().KeyPair())
} }