mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
eth: Better error message for invalid filter topics
This commit is contained in:
parent
fe6a9473dc
commit
3dd1f0a048
1 changed files with 2 additions and 2 deletions
|
|
@ -538,7 +538,7 @@ func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
|
||||||
func decodeAddress(s string) (common.Address, error) {
|
func decodeAddress(s string) (common.Address, error) {
|
||||||
b, err := hexutil.Decode(s)
|
b, err := hexutil.Decode(s)
|
||||||
if err == nil && len(b) != common.AddressLength {
|
if err == nil && len(b) != common.AddressLength {
|
||||||
err = fmt.Errorf("hex has invalid length %d after decoding", len(b))
|
err = fmt.Errorf("hex has invalid length %d after decoding; expected %d for address", len(b), common.AddressLength)
|
||||||
}
|
}
|
||||||
return common.BytesToAddress(b), err
|
return common.BytesToAddress(b), err
|
||||||
}
|
}
|
||||||
|
|
@ -546,7 +546,7 @@ func decodeAddress(s string) (common.Address, error) {
|
||||||
func decodeTopic(s string) (common.Hash, error) {
|
func decodeTopic(s string) (common.Hash, error) {
|
||||||
b, err := hexutil.Decode(s)
|
b, err := hexutil.Decode(s)
|
||||||
if err == nil && len(b) != common.HashLength {
|
if err == nil && len(b) != common.HashLength {
|
||||||
err = fmt.Errorf("hex has invalid length %d after decoding", len(b))
|
err = fmt.Errorf("hex has invalid length %d after decoding; expected %d for topic", len(b), common.HashLength)
|
||||||
}
|
}
|
||||||
return common.BytesToHash(b), err
|
return common.BytesToHash(b), err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue