mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
wallet: add external_signer flag
This commit is contained in:
parent
f3e6ce78fb
commit
157ea7c614
3 changed files with 20 additions and 1 deletions
|
@ -259,6 +259,20 @@ std::shared_ptr<CWallet> CreateWallet(interfaces::Chain& chain, const std::strin
|
||||||
wallet_creation_flags |= WALLET_FLAG_BLANK_WALLET;
|
wallet_creation_flags |= WALLET_FLAG_BLANK_WALLET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Private keys must be disabled for an external signer wallet
|
||||||
|
if ((wallet_creation_flags & WALLET_FLAG_EXTERNAL_SIGNER) && !(wallet_creation_flags & WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
|
||||||
|
error = Untranslated("Private keys must be disabled when using an external signer");
|
||||||
|
status = DatabaseStatus::FAILED_CREATE;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Descriptor support must be enabled for an external signer wallet
|
||||||
|
if ((wallet_creation_flags & WALLET_FLAG_EXTERNAL_SIGNER) && !(wallet_creation_flags & WALLET_FLAG_DESCRIPTORS)) {
|
||||||
|
error = Untranslated("Descriptor support must be enabled when using an external signer");
|
||||||
|
status = DatabaseStatus::FAILED_CREATE;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Wallet::Verify will check if we're trying to create a wallet with a duplicate name.
|
// Wallet::Verify will check if we're trying to create a wallet with a duplicate name.
|
||||||
std::unique_ptr<WalletDatabase> database = MakeWalletDatabase(name, options, status, error);
|
std::unique_ptr<WalletDatabase> database = MakeWalletDatabase(name, options, status, error);
|
||||||
if (!database) {
|
if (!database) {
|
||||||
|
|
|
@ -115,7 +115,8 @@ static constexpr uint64_t KNOWN_WALLET_FLAGS =
|
||||||
| WALLET_FLAG_BLANK_WALLET
|
| WALLET_FLAG_BLANK_WALLET
|
||||||
| WALLET_FLAG_KEY_ORIGIN_METADATA
|
| WALLET_FLAG_KEY_ORIGIN_METADATA
|
||||||
| WALLET_FLAG_DISABLE_PRIVATE_KEYS
|
| WALLET_FLAG_DISABLE_PRIVATE_KEYS
|
||||||
| WALLET_FLAG_DESCRIPTORS;
|
| WALLET_FLAG_DESCRIPTORS
|
||||||
|
| WALLET_FLAG_EXTERNAL_SIGNER;
|
||||||
|
|
||||||
static constexpr uint64_t MUTABLE_WALLET_FLAGS =
|
static constexpr uint64_t MUTABLE_WALLET_FLAGS =
|
||||||
WALLET_FLAG_AVOID_REUSE;
|
WALLET_FLAG_AVOID_REUSE;
|
||||||
|
@ -126,6 +127,7 @@ static const std::map<std::string,WalletFlags> WALLET_FLAG_MAP{
|
||||||
{"key_origin_metadata", WALLET_FLAG_KEY_ORIGIN_METADATA},
|
{"key_origin_metadata", WALLET_FLAG_KEY_ORIGIN_METADATA},
|
||||||
{"disable_private_keys", WALLET_FLAG_DISABLE_PRIVATE_KEYS},
|
{"disable_private_keys", WALLET_FLAG_DISABLE_PRIVATE_KEYS},
|
||||||
{"descriptor_wallet", WALLET_FLAG_DESCRIPTORS},
|
{"descriptor_wallet", WALLET_FLAG_DESCRIPTORS},
|
||||||
|
{"external_signer", WALLET_FLAG_EXTERNAL_SIGNER}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const std::map<uint64_t,std::string> WALLET_FLAG_CAVEATS;
|
extern const std::map<uint64_t,std::string> WALLET_FLAG_CAVEATS;
|
||||||
|
|
|
@ -60,6 +60,9 @@ enum WalletFlags : uint64_t {
|
||||||
|
|
||||||
//! Indicate that this wallet supports DescriptorScriptPubKeyMan
|
//! Indicate that this wallet supports DescriptorScriptPubKeyMan
|
||||||
WALLET_FLAG_DESCRIPTORS = (1ULL << 34),
|
WALLET_FLAG_DESCRIPTORS = (1ULL << 34),
|
||||||
|
|
||||||
|
//! Indicates that the wallet needs an external signer
|
||||||
|
WALLET_FLAG_EXTERNAL_SIGNER = (1ULL << 35),
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Get the path of the wallet directory.
|
//! Get the path of the wallet directory.
|
||||||
|
|
Loading…
Add table
Reference in a new issue