diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2019-04-04 12:48:42 -0700 |
---|---|---|
committer | MeshCollider <dobsonsa68@gmail.com> | 2019-04-16 19:34:38 +1200 |
commit | 802dcd37d196aab07f377938d851d7eaf095b03b (patch) | |
tree | b344f04934a2536a6cb338562036dc3c862ac5a2 /src/wallet/rpcdump.cpp | |
parent | 7fcbe7dc112b3d35a5066e6d181f286fb630f744 (diff) |
Import all origin info in importmulti; even for non-importing pubkeys
Github-Pull: #15749
Rebased-From: 6e597001a4fc1ba837f3f23cfd7f2d65c3d58104
Diffstat (limited to 'src/wallet/rpcdump.cpp')
-rw-r--r-- | src/wallet/rpcdump.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 779dcaf061..a809a5e782 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -1270,7 +1270,10 @@ static UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, con throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); } pwallet->UpdateTimeFirstKey(timestamp); - } + } + for (const auto& entry : import_data.key_origins) { + pwallet->AddKeyOrigin(entry.second.first, entry.second.second); + } for (const CKeyID& id : ordered_pubkeys) { auto entry = pubkey_map.find(id); if (entry == pubkey_map.end()) { @@ -1281,10 +1284,6 @@ static UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, con if (!pwallet->GetPubKey(id, temp) && !pwallet->AddWatchOnly(GetScriptForRawPubKey(pubkey), timestamp)) { throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet"); } - const auto& key_orig_it = import_data.key_origins.find(id); - if (key_orig_it != import_data.key_origins.end()) { - pwallet->AddKeyOrigin(pubkey, key_orig_it->second.second); - } pwallet->mapKeyMetadata[id].nCreateTime = timestamp; // Add to keypool only works with pubkeys |