aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/test/util.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2021-10-12 20:54:33 -0400
committerAndrew Chow <achow101-github@achow101.com>2021-10-15 17:01:51 -0400
commit2d2edc1248a2e49636409b07448676e5bfe44956 (patch)
treea413dfe308f87b8a389f1364e064ae438b16d4c6 /src/wallet/test/util.cpp
parent99516285b7cf2664563712d95d95f54e1985c0c2 (diff)
downloadbitcoin-2d2edc1248a2e49636409b07448676e5bfe44956.tar.xz
tests: Use Descriptor wallets for generic wallet tests
For the generic wallet tests, make DescriptorScriptPubKeyMans. There are still some wallet tests that test legacy wallet things. Those remain unchanged.
Diffstat (limited to 'src/wallet/test/util.cpp')
-rw-r--r--src/wallet/test/util.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/wallet/test/util.cpp b/src/wallet/test/util.cpp
index c3061b93c0..2990fc8f8d 100644
--- a/src/wallet/test/util.cpp
+++ b/src/wallet/test/util.cpp
@@ -6,6 +6,7 @@
#include <chain.h>
#include <key.h>
+#include <key_io.h>
#include <test/util/setup_common.h>
#include <wallet/wallet.h>
#include <wallet/walletdb.h>
@@ -23,9 +24,16 @@ std::unique_ptr<CWallet> CreateSyncedWallet(interfaces::Chain& chain, CChain& cc
}
wallet->LoadWallet();
{
- auto spk_man = wallet->GetOrCreateLegacyScriptPubKeyMan();
- LOCK2(wallet->cs_wallet, spk_man->cs_KeyStore);
- spk_man->AddKeyPubKey(key, key.GetPubKey());
+ LOCK(wallet->cs_wallet);
+ wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
+ wallet->SetupDescriptorScriptPubKeyMans();
+
+ FlatSigningProvider provider;
+ std::string error;
+ std::unique_ptr<Descriptor> desc = Parse("combo(" + EncodeSecret(key) + ")", provider, error, /* require_checksum=*/ false);
+ assert(desc);
+ WalletDescriptor w_desc(std::move(desc), 0, 0, 1, 1);
+ if (!wallet->AddWalletDescriptor(w_desc, provider, "", false)) assert(false);
}
WalletRescanReserver reserver(*wallet);
reserver.reserve();