| 1547 | } |
| 1548 | |
| 1549 | bool 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 |
no test coverage detected