-
Notifications
You must be signed in to change notification settings - Fork 3.2k
gui: Add option to show warnings on wallet close, add warning for swaps #9715
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
base: master
Are you sure you want to change the base?
Conversation
On Android this is not really a good option. There's no guarantee the app goes through a confirm-close sequence, as the app can be destroyed at any time by the OS. The current confirm-close is there, and it will save the wallet file, but one can easily close the app through other means. Ideally the app should run an android background service to monitor chain and lightning events, so the UI can pop in and out of existence, but that would require a big overhaul.. |
ab8fa9e
to
0c8a786
Compare
f441e7a
to
4f5fca3
Compare
it would be nice if we could avoid adding a new persisted dict. |
907f230
to
d931825
Compare
I changed it to a more elegant solution which registers a callback that on wallet close will check if there are swaps with unconfirmed funding transaction. This way there is clear separation between swap and gui code and no persisted dict is required. |
@@ -1279,6 +1279,15 @@ def get_group_id_for_payment_hash(self, payment_hash): | |||
if swap: | |||
return swap.spending_txid if swap.is_reverse else swap.funding_txid | |||
|
|||
def has_pending_swaps(self) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better to return a list of pending swaps, then the GUI can adapt its message depending on the direction of the swap(s)
Allows to register a potential warning shown when the user tries to close the wallet GUI.
A
callback: Callable[[], Optional[str]]
can be registered usingAbstract_Wallet.register_closing_warning_callback(callback)
.On QT wallet close the callbacks will get called, if the callback returns a

str
it is presented to the user like this (str is the bottom message):TODO: implement for QML if this gets merged