[ctr/lua] minor bug fix for preload
change to prevent error when sending tx with payload to non-contract account
@@ -2,7 +2,6 @@ package contract
import "C"
import (
- "errors"
"strconv"
"github.com/aergoio/aergo/state"
@@ -150,14 +149,10 @@ func preLoadWorker() {
continue
}
/* When deploy and call in same block and not deployed yet*/
- if receiver.IsNew() {
+ if receiver.IsNew() || len(receiver.State().CodeHash) == 0 {
replyCh <- &loadedReply{tx, nil, nil}
continue
}
- if len(receiver.State().CodeHash) == 0 {
- replyCh <- &loadedReply{tx, nil, errors.New("account is not a contract")}
- continue
- }
contractState, err := bs.OpenContractState(receiver.AccountID(), receiver.State())
if err != nil {
replyCh <- &loadedReply{tx, nil, err}
