aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-06-27 21:17:42 -0400
committerAndrew Chow <achow101-github@achow101.com>2019-07-24 11:42:46 -0400
commit78941da5baf6244c7c54e86cf8ce3e09ce60c239 (patch)
treefc07b9173f4adcb604fe2242ed4b2b579c0b1c2e /src/wallet/wallet.cpp
parent94bf156f391759420465b2ff8c44f5f150246c7f (diff)
downloadbitcoin-78941da5baf6244c7c54e86cf8ce3e09ce60c239.tar.xz
Optionally allow ImportScripts to set script creation timestamp
Behavior changes: * scripts imported in importmulti that are not explicilty scriptPubKeys will have timestamps set for them
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 45cd2d0e07..6f080f4b8f 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1661,7 +1661,7 @@ bool CWallet::DummySignTx(CMutableTransaction &txNew, const std::vector<CTxOut>
return true;
}
-bool CWallet::ImportScripts(const std::set<CScript> scripts)
+bool CWallet::ImportScripts(const std::set<CScript> scripts, int64_t timestamp)
{
WalletBatch batch(*database);
for (const auto& entry : scripts) {
@@ -1673,7 +1673,15 @@ bool CWallet::ImportScripts(const std::set<CScript> scripts)
if (!AddCScriptWithDB(batch, entry)) {
return false;
}
+
+ if (timestamp > 0) {
+ m_script_metadata[CScriptID(entry)].nCreateTime = timestamp;
+ }
}
+ if (timestamp > 0) {
+ UpdateTimeFirstKey(timestamp);
+ }
+
return true;
}