mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-15 16:33:47 +00:00
accounts/abi/abigen: add panic when encoding constructor input fails
This commit is contained in:
parent
1be2215a35
commit
1013c1c25b
1 changed files with 5 additions and 2 deletions
|
|
@ -71,8 +71,11 @@ var (
|
||||||
|
|
||||||
{{ if .Constructor.Inputs }}
|
{{ if .Constructor.Inputs }}
|
||||||
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) PackConstructor({{range .Constructor.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) []byte {
|
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) PackConstructor({{range .Constructor.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) []byte {
|
||||||
res, _ := {{ decapitalise $contract.Type}}.abi.Pack("" {{range .Constructor.Inputs}}, {{.Name}}{{end}})
|
enc, err := {{ decapitalise $contract.Type}}.abi.Pack("" {{range .Constructor.Inputs}}, {{.Name}}{{end}})
|
||||||
return res
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return enc
|
||||||
}
|
}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue