good morning!!!!

Skip to content
Snippets Groups Projects
Commit b585f761 authored by Martin Holst Swende's avatar Martin Holst Swende Committed by Péter Szilágyi
Browse files

ethapi: prevent creating contract if no data is provided (#16108)

* ethapi: prevent creating contract if no data is provided

* internal/ethapi: downcase error for no data on contract creation
parent 14c76371
No related branches found
No related tags found
No related merge requests found
......@@ -1135,6 +1135,18 @@ func (args *SendTxArgs) setDefaults(ctx context.Context, b Backend) error {
if args.Data != nil && args.Input != nil && !bytes.Equal(*args.Data, *args.Input) {
return errors.New(`Both "data" and "input" are set and not equal. Please use "input" to pass transaction call data.`)
}
if args.To == nil {
// Contract creation
var input []byte
if args.Data != nil {
input = *args.Data
} else if args.Input != nil {
input = *args.Input
}
if len(input) == 0 {
return errors.New(`contract creation without any data provided`)
}
}
return nil
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment