diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-23 18:54:23 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-23 18:54:23 +0800 |
commit | 6fd894aae00c8c0f9f33eae7353dd9afd97f4fa1 (patch) | |
tree | d63243bec273cf08743092d40023e0a87955892d /rpc/packages.go | |
parent | dd086791acf477da7641c168f82de70ed0b2dca6 (diff) | |
download | dexon-6fd894aae00c8c0f9f33eae7353dd9afd97f4fa1.tar dexon-6fd894aae00c8c0f9f33eae7353dd9afd97f4fa1.tar.gz dexon-6fd894aae00c8c0f9f33eae7353dd9afd97f4fa1.tar.bz2 dexon-6fd894aae00c8c0f9f33eae7353dd9afd97f4fa1.tar.lz dexon-6fd894aae00c8c0f9f33eae7353dd9afd97f4fa1.tar.xz dexon-6fd894aae00c8c0f9f33eae7353dd9afd97f4fa1.tar.zst dexon-6fd894aae00c8c0f9f33eae7353dd9afd97f4fa1.zip |
Allow zero and negative block numbers
0 is genesis block. Xeth recognises -1 as current
Diffstat (limited to 'rpc/packages.go')
-rw-r--r-- | rpc/packages.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/rpc/packages.go b/rpc/packages.go index b51bde7ce..2f694b823 100644 --- a/rpc/packages.go +++ b/rpc/packages.go @@ -177,15 +177,11 @@ func (self *EthereumApi) AllLogs(args *FilterOptions, reply *interface{}) error } func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error { - err := args.requirements() - if err != nil { - return err - } - - if args.BlockNumber > 0 { - *reply = p.xeth.BlockByNumber(args.BlockNumber) - } else { + // This seems a bit precarious Maybe worth splitting to discrete functions + if len(args.Hash) > 0 { *reply = p.xeth.BlockByHash(args.Hash) + } else { + *reply = p.xeth.BlockByNumber(args.BlockNumber) } return nil } |