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

Method AddKeyPubKey

src/wallet.cpp:331–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331bool CWallet::AddKeyPubKey(const CKey& secret, const CPubKey& pubkey)
332{
333 AssertLockHeld(cs_wallet); // mapKeyMetadata
334 if (!CCryptoKeyStore::AddKeyPubKey(secret, pubkey))
335 return false;
336
337 // check if we need to remove from watch-only
338 CScript script;
339 script = GetScriptForDestination(pubkey.GetID());
340 if (HaveWatchOnly(script))
341 RemoveWatchOnly(script);
342
343 if (!fFileBacked)
344 return true;
345 if (!IsCrypted()) {
346 return CWalletDB(strWalletFile).WriteKey(pubkey, secret.GetPrivKey(), mapKeyMetadata[pubkey.GetID()]);
347 }
348 return true;
349}
350
351bool CWallet::AddCryptedKey(const CPubKey& vchPubKey,
352 const vector<unsigned char>& vchCryptedSecret)

Callers 5

importprivkeyFunction · 0.45
importwalletFunction · 0.45
bip38decryptFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45

Calls 5

GetScriptForDestinationFunction · 0.85
CWalletDBClass · 0.85
WriteKeyMethod · 0.80
GetPrivKeyMethod · 0.80
GetIDMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.36