| 1560 | } |
| 1561 | |
| 1562 | bool LegacyScriptPubKeyMan::ImportScripts(const std::set<CScript> scripts, int64_t timestamp) |
| 1563 | { |
| 1564 | WalletBatch batch(m_storage.GetDatabase()); |
| 1565 | for (const auto& entry : scripts) { |
| 1566 | CScriptID id(entry); |
| 1567 | if (HaveCScript(id)) { |
| 1568 | WalletLogPrintf("Already have script %s, skipping\n", HexStr(entry)); |
| 1569 | continue; |
| 1570 | } |
| 1571 | if (!AddCScriptWithDB(batch, entry)) { |
| 1572 | return false; |
| 1573 | } |
| 1574 | |
| 1575 | if (timestamp > 0) { |
| 1576 | m_script_metadata[CScriptID(entry)].nCreateTime = timestamp; |
| 1577 | } |
| 1578 | } |
| 1579 | if (timestamp > 0) { |
| 1580 | UpdateTimeFirstKey(timestamp); |
| 1581 | } |
| 1582 | |
| 1583 | return true; |
| 1584 | } |
| 1585 | |
| 1586 | bool LegacyScriptPubKeyMan::ImportPrivKeys(const std::map<CKeyID, CKey>& privkey_map, const int64_t timestamp) |
| 1587 | { |