@@ -143,11 +143,20 @@ void TestGUI(interfaces::Node& node)
143
143
node.setContext (&test.m_node );
144
144
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context ()->chain .get (), " " , CreateMockWalletDatabase ());
145
145
wallet->LoadWallet ();
146
+ wallet->SetWalletFlag (WALLET_FLAG_DESCRIPTORS);
146
147
{
147
- auto spk_man = wallet->GetOrCreateLegacyScriptPubKeyMan ();
148
- LOCK2 (wallet->cs_wallet , spk_man->cs_KeyStore );
149
- wallet->SetAddressBook (GetDestinationForKey (test.coinbaseKey .GetPubKey (), wallet->m_default_address_type ), " " , " receive" );
150
- spk_man->AddKeyPubKey (test.coinbaseKey , test.coinbaseKey .GetPubKey ());
148
+ LOCK (wallet->cs_wallet );
149
+ wallet->SetupDescriptorScriptPubKeyMans ();
150
+
151
+ // Add the coinbase key
152
+ FlatSigningProvider provider;
153
+ std::string error;
154
+ std::unique_ptr<Descriptor> desc = Parse (" combo(" + EncodeSecret (test.coinbaseKey ) + " )" , provider, error, /* require_checksum=*/ false );
155
+ assert (desc);
156
+ WalletDescriptor w_desc (std::move (desc), 0 , 0 , 1 , 1 );
157
+ if (!wallet->AddWalletDescriptor (w_desc, provider, " " , false )) assert (false );
158
+ CTxDestination dest = GetDestinationForKey (test.coinbaseKey .GetPubKey (), wallet->m_default_address_type );
159
+ wallet->SetAddressBook (dest, " " , " receive" );
151
160
wallet->SetLastBlockProcessed (105 , node.context ()->chainman ->ActiveChain ().Tip ()->GetBlockHash ());
152
161
}
153
162
{
0 commit comments