Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 1,822 Lines • ▼ Show 20 Lines | for (const auto &txout : txouts) { | ||||
return false; | return false; | ||||
} | } | ||||
nIn++; | nIn++; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool CWallet::ImportScripts(const std::set<CScript> scripts) { | bool CWallet::ImportScripts(const std::set<CScript> scripts, | ||||
int64_t timestamp) { | |||||
WalletBatch batch(*database); | WalletBatch batch(*database); | ||||
for (const auto &entry : scripts) { | for (const auto &entry : scripts) { | ||||
CScriptID id(entry); | CScriptID id(entry); | ||||
if (HaveCScript(id)) { | if (HaveCScript(id)) { | ||||
WalletLogPrintf("Already have script %s, skipping\n", | WalletLogPrintf("Already have script %s, skipping\n", | ||||
HexStr(entry)); | HexStr(entry)); | ||||
continue; | continue; | ||||
} | } | ||||
if (!AddCScriptWithDB(batch, entry)) { | if (!AddCScriptWithDB(batch, entry)) { | ||||
return false; | return false; | ||||
} | } | ||||
if (timestamp > 0) { | |||||
m_script_metadata[CScriptID(entry)].nCreateTime = timestamp; | |||||
} | |||||
} | } | ||||
if (timestamp > 0) { | |||||
UpdateTimeFirstKey(timestamp); | |||||
} | |||||
return true; | return true; | ||||
} | } | ||||
bool CWallet::ImportPrivKeys(const std::map<CKeyID, CKey> &privkey_map, | bool CWallet::ImportPrivKeys(const std::map<CKeyID, CKey> &privkey_map, | ||||
const int64_t timestamp) { | const int64_t timestamp) { | ||||
WalletBatch batch(*database); | WalletBatch batch(*database); | ||||
for (const auto &entry : privkey_map) { | for (const auto &entry : privkey_map) { | ||||
const CKey &key = entry.second; | const CKey &key = entry.second; | ||||
▲ Show 20 Lines • Show All 3,314 Lines • Show Last 20 Lines |