mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
rpc: Allow importmulti watchonly imports with locked wallet
This commit is contained in:
parent
a688ff9046
commit
1fcf9e6e81
1 changed files with 12 additions and 1 deletions
|
@ -1363,7 +1363,18 @@ RPCHelpMan importmulti()
|
||||||
UniValue response(UniValue::VARR);
|
UniValue response(UniValue::VARR);
|
||||||
{
|
{
|
||||||
LOCK(pwallet->cs_wallet);
|
LOCK(pwallet->cs_wallet);
|
||||||
EnsureWalletIsUnlocked(*pwallet);
|
|
||||||
|
// Check all requests are watchonly
|
||||||
|
bool is_watchonly{true};
|
||||||
|
for (size_t i = 0; i < requests.size(); ++i) {
|
||||||
|
const UniValue& request = requests[i];
|
||||||
|
if (!request.exists("watchonly") || !request["watchonly"].get_bool()) {
|
||||||
|
is_watchonly = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Wallet does not need to be unlocked if all requests are watchonly
|
||||||
|
if (!is_watchonly) EnsureWalletIsUnlocked(wallet);
|
||||||
|
|
||||||
// Verify all timestamps are present before importing any keys.
|
// Verify all timestamps are present before importing any keys.
|
||||||
CHECK_NONFATAL(pwallet->chain().findBlock(pwallet->GetLastBlockHash(), FoundBlock().time(nLowestTimestamp).mtpTime(now)));
|
CHECK_NONFATAL(pwallet->chain().findBlock(pwallet->GetLastBlockHash(), FoundBlock().time(nLowestTimestamp).mtpTime(now)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue