diff options
Diffstat (limited to 'xeth/xeth.go')
-rw-r--r-- | xeth/xeth.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go index 451d3ceea..b78a45f88 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -86,17 +86,21 @@ func (self *XEth) BlockByHash(strHash string) *Block { return NewBlock(block) } -func (self *XEth) BlockByNumber(num uint64) *Block { - return NewBlock(self.chainManager.GetBlockByNumber(num)) +func (self *XEth) BlockByNumber(num int64) *Block { + if num == -1 { + return NewBlock(self.chainManager.CurrentBlock()) + } + + return NewBlock(self.chainManager.GetBlockByNumber(uint64(num))) } func (self *XEth) Block(v interface{}) *Block { if n, ok := v.(int32); ok { - return self.BlockByNumber(uint64(n)) + return self.BlockByNumber(int64(n)) } else if str, ok := v.(string); ok { return self.BlockByHash(str) } else if f, ok := v.(float64); ok { // Don't ask ... - return self.BlockByNumber(uint64(f)) + return self.BlockByNumber(int64(f)) } return nil |