aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-06 23:54:08 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-06 23:54:08 +0800
commitdc7022cd613113b90b491cffe3eab30c102e6345 (patch)
tree41f66ad1785b6c9164aeb13471021d7c476d2114 /xeth
parent5da3d911cf80e032ceb79a17609e41973923fc1a (diff)
downloadgo-tangerine-dc7022cd613113b90b491cffe3eab30c102e6345.tar
go-tangerine-dc7022cd613113b90b491cffe3eab30c102e6345.tar.gz
go-tangerine-dc7022cd613113b90b491cffe3eab30c102e6345.tar.bz2
go-tangerine-dc7022cd613113b90b491cffe3eab30c102e6345.tar.lz
go-tangerine-dc7022cd613113b90b491cffe3eab30c102e6345.tar.xz
go-tangerine-dc7022cd613113b90b491cffe3eab30c102e6345.tar.zst
go-tangerine-dc7022cd613113b90b491cffe3eab30c102e6345.zip
Increased args test coverage
Diffstat (limited to 'xeth')
-rw-r--r--xeth/xeth.go12
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