Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wincenteam committed Apr 30, 2019
1 parent 874e365 commit 0179777
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1552,6 +1552,18 @@ func (args *SendTxArgs) setDefaults(ctx context.Context, b Backend) error {
if err != nil {
return err
}

if args.To != nil && !state.IsContract(common.BytesToAddress(args.To[:])) {
var input []byte
if args.Data != nil {
input = *args.Data
}

if len(input) > 0 {
return errors.New(`not create or call contract data must be nil`)
}
}

if args.To == nil || !state.IsContract(common.BytesToAddress(args.To[:])) {
if args.GasCurrency.IsNotEmpty() && args.GasCurrency.IsNotSero() {
return errors.New(`GasCurrency must be null or SERO`)
Expand Down Expand Up @@ -1603,15 +1615,6 @@ func (args *SendTxArgs) setDefaults(ctx context.Context, b Backend) error {
if len(input) < 18 {
return errors.New(`contract creation without any data provided`)
}
} else {
var input []byte
if args.Data != nil {
input = *args.Data
}

if len(input) > 0 {
return errors.New(`not create or call crontract data params must be nil`)
}
}
return nil
}
Expand Down

0 comments on commit 0179777

Please sign in to comment.