diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-06-27 21:17:42 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2019-07-24 11:42:46 -0400 |
commit | 78941da5baf6244c7c54e86cf8ce3e09ce60c239 (patch) | |
tree | fc07b9173f4adcb604fe2242ed4b2b579c0b1c2e /src/wallet/wallet.cpp | |
parent | 94bf156f391759420465b2ff8c44f5f150246c7f (diff) | |
download | bitcoin-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.cpp | 10 |
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; } |