Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Custom transaction fails to validate if FEE member is not defined #3941

Closed
lsilvs opened this issue Jul 9, 2019 · 1 comment
Closed

Custom transaction fails to validate if FEE member is not defined #3941

lsilvs opened this issue Jul 9, 2019 · 1 comment

Comments

@lsilvs
Copy link
Contributor

lsilvs commented Jul 9, 2019

Expected behavior

Expect custom transaction to not crash during validation if FEE member is not defined.

Actual behavior

The PR #3893 introduced a new static member called FEE to BaseTransaction. This property should be implemented by custom transactions to define its own fee but it crashes during validation if it's not defined.

Steps to reproduce

Create a custom transaction extending BaseTransaction like:

class CustomTransaction extends BaseTransaction {
	static get TYPE () {
		return 10;
	}

	validateAsset() {
		return[];
	}
}

Then:

const tx = new CustomTransaction({
  recipientId: '10881167371402274308L',
});

tx.sign('passphrase');
tx.validate();

validate() will throw eq() not a number: undefined

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

2.1

@lsilvs
Copy link
Contributor Author

lsilvs commented Jul 9, 2019

The FEE member can also be used as default fee when instantiating the transaction the same way TYPE is used when type property is not given.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants