test: refactor: move CreateDescriptor helper to wallet test util module

Can be reviewed via `--color-moved=dimmed-zebra`.
This commit is contained in:
Sebastian Falbesoner authored and Ava Chow committed 2025-01-03 13:12:27 -05:00
1 parent 493656763f
commit 62a95f5af9
3 files changed
+23 -21

No files matched your search

-20
View File
@@ -20,26 +20,6 @@ using namespace util::hex_literals;
namespace wallet {
BOOST_FIXTURE_TEST_SUITE(ismine_tests, BasicTestingSetup)
wallet::ScriptPubKeyMan* CreateDescriptor(CWallet& keystore, const std::string& desc_str, const bool success)
{
keystore.SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
FlatSigningProvider keys;
std::string error;
auto parsed_descs = Parse(desc_str, keys, error, false);
BOOST_CHECK(success == (!parsed_descs.empty()));
if (!success) return nullptr;
auto& desc = parsed_descs.at(0);
const int64_t range_start = 0, range_end = 1, next_index = 0, timestamp = 1;
WalletDescriptor w_desc(std::move(desc), timestamp, range_start, range_end, next_index);
LOCK(keystore.cs_wallet);
return Assert(keystore.AddWalletDescriptor(w_desc, keys,/*label=*/"", /*internal=*/false));
};
BOOST_AUTO_TEST_CASE(ismine_standard)
{
CKey keys[2];