Do not import private keys to wallets with private keys disabled

This commit is contained in:
Andrew Chow
2019-01-25 14:38:34 -05:00
parent b5c5021b64
commit e6c58d3b01
4 changed files with 31 additions and 0 deletions

View File

@@ -251,6 +251,9 @@ bool CWallet::AddKeyPubKeyWithDB(WalletBatch &batch, const CKey& secret, const C
{
AssertLockHeld(cs_wallet); // mapKeyMetadata
// Make sure we aren't adding private keys to private key disabled wallets
assert(!IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS));
// CCryptoKeyStore has no concept of wallet databases, but calls AddCryptedKey
// which is overridden below. To avoid flushes, the database handle is
// tunneled through to it.