fix message sending logic.

This commit is contained in:
Raúl Kripalani 2022-10-22 19:42:41 +01:00 committed by vyzo
parent 32617a61df
commit ab5f0216f6

View File

@ -150,12 +150,17 @@ func (tx *EthTxArgs) ToSignedMessage() (*types.SignedMessage, error) {
return nil, err
}
to = addr
var buf bytes.Buffer
if err := cbg.WriteByteArray(&buf, tx.Input); err != nil {
return nil, fmt.Errorf("failed to encode tx input into a cbor byte-string")
if len(tx.Input) > 0 {
var buf bytes.Buffer
if err := cbg.WriteByteArray(&buf, tx.Input); err != nil {
return nil, fmt.Errorf("failed to encode tx input into a cbor byte-string")
}
params = buf.Bytes()
method = builtintypes.MethodsEVM.InvokeContract
} else {
method = builtintypes.MethodSend
}
params = buf.Bytes()
method = builtintypes.MethodsEVM.InvokeContract
}
msg := &types.Message{