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

Don't assign a transaction type as a private variable #3726

Closed
MaciejBaj opened this issue May 24, 2019 · 0 comments
Closed

Don't assign a transaction type as a private variable #3726

MaciejBaj opened this issue May 24, 2019 · 0 comments

Comments

@MaciejBaj
Copy link
Contributor

MaciejBaj commented May 24, 2019

Expected behavior

Transaction type to compare the type against, for example const TRANSACTION_TRANSFER_TYPE = 0; for type 0 transaction is assigned in a way that can be overridden by the transactions that inherit after BaseTransction.

An example would be implementing the valid type as a static field:

class TransferTransaction {
   protected static TYPE = 10;
 ...

Actual behavior

The valid type is assigned as a private variable. Each function comparing a type (validate) needs to be re-implemented and cannot be overridden if a BaseTransction cannot access a valid transaction type.

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

2.0.0

@MaciejBaj MaciejBaj self-assigned this May 24, 2019
shuse2 added a commit that referenced this issue May 28, 2019
Move the type check from validateAsset to validate as a static field - Closes #3726
@shuse2 shuse2 closed this as completed May 28, 2019
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