File tree Expand file tree Collapse file tree 1 file changed +4
-22
lines changed Expand file tree Collapse file tree 1 file changed +4
-22
lines changed Original file line number Diff line number Diff line change @@ -1264,33 +1264,15 @@ static void protx_list_help(const JSONRPCRequest& request)
1264
1264
}
1265
1265
1266
1266
#ifdef ENABLE_WALLET
1267
- static bool CheckWalletOwnsKey (const CWallet* const pwallet, const CKeyID& keyID) {
1268
- if (!pwallet) {
1269
- return false ;
1270
- }
1271
- const LegacyScriptPubKeyMan* const spk_man = pwallet->GetLegacyScriptPubKeyMan ();
1272
- if (!spk_man) {
1273
- return false ;
1274
- }
1275
- return spk_man->HaveKey (keyID);
1276
- }
1277
-
1278
1267
static bool CheckWalletOwnsScript (const CWallet* const pwallet, const CScript& script) {
1279
1268
if (!pwallet) {
1280
1269
return false ;
1281
1270
}
1282
- const LegacyScriptPubKeyMan* const spk_man = pwallet->GetLegacyScriptPubKeyMan ();
1283
- if (!spk_man) {
1284
- return false ;
1285
- }
1271
+ return WITH_LOCK (pwallet->cs_wallet , return pwallet->IsMine (script)) == isminetype::ISMINE_SPENDABLE;
1272
+ }
1286
1273
1287
- CTxDestination dest;
1288
- if (ExtractDestination (script, dest)) {
1289
- if ((std::get_if<PKHash>(&dest) && spk_man->HaveKey (ToKeyID (*std::get_if<PKHash>(&dest)))) || (std::get_if<ScriptHash>(&dest) && spk_man->HaveCScript (CScriptID{ScriptHash (*std::get_if<ScriptHash>(&dest))}))) {
1290
- return true ;
1291
- }
1292
- }
1293
- return false ;
1274
+ static bool CheckWalletOwnsKey (const CWallet* const pwallet, const CKeyID& keyID) {
1275
+ return CheckWalletOwnsScript (pwallet, GetScriptForDestination (PKHash (keyID)));
1294
1276
}
1295
1277
#endif
1296
1278
You can’t perform that action at this time.
0 commit comments