Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet: Add open/close and connect/disconnect events. #859

Merged
merged 3 commits into from
Oct 20, 2023

Conversation

nodech
Copy link
Contributor

@nodech nodech commented Oct 16, 2023

WalletDB open does not guarantee that the connection will open, if it's in standalone mode it may fail. So having the connect method inside open w/o any guarantees leaves any logic depending on it break. So it's much better to totally remove the concept of connection from open.

This changes several things:

  • on open state cache needs to be recovered first (it was done on connect). If we don't have cache, then we initialize after on connect in the syncNode.
  • migration can no longer start a rescan (and it may have failed previously on standalone) - it will instead rollback.
  • Added new flag wallet-migration-no-rescan - that tells to ignore rescan request from the migration.

Restructure the life-cycle methods for the walletdb.

  • open - no longer calls connect - now emits open event.
  • connect - needs to be called separately - now emits connect event.
  • disconnect - now emits disconnect event
  • close - will try to close client if it's open - now emits close event.

@coveralls
Copy link

coveralls commented Oct 16, 2023

Coverage Status

coverage: 68.555% (-0.1%) from 68.674% when pulling 1f2251e on nodech:wallet-lifecycles into 7bd2078 on handshake-org:master.

@nodech nodech added wallet part of the codebase enhancement general - improving existing feature breaking-major Backwards incompatible - Release version labels Oct 16, 2023
@nodech nodech added this to the hsd 7.0.0 milestone Oct 16, 2023
Copy link
Member

@rithvikvibhu rithvikvibhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested Bob with wallet in plugin and remote modes. Didn't have to change anything since wdb.connect are called by hsd in both opens

@nodech nodech force-pushed the wallet-lifecycles branch from 9b96dad to 1f2251e Compare October 20, 2023 09:53
@nodech nodech merged commit bb7da60 into handshake-org:master Oct 20, 2023
6 checks passed
@nodech nodech deleted the wallet-lifecycles branch October 20, 2023 10:03
@nodech nodech mentioned this pull request Nov 7, 2023
4 tasks
@nodech nodech mentioned this pull request Nov 29, 2024
@nodech nodech mentioned this pull request Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-major Backwards incompatible - Release version enhancement general - improving existing feature wallet part of the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants