From 85ebbc9aa5e4c8902b94847dbeb78f26255eb0aa Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 2 Apr 2015 11:57:26 +0200 Subject: Default BlockNumber to -1 when missing --- rpc/args.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'rpc/args.go') diff --git a/rpc/args.go b/rpc/args.go index dd013147d..220daf960 100644 --- a/rpc/args.go +++ b/rpc/args.go @@ -233,6 +233,8 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) { if err := blockHeightFromJson(obj[1], &args.BlockNumber); err != nil { return err } + } else { + args.BlockNumber = -1 } return nil @@ -320,6 +322,8 @@ func (args *CallArgs) UnmarshalJSON(b []byte) (err error) { if err := blockHeightFromJson(obj[1], &args.BlockNumber); err != nil { return err } + } else { + args.BlockNumber = -1 } return nil @@ -350,6 +354,8 @@ func (args *GetStorageArgs) UnmarshalJSON(b []byte) (err error) { if err := blockHeight(obj[1], &args.BlockNumber); err != nil { return err } + } else { + args.BlockNumber = -1 } return nil @@ -387,6 +393,8 @@ func (args *GetStorageAtArgs) UnmarshalJSON(b []byte) (err error) { if err := blockHeight(obj[2], &args.BlockNumber); err != nil { return err } + } else { + args.BlockNumber = -1 } return nil @@ -417,6 +425,8 @@ func (args *GetTxCountArgs) UnmarshalJSON(b []byte) (err error) { if err := blockHeight(obj[1], &args.BlockNumber); err != nil { return err } + } else { + args.BlockNumber = -1 } return nil @@ -447,6 +457,8 @@ func (args *GetBalanceArgs) UnmarshalJSON(b []byte) (err error) { if err := blockHeight(obj[1], &args.BlockNumber); err != nil { return err } + } else { + args.BlockNumber = -1 } return nil @@ -477,6 +489,8 @@ func (args *GetDataArgs) UnmarshalJSON(b []byte) (err error) { if err := blockHeight(obj[1], &args.BlockNumber); err != nil { return err } + } else { + args.BlockNumber = -1 } return nil -- cgit v1.2.3