Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/walletdb.cpp
Show First 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | |||||
bool WalletBatch::WriteActiveScriptPubKeyMan(uint8_t type, const uint256 &id, | bool WalletBatch::WriteActiveScriptPubKeyMan(uint8_t type, const uint256 &id, | ||||
bool internal) { | bool internal) { | ||||
std::string key = | std::string key = | ||||
internal ? DBKeys::ACTIVEINTERNALSPK : DBKeys::ACTIVEEXTERNALSPK; | internal ? DBKeys::ACTIVEINTERNALSPK : DBKeys::ACTIVEEXTERNALSPK; | ||||
return WriteIC(make_pair(key, type), id); | return WriteIC(make_pair(key, type), id); | ||||
} | } | ||||
bool WalletBatch::WriteDescriptorKey(const uint256 &desc_id, | |||||
const CPubKey &pubkey, | |||||
const CPrivKey &privkey) { | |||||
// hash pubkey/privkey to accelerate wallet load | |||||
std::vector<uint8_t> key; | |||||
key.reserve(pubkey.size() + privkey.size()); | |||||
key.insert(key.end(), pubkey.begin(), pubkey.end()); | |||||
key.insert(key.end(), privkey.begin(), privkey.end()); | |||||
return WriteIC(std::make_pair(DBKeys::WALLETDESCRIPTORKEY, | |||||
std::make_pair(desc_id, pubkey)), | |||||
std::make_pair(privkey, Hash(key.begin(), key.end())), | |||||
false); | |||||
} | |||||
bool WalletBatch::WriteCryptedDescriptorKey( | |||||
const uint256 &desc_id, const CPubKey &pubkey, | |||||
const std::vector<uint8_t> &secret) { | |||||
if (!WriteIC(std::make_pair(DBKeys::WALLETDESCRIPTORCKEY, | |||||
std::make_pair(desc_id, pubkey)), | |||||
secret, false)) { | |||||
return false; | |||||
} | |||||
EraseIC(std::make_pair(DBKeys::WALLETDESCRIPTORKEY, | |||||
std::make_pair(desc_id, pubkey))); | |||||
return true; | |||||
} | |||||
bool WalletBatch::WriteDescriptor(const uint256 &desc_id, | |||||
const WalletDescriptor &descriptor) { | |||||
return WriteIC(make_pair(DBKeys::WALLETDESCRIPTOR, desc_id), descriptor); | |||||
} | |||||
class CWalletScanState { | class CWalletScanState { | ||||
public: | public: | ||||
unsigned int nKeys{0}; | unsigned int nKeys{0}; | ||||
unsigned int nCKeys{0}; | unsigned int nCKeys{0}; | ||||
unsigned int nWatchKeys{0}; | unsigned int nWatchKeys{0}; | ||||
unsigned int nKeyMeta{0}; | unsigned int nKeyMeta{0}; | ||||
unsigned int m_unknown_records{0}; | unsigned int m_unknown_records{0}; | ||||
bool fIsEncrypted{false}; | bool fIsEncrypted{false}; | ||||
▲ Show 20 Lines • Show All 786 Lines • Show Last 20 Lines |