improved error handling in parsing request
This commit is contained in:
parent
02c6af66bf
commit
6fdddc5ac9
@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/rpc/shared"
|
"github.com/ethereum/go-ethereum/rpc/shared"
|
||||||
"github.com/ethereum/go-ethereum/xeth"
|
"github.com/ethereum/go-ethereum/xeth"
|
||||||
"gopkg.in/fatih/set.v0"
|
"gopkg.in/fatih/set.v0"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -574,7 +575,7 @@ func (self *ethApi) Resend(req *shared.Request) (interface{}, error) {
|
|||||||
func (self *ethApi) PendingTransactions(req *shared.Request) (interface{}, error) {
|
func (self *ethApi) PendingTransactions(req *shared.Request) (interface{}, error) {
|
||||||
txs := self.ethereum.TxPool().GetTransactions()
|
txs := self.ethereum.TxPool().GetTransactions()
|
||||||
|
|
||||||
// grab the accounts from the account manager. This will help with determening which
|
// grab the accounts from the account manager. This will help with determining which
|
||||||
// transactions should be returned.
|
// transactions should be returned.
|
||||||
accounts, err := self.ethereum.AccountManager().Accounts()
|
accounts, err := self.ethereum.AccountManager().Accounts()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -917,7 +917,11 @@ func (args *ResendArgs) UnmarshalJSON(b []byte) (err error) {
|
|||||||
trans := new(tx)
|
trans := new(tx)
|
||||||
err = json.Unmarshal(data, trans)
|
err = json.Unmarshal(data, trans)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return shared.NewDecodeParamError("Unable to parse transaction object.")
|
return shared.NewDecodeParamError("Unable to parse transaction object")
|
||||||
|
}
|
||||||
|
|
||||||
|
if trans == nil || trans.tx == nil {
|
||||||
|
return shared.NewDecodeParamError("Unable to parse transaction object")
|
||||||
}
|
}
|
||||||
|
|
||||||
gasLimit, gasPrice := trans.GasLimit, trans.GasPrice
|
gasLimit, gasPrice := trans.GasLimit, trans.GasPrice
|
||||||
@ -936,6 +940,7 @@ func (args *ResendArgs) UnmarshalJSON(b []byte) (err error) {
|
|||||||
return shared.NewInvalidTypeError("gasLimit", "not a string")
|
return shared.NewInvalidTypeError("gasLimit", "not a string")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
args.Tx = trans
|
args.Tx = trans
|
||||||
args.GasPrice = gasPrice
|
args.GasPrice = gasPrice
|
||||||
args.GasLimit = gasLimit
|
args.GasLimit = gasLimit
|
||||||
|
Loading…
Reference in New Issue
Block a user