| 1607 | } |
| 1608 | |
| 1609 | bool LegacyScriptPubKeyMan::ImportPubKeys(const std::vector<CKeyID>& ordered_pubkeys, const std::map<CKeyID, CPubKey>& pubkey_map, const std::map<CKeyID, std::pair<CPubKey, KeyOriginInfo>>& key_origins, const bool add_keypool, const bool internal, const int64_t timestamp) |
| 1610 | { |
| 1611 | WalletBatch batch(m_storage.GetDatabase()); |
| 1612 | for (const auto& entry : key_origins) { |
| 1613 | AddKeyOriginWithDB(batch, entry.second.first, entry.second.second); |
| 1614 | } |
| 1615 | for (const CKeyID& id : ordered_pubkeys) { |
| 1616 | auto entry = pubkey_map.find(id); |
| 1617 | if (entry == pubkey_map.end()) { |
| 1618 | continue; |
| 1619 | } |
| 1620 | const CPubKey& pubkey = entry->second; |
| 1621 | CPubKey temp; |
| 1622 | if (GetPubKey(id, temp)) { |
| 1623 | // Already have pubkey, skipping |
| 1624 | WalletLogPrintf("Already have pubkey %s, skipping\n", HexStr(temp)); |
| 1625 | continue; |
| 1626 | } |
| 1627 | if (!AddWatchOnlyWithDB(batch, GetScriptForRawPubKey(pubkey), timestamp)) { |
| 1628 | return false; |
| 1629 | } |
| 1630 | mapKeyMetadata[id].nCreateTime = timestamp; |
| 1631 | |
| 1632 | // Add to keypool only works with pubkeys |
| 1633 | if (add_keypool) { |
| 1634 | AddKeypoolPubkeyWithDB(pubkey, internal, batch); |
| 1635 | NotifyCanGetAddressesChanged(); |
| 1636 | } |
| 1637 | } |
| 1638 | return true; |
| 1639 | } |
| 1640 | |
| 1641 | bool LegacyScriptPubKeyMan::ImportScriptPubKeys(const std::set<CScript>& script_pub_keys, const bool have_solving_data, const int64_t timestamp) |
| 1642 | { |
nothing calls this directly
no test coverage detected