| 1584 | } |
| 1585 | |
| 1586 | bool LegacyScriptPubKeyMan::ImportPrivKeys(const std::map<CKeyID, CKey>& privkey_map, const int64_t timestamp) |
| 1587 | { |
| 1588 | WalletBatch batch(m_storage.GetDatabase()); |
| 1589 | for (const auto& entry : privkey_map) { |
| 1590 | const CKey& key = entry.second; |
| 1591 | CPubKey pubkey = key.GetPubKey(); |
| 1592 | const CKeyID& id = entry.first; |
| 1593 | assert(key.VerifyPubKey(pubkey)); |
| 1594 | // Skip if we already have the key |
| 1595 | if (HaveKey(id)) { |
| 1596 | WalletLogPrintf("Already have key with pubkey %s, skipping\n", HexStr(pubkey)); |
| 1597 | continue; |
| 1598 | } |
| 1599 | mapKeyMetadata[id].nCreateTime = timestamp; |
| 1600 | // If the private key is not present in the wallet, insert it. |
| 1601 | if (!AddKeyPubKeyWithDB(batch, key, pubkey)) { |
| 1602 | return false; |
| 1603 | } |
| 1604 | UpdateTimeFirstKey(timestamp); |
| 1605 | } |
| 1606 | return true; |
| 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 | { |
nothing calls this directly
no test coverage detected