accounts/abi: Deduplicate code in unpacker

This commit is contained in:
Martin Holst Swende
2017-12-30 16:07:12 +01:00
parent 1ede68355d
commit f0f594d045
4 changed files with 33 additions and 53 deletions

View File

@ -136,7 +136,7 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
// MethodById looks up a method by the 4-byte id
// returns nil if none found
func (abi *ABI) MethodById(sigdata []byte) (*Method, error){
func (abi *ABI) MethodById(sigdata []byte) (*Method, error) {
for _, method := range abi.Methods {
if bytes.Equal(method.Id(), sigdata[:4]) {
return &method, nil