Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | void CWallet::DeriveNewChildKey(WalletBatch &batch, CKeyMetadata &metadata, | ||||
} | } | ||||
} | } | ||||
bool CWallet::AddKeyPubKeyWithDB(WalletBatch &batch, const CKey &secret, | bool CWallet::AddKeyPubKeyWithDB(WalletBatch &batch, const CKey &secret, | ||||
const CPubKey &pubkey) { | const CPubKey &pubkey) { | ||||
// mapKeyMetadata | // mapKeyMetadata | ||||
AssertLockHeld(cs_wallet); | AssertLockHeld(cs_wallet); | ||||
// 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 | // CCryptoKeyStore has no concept of wallet databases, but calls | ||||
// AddCryptedKey | // AddCryptedKey which is overridden below. To avoid flushes, the database | ||||
// which is overridden below. To avoid flushes, the database handle is | // handle is tunneled through to it. | ||||
// tunneled through to it. | |||||
bool needsDB = !encrypted_batch; | bool needsDB = !encrypted_batch; | ||||
if (needsDB) { | if (needsDB) { | ||||
encrypted_batch = &batch; | encrypted_batch = &batch; | ||||
} | } | ||||
if (!CCryptoKeyStore::AddKeyPubKey(secret, pubkey)) { | if (!CCryptoKeyStore::AddKeyPubKey(secret, pubkey)) { | ||||
if (needsDB) { | if (needsDB) { | ||||
encrypted_batch = nullptr; | encrypted_batch = nullptr; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 4,620 Lines • Show Last 20 Lines |