mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge bitcoin/bitcoin#23288: tests: remove usage of LegacyScriptPubKeyMan from some wallet tests
2d2edc1248tests: Use Descriptor wallets for generic wallet tests (Andrew Chow)99516285b7tests: Use legacy change type in subtract fee from outputs test (Andrew Chow)dcd6eeb64atests: Use descriptors in psbt_wallet_tests (Andrew Chow)4b1588c6bdtests: Use DescriptorScriptPubKeyMan in coinselector_tests (Andrew Chow)811319fea4tests, gui: Use DescriptorScriptPubKeyMan in GUI tests (Andrew Chow)9bf0243872bench: Use DescriptorScriptPubKeyMan for wallet things (Andrew Chow)5e54aa9b90bench: remove global testWallet from CoinSelection benchmark (Andrew Chow)a5595b1320tests: Remove global vCoins and testWallet from coinselector_tests (Andrew Chow) Pull request description: Currently, various tests use `LegacyScriptPubKeyMan` because it was convenient for the refactor that introduced the `ScriptPubKeyMan` interface. However, with the legacy wallet slated to be removed, these tests should not continue to use `LegacyScriptPubKeyMan` as they are not testing any specific legacy wallet behavior. These tests are changed to use `DescriptorScriptPubKeyMan`s. Some of the coin selection tests and benchmarks had a global `testWallet`, but this seemed to cause some issues with ensuring that descriptors were set up in that wallet for each test. Those have been restructured to not have any global variables that may be modified between tests. The tests which test specific legacy wallet behavior remain unchanged. ACKs for top commit: laanwj: Code review ACK2d2edc1248brunoerg: tACK2d2edc1248Tree-SHA512: 6d60e5978e822d48e46cfc0dae4635fcb1939f21ea9d84eb72e36112e925554b7ee8f932c7ed0c4881b6566c6c19260bec346abdff1956ca9f300b30fb4e2dd1
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user