Merge bitcoin/bitcoin#21935: Enable external signer support by default, reduce #ifdef
2f5bdcbc31gui: misc external signer fixes and translation hints (Sjors Provoost)d672404466refactor: make ExternalSigner NetworkArg() and m_chain private (Sjors Provoost)4455145e26refactor: reduce #ifdef ENABLE_EXTERNAL_SIGNER usage (Sjors Provoost)5be90c907ebuild: enable external signer by default (Sjors Provoost)7d9453041brefactor: clean up external_signer.h includes (Sjors Provoost)fc0eca31b3fuzz: fix fuzz binary linking order (Sjors Provoost) Pull request description: This follows the introduction of GUI support in https://github.com/bitcoin-core/gui/pull/4 I don't think we should expect GUI users to self compile. This also enables external signer support by default for RPC users. In addition this PR reduces the number of `#ifdef ENABLE_EXTERNAL_SIGNER`, which also fixes #21919. When compiled with `--disable-external-signer` such wallets can't be created in RPC or GUI, but they can be loaded. Attempting any action that calls HWI will trigger an error. Side-note: this PR may or may not (currently) break CI for the GUI repository, as explained here: https://github.com/bitcoin-core/gui/pull/4#issuecomment-769859001 ACKs for top commit: achow101: ACK2f5bdcbc31hebasto: re-ACK2f5bdcbc31Tree-SHA512: 1b71c5a8bea2be077ee9fa33a01130c957a0cf90951d4b7b04d3d0ef826bb77e474c3963abddfef2e2c1ea99d9c72cd2302d1eb9b5fcb7ba0bd2a625f006aa05
This commit is contained in:
30 files changed
+57
-76
No files matched your search
@@ -25,4 +25,4 @@ export RUN_FUNCTIONAL_TESTS=false
|
|||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
# -Wno-psabi is to disable ABI warnings: "note: parameter passing for argument of type ... changed in GCC 7.1"
|
# -Wno-psabi is to disable ABI warnings: "note: parameter passing for argument of type ... changed in GCC 7.1"
|
||||||
# This could be removed once the ABI change warning does not show up by default
|
# This could be removed once the ABI change warning does not show up by default
|
||||||
export BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports CXXFLAGS=-Wno-psabi --enable-external-signer"
|
export BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports CXXFLAGS=-Wno-psabi"
|
||||||
@@ -11,6 +11,6 @@ export CONTAINER_NAME=ci_i686_centos_8
|
|||||||
export DOCKER_NAME_TAG=centos:8
|
export DOCKER_NAME_TAG=centos:8
|
||||||
export DOCKER_PACKAGES="gcc-c++ glibc-devel.x86_64 libstdc++-devel.x86_64 glibc-devel.i686 libstdc++-devel.i686 ccache libtool make git python3 python3-zmq which patch lbzip2 dash rsync coreutils bison"
|
export DOCKER_PACKAGES="gcc-c++ glibc-devel.x86_64 libstdc++-devel.x86_64 glibc-devel.i686 libstdc++-devel.i686 ccache libtool make git python3 python3-zmq which patch lbzip2 dash rsync coreutils bison"
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-reduce-exports --enable-external-signer"
|
export BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-reduce-exports"
|
||||||
export CONFIG_SHELL="/bin/dash"
|
export CONFIG_SHELL="/bin/dash"
|
||||||
export TEST_RUNNER_ENV="LC_ALL=en_US.UTF-8"
|
export TEST_RUNNER_ENV="LC_ALL=en_US.UTF-8"
|
||||||
@@ -15,4 +15,4 @@ export XCODE_BUILD_ID=12A7403
|
|||||||
export RUN_UNIT_TESTS=false
|
export RUN_UNIT_TESTS=false
|
||||||
export RUN_FUNCTIONAL_TESTS=false
|
export RUN_FUNCTIONAL_TESTS=false
|
||||||
export GOAL="deploy"
|
export GOAL="deploy"
|
||||||
export BITCOIN_CONFIG="--with-gui --enable-reduce-exports --enable-external-signer"
|
export BITCOIN_CONFIG="--with-gui --enable-reduce-exports"
|
||||||
@@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8
|
|||||||
export HOST=x86_64-apple-darwin18
|
export HOST=x86_64-apple-darwin18
|
||||||
export PIP_PACKAGES="zmq lief"
|
export PIP_PACKAGES="zmq lief"
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export BITCOIN_CONFIG="--with-gui --enable-reduce-exports --enable-external-signer"
|
export BITCOIN_CONFIG="--with-gui --enable-reduce-exports"
|
||||||
export CI_OS_NAME="macos"
|
export CI_OS_NAME="macos"
|
||||||
export NO_DEPENDS=1
|
export NO_DEPENDS=1
|
||||||
export OSX_SDK=""
|
export OSX_SDK=""
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ export PACKAGES="clang llvm python3-zmq qtbase5-dev qttools5-dev-tools libevent-
|
|||||||
export DOCKER_NAME_TAG=ubuntu:hirsute
|
export DOCKER_NAME_TAG=ubuntu:hirsute
|
||||||
export NO_DEPENDS=1
|
export NO_DEPENDS=1
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' --with-sanitizers=address,integer,undefined CC=clang CXX=clang++ --enable-external-signer"
|
export BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' --with-sanitizers=address,integer,undefined CC=clang CXX=clang++"
|
||||||
@@ -14,5 +14,5 @@ export RUN_UNIT_TESTS=false
|
|||||||
export RUN_FUNCTIONAL_TESTS=false
|
export RUN_FUNCTIONAL_TESTS=false
|
||||||
export RUN_FUZZ_TESTS=true
|
export RUN_FUZZ_TESTS=true
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,address,undefined,integer CC=clang CXX=clang++ --enable-external-signer"
|
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,address,undefined,integer CC=clang CXX=clang++"
|
||||||
export CCACHE_SIZE=200M
|
export CCACHE_SIZE=200M
|
||||||
@@ -11,7 +11,7 @@ export DOCKER_NAME_TAG=ubuntu:20.04
|
|||||||
export PACKAGES="cmake python3 python3-pip llvm clang"
|
export PACKAGES="cmake python3 python3-pip llvm clang"
|
||||||
export DEP_OPTS="DEBUG=1 MULTIPROCESS=1"
|
export DEP_OPTS="DEBUG=1 MULTIPROCESS=1"
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export BITCOIN_CONFIG="--enable-external-signer --enable-debug CC=clang CXX=clang++" # Use clang to avoid OOM
|
export BITCOIN_CONFIG="--enable-debug CC=clang CXX=clang++" # Use clang to avoid OOM
|
||||||
export TEST_RUNNER_ENV="BITCOIND=bitcoin-node"
|
export TEST_RUNNER_ENV="BITCOIND=bitcoin-node"
|
||||||
export RUN_SECURITY_TESTS="true"
|
export RUN_SECURITY_TESTS="true"
|
||||||
export PIP_PACKAGES="lief"
|
export PIP_PACKAGES="lief"
|
||||||
@@ -11,4 +11,4 @@ export DOCKER_NAME_TAG=ubuntu:18.04 # Use bionic to have one config run the tes
|
|||||||
export PACKAGES="python3-zmq clang-5.0 llvm-5.0" # Use clang-5 to test C++17 compatibility, see doc/dependencies.md
|
export PACKAGES="python3-zmq clang-5.0 llvm-5.0" # Use clang-5 to test C++17 compatibility, see doc/dependencies.md
|
||||||
export DEP_OPTS="NO_WALLET=1"
|
export DEP_OPTS="NO_WALLET=1"
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports CC=clang-5.0 CXX=clang++-5.0 --enable-external-signer"
|
export BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports CC=clang-5.0 CXX=clang++-5.0"
|
||||||
@@ -16,4 +16,4 @@ export RUN_UNIT_TESTS="false"
|
|||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export PREVIOUS_RELEASES_TO_DOWNLOAD="v0.15.2 v0.16.3 v0.17.2 v0.18.1 v0.19.1"
|
export PREVIOUS_RELEASES_TO_DOWNLOAD="v0.15.2 v0.16.3 v0.17.2 v0.18.1 v0.19.1"
|
||||||
export BITCOIN_CONFIG="--enable-zmq --with-libs=no --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports
|
export BITCOIN_CONFIG="--enable-zmq --with-libs=no --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports
|
||||||
--enable-debug --disable-fuzz-binary CFLAGS=\"-g0 -O2 -funsigned-char\" CXXFLAGS=\"-g0 -O2 -funsigned-char\" --enable-external-signer"
|
--enable-debug --disable-fuzz-binary CFLAGS=\"-g0 -O2 -funsigned-char\" CXXFLAGS=\"-g0 -O2 -funsigned-char\""
|
||||||
@@ -11,4 +11,4 @@ export DOCKER_NAME_TAG=ubuntu:hirsute
|
|||||||
export PACKAGES="clang llvm libc++abi-dev libc++-dev python3-zmq"
|
export PACKAGES="clang llvm libc++abi-dev libc++-dev python3-zmq"
|
||||||
export DEP_OPTS="CC=clang CXX='clang++ -stdlib=libc++'"
|
export DEP_OPTS="CC=clang CXX='clang++ -stdlib=libc++'"
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export BITCOIN_CONFIG="--enable-zmq --with-gui=no CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' CXXFLAGS='-g' --with-sanitizers=thread CC=clang CXX='clang++ -stdlib=libc++' --enable-external-signer"
|
export BITCOIN_CONFIG="--enable-zmq --with-gui=no CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' CXXFLAGS='-g' --with-sanitizers=thread CC=clang CXX='clang++ -stdlib=libc++'"
|
||||||
@@ -23,4 +23,4 @@ export RUN_UNIT_TESTS=true
|
|||||||
export TEST_RUNNER_ENV="LC_ALL=C"
|
export TEST_RUNNER_ENV="LC_ALL=C"
|
||||||
export RUN_FUNCTIONAL_TESTS=true
|
export RUN_FUNCTIONAL_TESTS=true
|
||||||
export GOAL="install"
|
export GOAL="install"
|
||||||
export BITCOIN_CONFIG="--enable-reduce-exports --with-incompatible-bdb --enable-external-signer"
|
export BITCOIN_CONFIG="--enable-reduce-exports --with-incompatible-bdb"
|
||||||
+2
-2
@@ -333,9 +333,9 @@ AC_ARG_ENABLE([werror],
|
|||||||
[enable_werror=no])
|
[enable_werror=no])
|
||||||
|
|
||||||
AC_ARG_ENABLE([external-signer],
|
AC_ARG_ENABLE([external-signer],
|
||||||
[AS_HELP_STRING([--enable-external-signer],[compile external signer support (default is no, requires Boost::Process)])],
|
[AS_HELP_STRING([--enable-external-signer],[compile external signer support (default is yes, requires Boost::Process)])],
|
||||||
[use_external_signer=$enableval],
|
[use_external_signer=$enableval],
|
||||||
[use_external_signer=no])
|
[use_external_signer=yes])
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
AC_LANG_PUSH([C++])
|
||||||
|
|
||||||
|
|||||||
@@ -35,11 +35,12 @@ BITCOIN_TEST_SUITE = \
|
|||||||
$(TEST_UTIL_H)
|
$(TEST_UTIL_H)
|
||||||
|
|
||||||
FUZZ_SUITE_LD_COMMON = \
|
FUZZ_SUITE_LD_COMMON = \
|
||||||
$(LIBBITCOIN_SERVER) \
|
|
||||||
$(LIBBITCOIN_COMMON) \
|
|
||||||
$(LIBBITCOIN_UTIL) \
|
|
||||||
$(LIBTEST_UTIL) \
|
$(LIBTEST_UTIL) \
|
||||||
$(LIBTEST_FUZZ) \
|
$(LIBTEST_FUZZ) \
|
||||||
|
$(LIBBITCOIN_SERVER) \
|
||||||
|
$(LIBBITCOIN_WALLET) \
|
||||||
|
$(LIBBITCOIN_COMMON) \
|
||||||
|
$(LIBBITCOIN_UTIL) \
|
||||||
$(LIBBITCOIN_CONSENSUS) \
|
$(LIBBITCOIN_CONSENSUS) \
|
||||||
$(LIBBITCOIN_CRYPTO) \
|
$(LIBBITCOIN_CRYPTO) \
|
||||||
$(LIBBITCOIN_CLI) \
|
$(LIBBITCOIN_CLI) \
|
||||||
@@ -160,7 +161,6 @@ BITCOIN_TESTS += \
|
|||||||
wallet/test/scriptpubkeyman_tests.cpp
|
wallet/test/scriptpubkeyman_tests.cpp
|
||||||
|
|
||||||
FUZZ_SUITE_LD_COMMON +=\
|
FUZZ_SUITE_LD_COMMON +=\
|
||||||
$(LIBBITCOIN_WALLET) \
|
|
||||||
$(SQLITE_LIBS) \
|
$(SQLITE_LIBS) \
|
||||||
$(BDB_LIBS)
|
$(BDB_LIBS)
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
ExternalSigner::ExternalSigner(const std::string& command, const std::string chain, const std::string& fingerprint, const std::string name): m_command(command), m_chain(chain), m_fingerprint(fingerprint), m_name(name) {}
|
||||||
|
|
||||||
ExternalSigner::ExternalSigner(const std::string& command, const std::string& fingerprint, const std::string chain, const std::string name): m_command(command), m_fingerprint(fingerprint), m_chain(chain), m_name(name) {}
|
|
||||||
|
|
||||||
const std::string ExternalSigner::NetworkArg() const
|
const std::string ExternalSigner::NetworkArg() const
|
||||||
{
|
{
|
||||||
@@ -55,7 +53,7 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
|
|||||||
if (model_field.isStr() && model_field.getValStr() != "") {
|
if (model_field.isStr() && model_field.getValStr() != "") {
|
||||||
name += model_field.getValStr();
|
name += model_field.getValStr();
|
||||||
}
|
}
|
||||||
signers.push_back(ExternalSigner(command, fingerprintStr, chain, name));
|
signers.push_back(ExternalSigner(command, chain, fingerprintStr, name));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -116,5 +114,3 @@ bool ExternalSigner::SignTransaction(PartiallySignedTransaction& psbtx, std::str
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ENABLE_EXTERNAL_SIGNER
|
|
||||||
+6
-10
@@ -11,8 +11,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
|
|
||||||
struct PartiallySignedTransaction;
|
struct PartiallySignedTransaction;
|
||||||
|
|
||||||
//! Enables interaction with an external signing device or service, such as
|
//! Enables interaction with an external signing device or service, such as
|
||||||
@@ -23,24 +21,24 @@ private:
|
|||||||
//! The command which handles interaction with the external signer.
|
//! The command which handles interaction with the external signer.
|
||||||
std::string m_command;
|
std::string m_command;
|
||||||
|
|
||||||
|
//! Bitcoin mainnet, testnet, etc
|
||||||
|
std::string m_chain;
|
||||||
|
|
||||||
|
const std::string NetworkArg() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! @param[in] command the command which handles interaction with the external signer
|
//! @param[in] command the command which handles interaction with the external signer
|
||||||
//! @param[in] fingerprint master key fingerprint of the signer
|
//! @param[in] fingerprint master key fingerprint of the signer
|
||||||
//! @param[in] chain "main", "test", "regtest" or "signet"
|
//! @param[in] chain "main", "test", "regtest" or "signet"
|
||||||
//! @param[in] name device name
|
//! @param[in] name device name
|
||||||
ExternalSigner(const std::string& command, const std::string& fingerprint, const std::string chain, const std::string name);
|
ExternalSigner(const std::string& command, const std::string chain, const std::string& fingerprint, const std::string name);
|
||||||
|
|
||||||
//! Master key fingerprint of the signer
|
//! Master key fingerprint of the signer
|
||||||
std::string m_fingerprint;
|
std::string m_fingerprint;
|
||||||
|
|
||||||
//! Bitcoin mainnet, testnet, etc
|
|
||||||
std::string m_chain;
|
|
||||||
|
|
||||||
//! Name of signer
|
//! Name of signer
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
|
|
||||||
const std::string NetworkArg() const;
|
|
||||||
|
|
||||||
//! Obtain a list of signers. Calls `<command> enumerate`.
|
//! Obtain a list of signers. Calls `<command> enumerate`.
|
||||||
//! @param[in] command the command which handles interaction with the external signer
|
//! @param[in] command the command which handles interaction with the external signer
|
||||||
//! @param[in,out] signers vector to which new signers (with a unique master key fingerprint) are added
|
//! @param[in,out] signers vector to which new signers (with a unique master key fingerprint) are added
|
||||||
@@ -65,6 +63,4 @@ public:
|
|||||||
bool SignTransaction(PartiallySignedTransaction& psbt, std::string& error);
|
bool SignTransaction(PartiallySignedTransaction& psbt, std::string& error);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_EXTERNAL_SIGNER
|
|
||||||
|
|
||||||
#endif // BITCOIN_EXTERNAL_SIGNER_H
|
#endif // BITCOIN_EXTERNAL_SIGNER_H
|
||||||
@@ -111,10 +111,8 @@ public:
|
|||||||
//! Disconnect node by id.
|
//! Disconnect node by id.
|
||||||
virtual bool disconnectById(NodeId id) = 0;
|
virtual bool disconnectById(NodeId id) = 0;
|
||||||
|
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
//! List external signers
|
//! List external signers
|
||||||
virtual std::vector<ExternalSigner> externalSigners() = 0;
|
virtual std::vector<ExternalSigner> externalSigners() = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
//! Get total bytes recv.
|
//! Get total bytes recv.
|
||||||
virtual int64_t getTotalBytesRecv() = 0;
|
virtual int64_t getTotalBytesRecv() = 0;
|
||||||
|
|||||||
+11
-2
@@ -6,6 +6,7 @@
|
|||||||
#include <banman.h>
|
#include <banman.h>
|
||||||
#include <chain.h>
|
#include <chain.h>
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
|
#include <external_signer.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <interfaces/chain.h>
|
#include <interfaces/chain.h>
|
||||||
#include <interfaces/handler.h>
|
#include <interfaces/handler.h>
|
||||||
@@ -170,16 +171,24 @@ public:
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
std::vector<ExternalSigner> externalSigners() override
|
std::vector<ExternalSigner> externalSigners() override
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_EXTERNAL_SIGNER
|
||||||
std::vector<ExternalSigner> signers = {};
|
std::vector<ExternalSigner> signers = {};
|
||||||
const std::string command = gArgs.GetArg("-signer", "");
|
const std::string command = gArgs.GetArg("-signer", "");
|
||||||
if (command == "") return signers;
|
if (command == "") return signers;
|
||||||
ExternalSigner::Enumerate(command, signers, Params().NetworkIDString());
|
ExternalSigner::Enumerate(command, signers, Params().NetworkIDString());
|
||||||
return signers;
|
return signers;
|
||||||
|
#else
|
||||||
|
// This result is undistinguisable from a succesful call that returns
|
||||||
|
// no signers. For the current GUI this doesn't matter, because the wallet
|
||||||
|
// creation dialog disables the external signer checkbox in both
|
||||||
|
// cases. The return type could be changed to std::optional<std::vector>
|
||||||
|
// (or something that also includes error messages) if this distinction
|
||||||
|
// becomes important.
|
||||||
|
return {};
|
||||||
|
#endif // ENABLE_EXTERNAL_SIGNER
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
int64_t getTotalBytesRecv() override { return m_context->connman ? m_context->connman->GetTotalBytesRecv() : 0; }
|
int64_t getTotalBytesRecv() override { return m_context->connman ? m_context->connman->GetTotalBytesRecv() : 0; }
|
||||||
int64_t getTotalBytesSent() override { return m_context->connman ? m_context->connman->GetTotalBytesSent() : 0; }
|
int64_t getTotalBytesSent() override { return m_context->connman ? m_context->connman->GetTotalBytesSent() : 0; }
|
||||||
size_t getMempoolSize() override { return m_context->mempool ? m_context->mempool->size() : 0; }
|
size_t getMempoolSize() override { return m_context->mempool ? m_context->mempool->size() : 0; }
|
||||||
|
|||||||
@@ -31,8 +31,9 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
|
|||||||
// Disable the disable_privkeys_checkbox and external_signer_checkbox when isEncryptWalletChecked is
|
// Disable the disable_privkeys_checkbox and external_signer_checkbox when isEncryptWalletChecked is
|
||||||
// set to true, enable it when isEncryptWalletChecked is false.
|
// set to true, enable it when isEncryptWalletChecked is false.
|
||||||
ui->disable_privkeys_checkbox->setEnabled(!checked);
|
ui->disable_privkeys_checkbox->setEnabled(!checked);
|
||||||
|
#ifdef ENABLE_EXTERNAL_SIGNER
|
||||||
ui->external_signer_checkbox->setEnabled(!checked);
|
ui->external_signer_checkbox->setEnabled(!checked);
|
||||||
|
#endif
|
||||||
// When the disable_privkeys_checkbox is disabled, uncheck it.
|
// When the disable_privkeys_checkbox is disabled, uncheck it.
|
||||||
if (!ui->disable_privkeys_checkbox->isEnabled()) {
|
if (!ui->disable_privkeys_checkbox->isEnabled()) {
|
||||||
ui->disable_privkeys_checkbox->setChecked(false);
|
ui->disable_privkeys_checkbox->setChecked(false);
|
||||||
@@ -112,8 +113,7 @@ CreateWalletDialog::~CreateWalletDialog()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
void CreateWalletDialog::setSigners(const std::vector<ExternalSigner>& signers)
|
||||||
void CreateWalletDialog::setSigners(std::vector<ExternalSigner>& signers)
|
|
||||||
{
|
{
|
||||||
if (!signers.empty()) {
|
if (!signers.empty()) {
|
||||||
ui->external_signer_checkbox->setEnabled(true);
|
ui->external_signer_checkbox->setEnabled(true);
|
||||||
@@ -132,7 +132,6 @@ void CreateWalletDialog::setSigners(std::vector<ExternalSigner>& signers)
|
|||||||
ui->external_signer_checkbox->setEnabled(false);
|
ui->external_signer_checkbox->setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
QString CreateWalletDialog::walletName() const
|
QString CreateWalletDialog::walletName() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,11 +7,8 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
class WalletModel;
|
|
||||||
|
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
class ExternalSigner;
|
class ExternalSigner;
|
||||||
#endif
|
class WalletModel;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CreateWalletDialog;
|
class CreateWalletDialog;
|
||||||
@@ -27,9 +24,7 @@ public:
|
|||||||
explicit CreateWalletDialog(QWidget* parent);
|
explicit CreateWalletDialog(QWidget* parent);
|
||||||
virtual ~CreateWalletDialog();
|
virtual ~CreateWalletDialog();
|
||||||
|
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
void setSigners(const std::vector<ExternalSigner>& signers);
|
||||||
void setSigners(std::vector<ExternalSigner>& signers);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString walletName() const;
|
QString walletName() const;
|
||||||
bool isEncryptWalletChecked() const;
|
bool isEncryptWalletChecked() const;
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
|
|||||||
ui->thirdPartyTxUrls->setVisible(false);
|
ui->thirdPartyTxUrls->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ENABLE_EXTERNAL_SIGNER
|
||||||
|
//: "External signing" means using devices such as hardware wallets.
|
||||||
|
ui->externalSignerPath->setToolTip(tr("Compiled without external signing support (required for external signing)"));
|
||||||
|
ui->externalSignerPath->setEnabled(false);
|
||||||
|
#endif
|
||||||
/* Display elements init */
|
/* Display elements init */
|
||||||
QDir translations(":translations");
|
QDir translations(":translations");
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void ReceiveRequestDialog::setInfo(const SendCoinsRecipient &_info)
|
|||||||
ui->wallet_content->hide();
|
ui->wallet_content->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->btnVerify->setVisible(this->model->wallet().hasExternalSigner());
|
ui->btnVerify->setVisible(model->wallet().hasExternalSigner());
|
||||||
|
|
||||||
connect(ui->btnVerify, &QPushButton::clicked, [this] {
|
connect(ui->btnVerify, &QPushButton::clicked, [this] {
|
||||||
model->displayAddress(info.address.toStdString());
|
model->displayAddress(info.address.toStdString());
|
||||||
|
|||||||
@@ -200,12 +200,14 @@ void SendCoinsDialog::setModel(WalletModel *_model)
|
|||||||
ui->optInRBF->setCheckState(Qt::Checked);
|
ui->optInRBF->setCheckState(Qt::Checked);
|
||||||
|
|
||||||
if (model->wallet().hasExternalSigner()) {
|
if (model->wallet().hasExternalSigner()) {
|
||||||
|
//: "device" usually means a hardware wallet
|
||||||
ui->sendButton->setText(tr("Sign on device"));
|
ui->sendButton->setText(tr("Sign on device"));
|
||||||
if (gArgs.GetArg("-signer", "") != "") {
|
if (gArgs.GetArg("-signer", "") != "") {
|
||||||
ui->sendButton->setEnabled(true);
|
ui->sendButton->setEnabled(true);
|
||||||
ui->sendButton->setToolTip(tr("Connect your hardware wallet first."));
|
ui->sendButton->setToolTip(tr("Connect your hardware wallet first."));
|
||||||
} else {
|
} else {
|
||||||
ui->sendButton->setEnabled(false);
|
ui->sendButton->setEnabled(false);
|
||||||
|
//: "External signer" means using devices such as hardware wallets.
|
||||||
ui->sendButton->setToolTip(tr("Set external signer script path in Options -> Wallet"));
|
ui->sendButton->setToolTip(tr("Set external signer script path in Options -> Wallet"));
|
||||||
}
|
}
|
||||||
} else if (model->wallet().privateKeysDisabled()) {
|
} else if (model->wallet().privateKeysDisabled()) {
|
||||||
@@ -426,11 +428,13 @@ void SendCoinsDialog::sendButtonClicked([[maybe_unused]] bool checked)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (err == TransactionError::EXTERNAL_SIGNER_NOT_FOUND) {
|
if (err == TransactionError::EXTERNAL_SIGNER_NOT_FOUND) {
|
||||||
|
//: "External signer" means using devices such as hardware wallets.
|
||||||
QMessageBox::critical(nullptr, tr("External signer not found"), "External signer not found");
|
QMessageBox::critical(nullptr, tr("External signer not found"), "External signer not found");
|
||||||
send_failure = true;
|
send_failure = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (err == TransactionError::EXTERNAL_SIGNER_FAILED) {
|
if (err == TransactionError::EXTERNAL_SIGNER_FAILED) {
|
||||||
|
//: "External signer" means using devices such as hardware wallets.
|
||||||
QMessageBox::critical(nullptr, tr("External signer failure"), "External signer failure");
|
QMessageBox::critical(nullptr, tr("External signer failure"), "External signer failure");
|
||||||
send_failure = true;
|
send_failure = true;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <qt/guiutil.h>
|
#include <qt/guiutil.h>
|
||||||
#include <qt/walletmodel.h>
|
#include <qt/walletmodel.h>
|
||||||
|
|
||||||
|
#include <external_signer.h>
|
||||||
#include <interfaces/handler.h>
|
#include <interfaces/handler.h>
|
||||||
#include <interfaces/node.h>
|
#include <interfaces/node.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
@@ -295,7 +296,6 @@ void CreateWalletActivity::create()
|
|||||||
{
|
{
|
||||||
m_create_wallet_dialog = new CreateWalletDialog(m_parent_widget);
|
m_create_wallet_dialog = new CreateWalletDialog(m_parent_widget);
|
||||||
|
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
std::vector<ExternalSigner> signers;
|
std::vector<ExternalSigner> signers;
|
||||||
try {
|
try {
|
||||||
signers = node().externalSigners();
|
signers = node().externalSigners();
|
||||||
@@ -303,7 +303,6 @@ void CreateWalletActivity::create()
|
|||||||
QMessageBox::critical(nullptr, tr("Can't list signers"), e.what());
|
QMessageBox::critical(nullptr, tr("Can't list signers"), e.what());
|
||||||
}
|
}
|
||||||
m_create_wallet_dialog->setSigners(signers);
|
m_create_wallet_dialog->setSigners(signers);
|
||||||
#endif
|
|
||||||
|
|
||||||
m_create_wallet_dialog->setWindowModality(Qt::ApplicationModal);
|
m_create_wallet_dialog->setWindowModality(Qt::ApplicationModal);
|
||||||
m_create_wallet_dialog->show();
|
m_create_wallet_dialog->show();
|
||||||
|
|||||||
+4
-2
@@ -1243,9 +1243,9 @@ void runCommand(const std::string& strCommand)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in)
|
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_EXTERNAL_SIGNER
|
||||||
namespace bp = boost::process;
|
namespace bp = boost::process;
|
||||||
|
|
||||||
UniValue result_json;
|
UniValue result_json;
|
||||||
@@ -1277,8 +1277,10 @@ UniValue RunCommandParseJSON(const std::string& str_command, const std::string&
|
|||||||
if (!result_json.read(result)) throw std::runtime_error("Unable to parse JSON: " + result);
|
if (!result_json.read(result)) throw std::runtime_error("Unable to parse JSON: " + result);
|
||||||
|
|
||||||
return result_json;
|
return result_json;
|
||||||
}
|
#else
|
||||||
|
throw std::runtime_error("Compiled without external signing support (required for external signing).");
|
||||||
#endif // ENABLE_EXTERNAL_SIGNER
|
#endif // ENABLE_EXTERNAL_SIGNER
|
||||||
|
}
|
||||||
|
|
||||||
void SetupEnvironment()
|
void SetupEnvironment()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ std::string ShellEscape(const std::string& arg);
|
|||||||
#if HAVE_SYSTEM
|
#if HAVE_SYSTEM
|
||||||
void runCommand(const std::string& strCommand);
|
void runCommand(const std::string& strCommand);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
/**
|
/**
|
||||||
* Execute a command which returns JSON, and parse the result.
|
* Execute a command which returns JSON, and parse the result.
|
||||||
*
|
*
|
||||||
@@ -111,7 +110,6 @@ void runCommand(const std::string& strCommand);
|
|||||||
* @return parsed JSON
|
* @return parsed JSON
|
||||||
*/
|
*/
|
||||||
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in="");
|
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in="");
|
||||||
#endif // ENABLE_EXTERNAL_SIGNER
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Most paths passed as configuration arguments are treated as relative to
|
* Most paths passed as configuration arguments are treated as relative to
|
||||||
|
|||||||
@@ -13,8 +13,6 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
|
|
||||||
bool ExternalSignerScriptPubKeyMan::SetupDescriptor(std::unique_ptr<Descriptor> desc)
|
bool ExternalSignerScriptPubKeyMan::SetupDescriptor(std::unique_ptr<Descriptor> desc)
|
||||||
{
|
{
|
||||||
LOCK(cs_desc_man);
|
LOCK(cs_desc_man);
|
||||||
@@ -84,5 +82,3 @@ TransactionError ExternalSignerScriptPubKeyMan::FillPSBT(PartiallySignedTransact
|
|||||||
FinalizePSBT(psbt); // This won't work in a multisig setup
|
FinalizePSBT(psbt); // This won't work in a multisig setup
|
||||||
return TransactionError::OK;
|
return TransactionError::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
#ifndef BITCOIN_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H
|
#ifndef BITCOIN_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H
|
||||||
#define BITCOIN_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H
|
#define BITCOIN_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H
|
||||||
|
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
#include <wallet/scriptpubkeyman.h>
|
#include <wallet/scriptpubkeyman.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -31,6 +30,4 @@ class ExternalSignerScriptPubKeyMan : public DescriptorScriptPubKeyMan
|
|||||||
|
|
||||||
TransactionError FillPSBT(PartiallySignedTransaction& psbt, int sighash_type = 1 /* SIGHASH_ALL */, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr) const override;
|
TransactionError FillPSBT(PartiallySignedTransaction& psbt, int sighash_type = 1 /* SIGHASH_ALL */, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr) const override;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // BITCOIN_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H
|
#endif // BITCOIN_WALLET_EXTERNAL_SIGNER_SCRIPTPUBKEYMAN_H
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
#include <util/time.h>
|
#include <util/time.h>
|
||||||
#include <util/translation.h>
|
#include <util/translation.h>
|
||||||
#include <external_signer.h>
|
|
||||||
#include <wallet/scriptpubkeyman.h>
|
#include <wallet/scriptpubkeyman.h>
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|||||||
+1
-12
@@ -8,6 +8,7 @@
|
|||||||
#include <chain.h>
|
#include <chain.h>
|
||||||
#include <consensus/consensus.h>
|
#include <consensus/consensus.h>
|
||||||
#include <consensus/validation.h>
|
#include <consensus/validation.h>
|
||||||
|
#include <external_signer.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
#include <interfaces/chain.h>
|
#include <interfaces/chain.h>
|
||||||
#include <interfaces/wallet.h>
|
#include <interfaces/wallet.h>
|
||||||
@@ -2215,7 +2216,6 @@ void ReserveDestination::ReturnDestination()
|
|||||||
|
|
||||||
bool CWallet::DisplayAddress(const CTxDestination& dest)
|
bool CWallet::DisplayAddress(const CTxDestination& dest)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
CScript scriptPubKey = GetScriptForDestination(dest);
|
CScript scriptPubKey = GetScriptForDestination(dest);
|
||||||
const auto spk_man = GetScriptPubKeyMan(scriptPubKey);
|
const auto spk_man = GetScriptPubKeyMan(scriptPubKey);
|
||||||
if (spk_man == nullptr) {
|
if (spk_man == nullptr) {
|
||||||
@@ -2227,9 +2227,6 @@ bool CWallet::DisplayAddress(const CTxDestination& dest)
|
|||||||
}
|
}
|
||||||
ExternalSigner signer = ExternalSignerScriptPubKeyMan::GetExternalSigner();
|
ExternalSigner signer = ExternalSignerScriptPubKeyMan::GetExternalSigner();
|
||||||
return signer_spk_man->DisplayAddress(scriptPubKey, signer);
|
return signer_spk_man->DisplayAddress(scriptPubKey, signer);
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallet::LockCoin(const COutPoint& output)
|
void CWallet::LockCoin(const COutPoint& output)
|
||||||
@@ -3063,12 +3060,8 @@ void CWallet::ConnectScriptPubKeyManNotifiers()
|
|||||||
void CWallet::LoadDescriptorScriptPubKeyMan(uint256 id, WalletDescriptor& desc)
|
void CWallet::LoadDescriptorScriptPubKeyMan(uint256 id, WalletDescriptor& desc)
|
||||||
{
|
{
|
||||||
if (IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER)) {
|
if (IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER)) {
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
auto spk_manager = std::unique_ptr<ScriptPubKeyMan>(new ExternalSignerScriptPubKeyMan(*this, desc));
|
auto spk_manager = std::unique_ptr<ScriptPubKeyMan>(new ExternalSignerScriptPubKeyMan(*this, desc));
|
||||||
m_spk_managers[id] = std::move(spk_manager);
|
m_spk_managers[id] = std::move(spk_manager);
|
||||||
#else
|
|
||||||
throw std::runtime_error(std::string(__func__) + ": Compiled without external signing support (required for external signing)");
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
auto spk_manager = std::unique_ptr<ScriptPubKeyMan>(new DescriptorScriptPubKeyMan(*this, desc));
|
auto spk_manager = std::unique_ptr<ScriptPubKeyMan>(new DescriptorScriptPubKeyMan(*this, desc));
|
||||||
m_spk_managers[id] = std::move(spk_manager);
|
m_spk_managers[id] = std::move(spk_manager);
|
||||||
@@ -3108,7 +3101,6 @@ void CWallet::SetupDescriptorScriptPubKeyMans()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
|
||||||
ExternalSigner signer = ExternalSignerScriptPubKeyMan::GetExternalSigner();
|
ExternalSigner signer = ExternalSignerScriptPubKeyMan::GetExternalSigner();
|
||||||
|
|
||||||
// TODO: add account parameter
|
// TODO: add account parameter
|
||||||
@@ -3135,9 +3127,6 @@ void CWallet::SetupDescriptorScriptPubKeyMans()
|
|||||||
AddActiveScriptPubKeyMan(id, t, internal);
|
AddActiveScriptPubKeyMan(id, t, internal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
throw std::runtime_error(std::string(__func__) + ": Compiled without external signing support (required for external signing)");
|
|
||||||
#endif // ENABLE_EXTERNAL_SIGNER
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#include <validationinterface.h>
|
#include <validationinterface.h>
|
||||||
#include <wallet/coinselection.h>
|
#include <wallet/coinselection.h>
|
||||||
#include <wallet/crypter.h>
|
#include <wallet/crypter.h>
|
||||||
#include <external_signer.h>
|
|
||||||
#include <wallet/receive.h>
|
#include <wallet/receive.h>
|
||||||
#include <wallet/scriptpubkeyman.h>
|
#include <wallet/scriptpubkeyman.h>
|
||||||
#include <wallet/spend.h>
|
#include <wallet/spend.h>
|
||||||
|
|||||||
Reference in new issue
Block a user