aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/abi.go
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2017-12-28 18:17:45 +0800
committerMartin Holst Swende <martin@swende.se>2018-02-21 19:27:50 +0800
commit1ede68355db6adbf468d198a8d1ecb0ad1a3ea31 (patch)
tree288e71dbf81a19030f36f507d6b91bd42f3ba979 /accounts/abi/abi.go
parent5603715c06998ff9ed30eb134c4398ad1439ef48 (diff)
downloadgo-tangerine-1ede68355db6adbf468d198a8d1ecb0ad1a3ea31.tar
go-tangerine-1ede68355db6adbf468d198a8d1ecb0ad1a3ea31.tar.gz
go-tangerine-1ede68355db6adbf468d198a8d1ecb0ad1a3ea31.tar.bz2
go-tangerine-1ede68355db6adbf468d198a8d1ecb0ad1a3ea31.tar.lz
go-tangerine-1ede68355db6adbf468d198a8d1ecb0ad1a3ea31.tar.xz
go-tangerine-1ede68355db6adbf468d198a8d1ecb0ad1a3ea31.tar.zst
go-tangerine-1ede68355db6adbf468d198a8d1ecb0ad1a3ea31.zip
accounts/abi: add another unpack interface
Diffstat (limited to 'accounts/abi/abi.go')
-rw-r--r--accounts/abi/abi.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/accounts/abi/abi.go b/accounts/abi/abi.go
index abcb403db..32f041890 100644
--- a/accounts/abi/abi.go
+++ b/accounts/abi/abi.go
@@ -136,11 +136,11 @@ 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 {
+func (abi *ABI) MethodById(sigdata []byte) (*Method, error){
for _, method := range abi.Methods {
if bytes.Equal(method.Id(), sigdata[:4]) {
- return &method
+ return &method, nil
}
}
- return nil
+ return nil, fmt.Errorf("ABI spec does not contain method signature in data: 0x%x", sigdata[:4])
}