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

add wallet rename functionality, and add to qml client #8934

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

accumulator
Copy link
Member

No description provided.

Comment on lines +541 to +554
@with_wallet_lock
def rename_wallet(self, wallet: 'Abstract_Wallet', new_basename):
if not wallet.db.storage:
return

path = wallet.db.storage.path
wallet_key = self._wallet_key_from_path(path)
wallet = self._wallets.get(wallet_key)
assert wallet

new_path = wallet.rename_wallet(new_basename)
new_wallet_key = self._wallet_key_from_path(new_path)
self._wallets.pop(wallet_key)
self._wallets[new_wallet_key] = wallet
Copy link
Member

Choose a reason for hiding this comment

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

As a completely different approach, have you considered unloading the wallet, changing the name of file on disk, and then loading the wallet again? so e.g. daemon._stop_wallet(), os.rename(), daemon.load_wallet()

Disregarding GUI concerns, from a trying-to-avoid-subtle-bugs and keeping things simple point of view, that seems to me like a potentially more interesting approach :P but maybe that has its own complications (?)

Copy link
Member Author

@accumulator accumulator Sep 17, 2024

Choose a reason for hiding this comment

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

I think this has complications. There are many references held to Wallet instances, but very few to WalletStorage instances, making the above approach a bit better manageable.

Unloading+loading on Desktop probably requires to destroy the toplevel window associated with the wallet, which might be problematic when it's the only/last window (app closing?), and visually disturbing.

On Android/QML it would also be quite tricky to get right.

Unloading+loading is quite a complex code path..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants