File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -1363,7 +1363,18 @@ RPCHelpMan importmulti()
13631363 UniValue response (UniValue::VARR);
13641364 {
13651365 LOCK (pwallet->cs_wallet );
1366- EnsureWalletIsUnlocked (*pwallet);
1366+
1367+ // Check all requests are watchonly
1368+ bool is_watchonly{true };
1369+ for (size_t i = 0 ; i < requests.size (); ++i) {
1370+ const UniValue& request = requests[i];
1371+ if (!request.exists (" watchonly" ) || !request[" watchonly" ].get_bool ()) {
1372+ is_watchonly = false ;
1373+ break ;
1374+ }
1375+ }
1376+ // Wallet does not need to be unlocked if all requests are watchonly
1377+ if (!is_watchonly) EnsureWalletIsUnlocked (wallet);
13671378
13681379 // Verify all timestamps are present before importing any keys.
13691380 CHECK_NONFATAL (pwallet->chain ().findBlock (pwallet->GetLastBlockHash (), FoundBlock ().time (nLowestTimestamp).mtpTime (now)));
You can’t perform that action at this time.
0 commit comments