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

Improved export and restore hot wallet process #1353

Closed

Conversation

singlatushar07
Copy link
Contributor

@singlatushar07 singlatushar07 commented Aug 20, 2021

Fixes #948

Added bitcoincore_watchonly device type and now while exporting
bitcoincore hot wallets, they will exported as watchonly wallets.

@singlatushar07 singlatushar07 changed the title Interim commit Improved export and restore hot wallet process Aug 20, 2021
@singlatushar07 singlatushar07 force-pushed the restore-hot-wallet branch 2 times, most recently from d954d37 to 89c65d6 Compare August 31, 2021 15:38
@@ -117,6 +117,7 @@ def general():
continue
write_wallet(wallet)
app.specter.wallet_manager.update()
time.sleep(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is that needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

During restoration process, after selecting the files I was getting the error that the wallets linked with the hot wallet were not restored because they do not exist. So after seeing logs I concluded that before wallet manager could update all the wallets, following line was being executed and giving the error. So to avoid that this sleep is needed.
wallet_obj = app.specter.wallet_manager.get_by_alias(wallet["alias"])

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a better approach here would be to not use the threading in wallet_manager.update() you could add to that update funtion a parameter like threading=True, then in line 105 of the wallet_manager do:

if self.allow_threading and threading:

Or something like that...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in latest commit

@@ -62,7 +62,7 @@
{% endif %}
{% if device.hot_wallet %}
<button id="{{ device.alias }}_hot_sign_btn" class="btn flex-item" style="width: 190px; margin: 15px auto;">
{% if device.device_type == "bitcoincore" %}
{% if device.device_type == "bitcoincore" or device.device_type == "bitcoincore_watchonly" %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm this probably should be treated differently as a watch only can't sign

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, maybe i think we should not render the button for signing the transaction in this case.

name = "Bitcoin Core (watch only)"
icon = "bitcoincore_icon.svg"

hot_wallet = True
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary since it inherits BitcoinCore which has it already

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in latest commit

Added bitcoincore_watchonly device type and now while exporting
bitcoincore hot wallets, they will exported as watchonly wallets.
@singlatushar07 singlatushar07 marked this pull request as ready for review September 1, 2021 14:39
@k9ert k9ert requested a review from kdmukai September 2, 2021 09:40
@k9ert
Copy link
Contributor

k9ert commented Sep 2, 2021

Can we have a bit more verbose documentation on this feature? Comments in the code are very rare. Maybe you can do one or more of these things:

  • get a python-class documentation for BitcoinCoreWatchOnly-class
  • For the creating backup procedure, there is a blue (i) icon which has a documentation to show if you hover. Can we put a sentence or two in there?
  • Can we get an explanation how you can transform a BitcoinCoreWatchOnly wallet to a normal Hotwallet again? The button-description seem to make that possible but i struggle to understand Or is that even possible? I guess it's not, so that would be a recreation-process?
  • Added kdmukai to the reviewers due to: Data Backup does not restore Bitcoin Core hot wallet. #948 (comment)
  • Also for some reason this doesn't seem to work for me. It behaved like it wasn't fixed: The wallet was there, transactions were shown but when i tried to sign a PSBT (which shouldn't be possible) i get a Failed to sign PSBT: Request error: Requested wallet does not exist or is not loaded (tried with a regtest)

@k9ert
Copy link
Contributor

k9ert commented Nov 29, 2021

Closing this in favor of #1495 where i can commit.

@k9ert k9ert closed this Nov 29, 2021
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.

Data Backup does not restore Bitcoin Core hot wallet.
3 participants