aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.h
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-05-05 08:53:39 +0200
committerJonas Schnelli <dev@jonasschnelli.ch>2018-07-12 20:31:57 +0100
commitcebefba0855cee7fbcb9474b34e6779369e8e9ce (patch)
treed19414305e656bb6951f43714c777e0853a57c6a /src/wallet/wallet.h
parent9995a602a639b64a749545b7c3bafbf67f97324f (diff)
downloadbitcoin-cebefba0855cee7fbcb9474b34e6779369e8e9ce.tar.xz
Add option to disable private keys during internal wallet creation
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r--src/wallet/wallet.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index c88fbe8b96..443b8f0f53 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -113,6 +113,16 @@ constexpr OutputType DEFAULT_ADDRESS_TYPE{OutputType::P2SH_SEGWIT};
//! Default for -changetype
constexpr OutputType DEFAULT_CHANGE_TYPE{OutputType::CHANGE_AUTO};
+enum WalletFlags : uint64_t {
+ // wallet flags in the upper section (> 1 << 31) will lead to not opening the wallet if flag is unknown
+ // unkown wallet flags in the lower section <= (1 << 31) will be tolerated
+
+ // will enforce the rule that the wallet can't contain any private keys (only watch-only/pubkeys)
+ WALLET_FLAG_DISABLE_PRIVATE_KEYS = (1ULL << 32),
+};
+
+static constexpr uint64_t g_known_wallet_flags = WALLET_FLAG_DISABLE_PRIVATE_KEYS;
+
/** A key pool entry */
class CKeyPool
{
@@ -1132,7 +1142,7 @@ public:
static bool Verify(std::string wallet_file, bool salvage_wallet, std::string& error_string, std::string& warning_string);
/* Initializes the wallet, returns a new CWallet instance or a null pointer in case of an error */
- static std::shared_ptr<CWallet> CreateWalletFromFile(const std::string& name, const fs::path& path);
+ static std::shared_ptr<CWallet> CreateWalletFromFile(const std::string& name, const fs::path& path, uint64_t wallet_creation_flags = 0);
/**
* Wallet post-init setup
@@ -1198,8 +1208,9 @@ public:
/** check if a certain wallet flag is set */
bool IsWalletFlagSet(uint64_t flag);
- /** overwrite all flags by the given uint64_t */
- void SetWalletFlags(uint64_t overwriteFlags, bool memOnly);
+ /** overwrite all flags by the given uint64_t
+ returns false if unknown, non-tolerable flags are present */
+ bool SetWalletFlags(uint64_t overwriteFlags, bool memOnly);
};
/** A key allocated from the key pool. */