Merge bitcoin/bitcoin#23004: multiprocess: add interfaces::ExternalSigner class

a032fa30d2 multiprocess: add interfaces::ExternalSigner class (Russell Yanofsky)

Pull request description:

  Add `interfaces::ExternalSigner` class to let signer objects be passed between processes and let signer code run in the original process where the object was created.

  ---

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10).

ACKs for top commit:
  laanwj:
    Concept and code review ACK a032fa30d2
  hebasto:
    re-ACK a032fa30d2

Tree-SHA512: 99a729fb3a64d010e142cc778a9f1f358e58345b77faaf2664de7d2277715d59df3352326e8f0f2a6628038670eaa4556310a549079fb28af6d2eeb05aea1460
This commit is contained in:
W. J. van der Laan committed 2021-11-15 17:13:23 +01:00
commit 1ba74123f9
5 files changed
+41 -12

No files matched your search

+3 -3
View File
@@ -6,7 +6,7 @@
#include <config/bitcoin-config.h>
#endif
#include <external_signer.h>
#include <interfaces/node.h>
#include <qt/createwalletdialog.h>
#include <qt/forms/ui_createwalletdialog.h>
@@ -113,7 +113,7 @@ CreateWalletDialog::~CreateWalletDialog()
delete ui;
}
void CreateWalletDialog::setSigners(const std::vector<ExternalSigner>& signers)
void CreateWalletDialog::setSigners(const std::vector<std::unique_ptr<interfaces::ExternalSigner>>& signers)
{
m_has_signers = !signers.empty();
if (m_has_signers) {
@@ -126,7 +126,7 @@ void CreateWalletDialog::setSigners(const std::vector<ExternalSigner>& signers)
ui->blank_wallet_checkbox->setChecked(false);
ui->disable_privkeys_checkbox->setEnabled(false);
ui->disable_privkeys_checkbox->setChecked(true);
const std::string label = signers[0].m_name;
const std::string label = signers[0]->getName();
ui->wallet_name_line_edit->setText(QString::fromStdString(label));
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
} else {
+6 -1
View File
@@ -7,7 +7,12 @@
#include <QDialog>
#include <memory>
namespace interfaces {
class ExternalSigner;
} // namespace interfaces
class WalletModel;
namespace Ui {
@@ -24,7 +29,7 @@ public:
explicit CreateWalletDialog(QWidget* parent);
virtual ~CreateWalletDialog();
void setSigners(const std::vector<ExternalSigner>& signers);
void setSigners(const std::vector<std::unique_ptr<interfaces::ExternalSigner>>& signers);
QString walletName() const;
bool isEncryptWalletChecked() const;
+2 -2
View File
@@ -280,9 +280,9 @@ void CreateWalletActivity::create()
{
m_create_wallet_dialog = new CreateWalletDialog(m_parent_widget);
std::vector<ExternalSigner> signers;
std::vector<std::unique_ptr<interfaces::ExternalSigner>> signers;
try {
signers = node().externalSigners();
signers = node().listExternalSigners();
} catch (const std::runtime_error& e) {
QMessageBox::critical(nullptr, tr("Can't list signers"), e.what());
}