MCPcopy Create free account
hub / github.com/LUX-Core/lux / WriteKey

Method WriteKey

src/walletdb.cpp:93–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93bool CWalletDB::WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata& keyMeta)
94{
95 nWalletDBUpdateCounter++;
96
97 if (!Write(std::make_pair(std::string("keymeta"), vchPubKey),
98 keyMeta, false))
99 return false;
100
101 // hash pubkey/privkey to accelerate wallet load
102 std::vector<unsigned char> vchKey;
103 vchKey.reserve(vchPubKey.size() + vchPrivKey.size());
104 vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end());
105 vchKey.insert(vchKey.end(), vchPrivKey.begin(), vchPrivKey.end());
106
107 return Write(std::make_pair(std::string("key"), vchPubKey), std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false);
108}
109
110bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey,
111 const std::vector<unsigned char>& vchCryptedSecret,

Callers 1

AddKeyPubKeyMethod · 0.80

Calls 6

HashFunction · 0.70
reserveMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected