mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
accounts/abi: Fix method overwritten by same name methods.
This commit is contained in:
parent
52a6ec8d40
commit
aaad19f2a4
1 changed files with 8 additions and 2 deletions
|
|
@ -138,21 +138,27 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
|
||||||
}
|
}
|
||||||
// empty defaults to function according to the abi spec
|
// empty defaults to function according to the abi spec
|
||||||
case "function", "":
|
case "function", "":
|
||||||
|
_, ok := abi.Methods[field.Name]
|
||||||
|
if ok {
|
||||||
|
abi.Methods[field.Name+strconv.Itoa(functionCnt)] = abi.Methods[field.Name]
|
||||||
|
}
|
||||||
abi.Methods[field.Name] = Method{
|
abi.Methods[field.Name] = Method{
|
||||||
Name: field.Name,
|
Name: field.Name,
|
||||||
Const: field.Constant,
|
Const: field.Constant,
|
||||||
Inputs: field.Inputs,
|
Inputs: field.Inputs,
|
||||||
Outputs: field.Outputs,
|
Outputs: field.Outputs,
|
||||||
}
|
}
|
||||||
abi.Methods[field.Name+strconv.Itoa(functionCnt)] = abi.Methods[field.Name]
|
|
||||||
functionCnt++
|
functionCnt++
|
||||||
case "event":
|
case "event":
|
||||||
|
_, ok := abi.Events[field.Name]
|
||||||
|
if ok {
|
||||||
|
abi.Events[field.Name+strconv.Itoa(eventCnt)] = abi.Events[field.Name]
|
||||||
|
}
|
||||||
abi.Events[field.Name] = Event{
|
abi.Events[field.Name] = Event{
|
||||||
Name: field.Name,
|
Name: field.Name,
|
||||||
Anonymous: field.Anonymous,
|
Anonymous: field.Anonymous,
|
||||||
Inputs: field.Inputs,
|
Inputs: field.Inputs,
|
||||||
}
|
}
|
||||||
abi.Events[field.Name+strconv.Itoa(eventCnt)] = abi.Events[field.Name]
|
|
||||||
eventCnt++
|
eventCnt++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue