LiskArchive / lisk-elements

⚙️ Library for sending Lisk transactions from the client or server
https://lisk.io/
GNU General Public License v3.0
250 stars 64 forks source link

Transaction validate incorrectly throws error from assetToBytes #1214

Closed mitsuaki-u closed 5 years ago

mitsuaki-u commented 5 years ago

Expected behavior

validate method for each transaction type should return a TransactionResponse with errors array instead of throwing.

Actual behavior

When asset includes invalid data, validate --> getBasicBytes --> assetToBytes throws an error.

Steps to reproduce

const invalidTx = { "type": 0, "asset": { "data": { } }, ... };
const transferTx = new TransferTransaction(invalidTx);
transferTx.validate()

Which version(s) does this affect? (Environment, OS, etc...)