-
Notifications
You must be signed in to change notification settings - Fork 326
Fix "Load PSBT" functionality when no wallet loaded #399
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
Conversation
|
Concept ACK. |
achow101
left a comment
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.
Concept ACK
a77d04f to
cb7b222
Compare
|
PR Updated from a77d04f -> cb7b222. Click here to check diff. Addressed changes suggested by @achow101 in #399 (review). |
hebasto
left a comment
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.
Approach ACK cb7b222.
After moving PSBT dialog code from walletview.cpp into waletframe.cpp, some includes could be removed:
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -8,7 +8,6 @@
#include <qt/askpassphrasedialog.h>
#include <qt/clientmodel.h>
#include <qt/guiutil.h>
-#include <qt/psbtoperationsdialog.h>
#include <qt/optionsmodel.h>
#include <qt/overviewpage.h>
#include <qt/platformstyle.h>
@@ -21,13 +20,10 @@
#include <interfaces/node.h>
#include <node/ui_interface.h>
-#include <psbt.h>
#include <util/strencodings.h>
#include <QAction>
#include <QActionGroup>
-#include <QApplication>
-#include <QClipboard>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QProgressDialog>| Q_EMIT message(tr("Error"), tr("Unable to decode PSBT") + "\n" + QString::fromStdString(error), CClientUIInterface::MSG_ERROR); | ||
| return; | ||
| } | ||
| PSBTOperationsDialog* dlg = new PSBTOperationsDialog(this, currentWalletModel(), clientModel); |
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.
nit: Add an empty line above as it was in walletview.cpp for readability and easier verifying with diff --color-moved=dimmed-zebra?
| if (walletView) { | ||
| walletView->gotoLoadPSBT(from_clipboard); | ||
| std::string data; | ||
| if (from_clipboard) { |
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.
nit: Add an empty line above as it was in walletview.cpp for readability and easier verifying with diff --color-moved=dimmed-zebra?
src/qt/walletframe.cpp
Outdated
| QString filename = GUIUtil::getOpenFileName(this, | ||
| tr("Load Transaction Data"), QString(), | ||
| tr("Partially Signed Transaction (*.psbt)"), nullptr); |
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.
I understand these indentations were suggested by clang-format-diff.py, but to keep verifying easy with diff --color-moved=dimmed-zebra, I'd suggest to keep the same indentations as they were in walletview.cpp.
cb7b222 to
e5e0091
Compare
|
PR Updated from cb7b222 -> e5e0091. Click here to check diff. Addressed changes suggested by @hebasto in #399 (review) |
|
ACK e5e0091 |
hebasto
left a comment
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.
Tested e5e0091.
I think the PSBTOperationsDialog::showTransactionStatus should be modified to correctly handle unsigned PSBTs:
--- a/src/qt/psbtoperationsdialog.cpp
+++ b/src/qt/psbtoperationsdialog.cpp
@@ -254,7 +254,10 @@ void PSBTOperationsDialog::showTransactionStatus(const PartiallySignedTransactio
case PSBTRole::SIGNER: {
QString need_sig_text = tr("Transaction still needs signature(s).");
StatusLevel level = StatusLevel::INFO;
- if (m_wallet_model->wallet().privateKeysDisabled()) {
+ if (!m_wallet_model) {
+ need_sig_text += " " + tr("(But no wallet is loaded.)");
+ level = StatusLevel::WARN;
+ } else if (m_wallet_model->wallet().privateKeysDisabled()) {
need_sig_text += " " + tr("(But this wallet cannot sign transactions.)");
level = StatusLevel::WARN;
} else if (n_could_sign < 1) {e5e0091 to
0237d95
Compare
|
PR Updated from e5e0091 -> 0237d95. Click here to check diff. Addressed changes suggested by @hebasto in #399 (review) |
hebasto
left a comment
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.
ACK 0237d95, tested on Linux Mint 20.2 (Qt 5.12.8).
No wallet is loaded when testing: bitcoin-qt -nowallet.
A. The loading of an unsigned PSBT being prepared with the walletcreatefundedpsbt RPC command:
B. The loading of a signed PSBT which is the PSBT mentioned above being processed with the walletprocesspsbt RPC command:
|
re-ACK 0237d95 |
|
A big thanks to all the contributors who took out time to test and review my PR. |


This PR provides a fix to the issue mentioned in #232.
Currently, the Load PSBT functionality works well in case a wallet is loaded but does nothing when a wallet isn't loaded.
If a function cannot work without a wallet being loaded, it is disabled by default (It is unclickable as shown in the image).
For e.g. One cannot
Close WalletorBackup WalletorSign Messageswithout a wallet being loaded. And hence they are disabled. But if you notice,Load PSBToptions are not disabled by default even when a wallet isn't loaded.As mentioned by hebasto in the issue description :
This means Load PSBT should be working just as similar whether wallets are being loaded or not.
After making the required changes to the code, The Load PSBT works as expected even with no wallet loaded and the PSBT is finalized.
Close #232