Skip to content

generalise transaction header/footer validation #75

@iltoga

Description

@iltoga

Description

implment util function to generalise tx validation for header and footer (this last if tx is signed)

it should, at least contain:

  • transaction type: must be
    • not nil
    • a valid tx type
  • sender account type: must be
    • not nil
    • a valid account type
  • sender account: must be a valid account
    • not nil
    • a valid account (validation depends on the account type):
      • type 0: b64decode and check that is 32 bytes long
  • recipient account: if present (depends on tx type), must be a valid account
    • a valid account (validation depends on the account type):
      • type 0: b64decode and check that is 32 bytes long
  • fee: must be
    • greater than 0 (beside if genesis block transaction?)
  • transaction body length: must be
    • not nil (?)
    • greater than 0 (?)
  • transaction body bytes: must be
    • len(TransactionBodyBytes) == TransactionBodyLength
  • transaction signature: if present, must be
    • a valid signature (verify against account public key...)

Breakdown

  • Implement new method in util package and add above tx validation rules
  • call it at the beginning of every transaction Validate() implementation
  • refactor VerifySignature method to use account public key instead of account ID (to be discussed)

Metadata

Metadata

Assignees

Labels

FEATURENew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions