MCPcopy Create free account
hub / github.com/ElementsProject/elements / ImportScriptPubKeys

Method ImportScriptPubKeys

src/wallet/wallet.cpp:1549–1570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1547}
1548
1549bool CWallet::ImportScriptPubKeys(const std::string& label, const std::set<CScript>& script_pub_keys, const bool have_solving_data, const bool apply_label, const int64_t timestamp)
1550{
1551 auto spk_man = GetLegacyScriptPubKeyMan();
1552 if (!spk_man) {
1553 return false;
1554 }
1555 LOCK(spk_man->cs_KeyStore);
1556 if (!spk_man->ImportScriptPubKeys(script_pub_keys, have_solving_data, timestamp)) {
1557 return false;
1558 }
1559 if (apply_label) {
1560 WalletBatch batch(GetDatabase());
1561 for (const CScript& script : script_pub_keys) {
1562 CTxDestination dest;
1563 ExtractDestination(script, dest);
1564 if (IsValidDestination(dest)) {
1565 SetAddressBookWithDB(batch, dest, label, "receive");
1566 }
1567 }
1568 }
1569 return true;
1570}
1571
1572/**
1573 * Scan active chain for relevant transactions after importing keys. This should

Callers 3

importaddressFunction · 0.45
importpubkeyFunction · 0.45
backup.cppFile · 0.45

Calls 2

ExtractDestinationFunction · 0.85
IsValidDestinationFunction · 0.85

Tested by

no test coverage detected