MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / WriteKey

Method WriteKey

src/wallet/walletdb.cpp:59–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59bool WalletBatch::WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata& keyMeta)
60{
61 if (!WriteIC(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta, false)) {
62 return false;
63 }
64
65 // hash pubkey/privkey to accelerate wallet load
66 std::vector<unsigned char> vchKey;
67 vchKey.reserve(vchPubKey.size() + vchPrivKey.size());
68 vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end());
69 vchKey.insert(vchKey.end(), vchPrivKey.begin(), vchPrivKey.end());
70
71 return WriteIC(std::make_pair(std::string("key"), vchPubKey), std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false);
72}
73
74bool WalletBatch::WriteCryptedKey(const CPubKey& vchPubKey,
75 const std::vector<unsigned char>& vchCryptedSecret,

Callers 1

AddKeyPubKeyWithDBMethod · 0.80

Calls 6

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

Tested by

no test coverage detected