mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-22 20:58:09 +02:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user