mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge bitcoin/bitcoin#23004: multiprocess: add interfaces::ExternalSigner class
a032fa30d2multiprocess: 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 ACKa032fa30d2hebasto: re-ACKa032fa30d2Tree-SHA512: 99a729fb3a64d010e142cc778a9f1f358e58345b77faaf2664de7d2277715d59df3352326e8f0f2a6628038670eaa4556310a549079fb28af6d2eeb05aea1460
This commit is contained in:
@@ -67,6 +67,17 @@ using interfaces::WalletClient;
|
||||
|
||||
namespace node {
|
||||
namespace {
|
||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
||||
class ExternalSignerImpl : public interfaces::ExternalSigner
|
||||
{
|
||||
public:
|
||||
ExternalSignerImpl(::ExternalSigner signer) : m_signer(std::move(signer)) {}
|
||||
std::string getName() override { return m_signer.m_name; }
|
||||
private:
|
||||
::ExternalSigner m_signer;
|
||||
};
|
||||
#endif
|
||||
|
||||
class NodeImpl : public Node
|
||||
{
|
||||
private:
|
||||
@@ -172,14 +183,18 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
std::vector<ExternalSigner> externalSigners() override
|
||||
std::vector<std::unique_ptr<interfaces::ExternalSigner>> listExternalSigners() override
|
||||
{
|
||||
#ifdef ENABLE_EXTERNAL_SIGNER
|
||||
std::vector<ExternalSigner> signers = {};
|
||||
const std::string command = gArgs.GetArg("-signer", "");
|
||||
if (command == "") return signers;
|
||||
if (command == "") return {};
|
||||
ExternalSigner::Enumerate(command, signers, Params().NetworkIDString());
|
||||
return signers;
|
||||
std::vector<std::unique_ptr<interfaces::ExternalSigner>> result;
|
||||
for (auto& signer : signers) {
|
||||
result.emplace_back(std::make_unique<ExternalSignerImpl>(std::move(signer)));
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
// This result is indistinguishable from a successful call that returns
|
||||
// no signers. For the current GUI this doesn't matter, because the wallet
|
||||
|
||||
Reference in New Issue
Block a user