Skip to content

fix(prot): support BPT entries with no account state [AC-3174]

Ethan Reesor requested to merge AC-3174-bpt-missing-account into develop

Closes AC-3174. Updates the database account model and the snapshot account entry to include the URL as its own attribute. Updates the account commit process to ensure the URL attribute is populated. Updates the snapshot collection process to write the transaction section before the account section, so that on restore the transactions are restored first.

In certain circumstances a transaction may be recorded as pending for a principal account that does not exist (has no main state). The transaction is added to Account.<url>.Pending and a BPT entry is created (or updated) but Account.<url>.Main is empty. The database account model requires the URL, so when a snapshot is taken the URL is recovered from the main state. If there is an account with no main state, the snapshot fails.

Additionally there is a bug with the new snapshot code introduced in AC-3076. If the account section is restored before the transaction section, any account with pending transactions will fail to restore, since restoring an account calls *Account.hashState which attempts to load the state of the account's pending transactions.

Review Checklist

If any item is not complete, the merge request is not ready to be reviewed and must be marked Draft:.

  • The merge request title is in the format <change type>(<change scope>): <short description> [<task id>]
    • For example, feat(cli): add QR code generation [AC-123]
    • For details, see CONTRIBUTING.md
  • The description includes Closes <jira task ID> (or rarely Updates <jira task ID>)
  • The change is fully validated by tests that are run during CI
    • In most cases this means a test in "validate.sh"
    • In some cases, a Go test may be acceptable
    • Validation is not applicable to things like documentation updates
    • Purely UI/UX changes can be manually validated, such as changes to human-readable output
    • For all other changes, automated validation tests are an absolute requirement unless a maintainer specifically explains why they are not in a comment on this merge request
  • The change is marked with one of the validation labels

Merge Checklist

  • CI is passing
  • Merge conflicts are resolved
  • All discussions are resolved

Related to AC-3174

Edited by Paul Snow

Merge request reports