bench: Use DescriptorScriptPubKeyMan for wallet things

For wallet related benchmarks that need a ScriptPubKeyMan for operation,
use a DescriptorScriptPubKeyMan
This commit is contained in:
Andrew Chow
2021-10-12 14:25:38 -04:00
parent 5e54aa9b90
commit 9bf0243872
3 changed files with 8 additions and 21 deletions

View File

@@ -25,16 +25,4 @@ std::string getnewaddress(CWallet& w)
return EncodeDestination(dest);
}
void importaddress(CWallet& wallet, const std::string& address)
{
auto spk_man = wallet.GetLegacyScriptPubKeyMan();
LOCK2(wallet.cs_wallet, spk_man->cs_KeyStore);
const auto dest = DecodeDestination(address);
assert(IsValidDestination(dest));
const auto script = GetScriptForDestination(dest);
wallet.MarkDirty();
assert(!spk_man->HaveWatchOnly(script));
if (!spk_man->AddWatchOnly(script, 0 /* nCreateTime */)) assert(false);
wallet.SetAddressBook(dest, /* label */ "", "receive");
}
#endif // ENABLE_WALLET