mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Use importmulti timestamp when importing watch only keys
When importing a watch-only address over importmulti with a specific timestamp, the wallet's nTimeFirstKey is currently set to 1. After this change, the provided timestamp will be used and stored as metadata associated with watch-only key. This can improve wallet performance because it can avoid the need to scan the entire blockchain for watch only addresses when timestamps are provided. Also adds timestamp to validateaddress return value (needed for tests). Fixes #9034.
This commit is contained in:
@@ -208,6 +208,9 @@ UniValue validateaddress(const JSONRPCRequest& request)
|
||||
if (pwalletMain) {
|
||||
const auto& meta = pwalletMain->mapKeyMetadata;
|
||||
auto it = address.GetKeyID(keyID) ? meta.find(keyID) : meta.end();
|
||||
if (it == meta.end()) {
|
||||
it = meta.find(CScriptID(scriptPubKey));
|
||||
}
|
||||
if (it != meta.end()) {
|
||||
ret.push_back(Pair("timestamp", it->second.nCreateTime));
|
||||
if (!it->second.hdKeypath.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user