aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcdump.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2020-01-16 16:47:00 -0500
committerRussell Yanofsky <russ@yanofsky.org>2020-03-31 08:36:02 -0500
commitbc96a9bfc61afdb696fb92cb644ed5fc3d1793f1 (patch)
tree55ab5d907327c1241747f6abb794c31e5c35691b /src/wallet/rpcdump.cpp
parent25a9fcf9e53bfa94e8f8b19a4abfda0f444f6b2a (diff)
downloadbitcoin-bc96a9bfc61afdb696fb92cb644ed5fc3d1793f1.tar.xz
wallet: Avoid use of Chain::Lock in importmulti
This is a step toward removing the Chain::Lock class and reducing cs_main locking. This change only affects behavior in the case where wallet last block processed falls behind the chain tip, in which case it may use a more accurate rescan time.
Diffstat (limited to 'src/wallet/rpcdump.cpp')
-rw-r--r--src/wallet/rpcdump.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 255255c3f9..c77559c63d 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -1379,20 +1379,13 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
EnsureWalletIsUnlocked(pwallet);
// Verify all timestamps are present before importing any keys.
- const Optional<int> tip_height = locked_chain->getHeight();
- now = tip_height ? locked_chain->getBlockMedianTimePast(*tip_height) : 0;
+ CHECK_NONFATAL(pwallet->chain().findBlock(pwallet->GetLastBlockHash(), FoundBlock().time(nLowestTimestamp).mtpTime(now)));
for (const UniValue& data : requests.getValues()) {
GetImportTimestamp(data, now);
}
const int64_t minimumTimestamp = 1;
- if (fRescan && tip_height) {
- nLowestTimestamp = locked_chain->getBlockTime(*tip_height);
- } else {
- fRescan = false;
- }
-
for (const UniValue& data : requests.getValues()) {
const int64_t timestamp = std::max(GetImportTimestamp(data, now), minimumTimestamp);
const UniValue result = ProcessImport(pwallet, data, timestamp);