Skip to content

Commit 1fcdc96

Browse files
committed
test: remove unneeded code from some wallet_tests
This is done to avoid conflicts arising from backports.
1 parent 5dc5090 commit 1fcdc96

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

src/wallet/test/wallet_tests.cpp

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ extern RPCHelpMan getrawchangeaddress();
4040
extern RPCHelpMan getaddressinfo();
4141
extern RPCHelpMan addmultisigaddress();
4242

43-
extern RecursiveMutex cs_wallets;
44-
4543
// Ensure that fee levels defined in the wallet are at least as high
4644
// as the default levels for node policy.
4745
static_assert(DEFAULT_TRANSACTION_MINFEE >= DEFAULT_MIN_RELAY_TX_FEE, "wallet minimum fee is smaller than default relay fee");
@@ -605,12 +603,7 @@ BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup)
605603

606604
BOOST_FIXTURE_TEST_CASE(wallet_disableprivkeys, TestChain100Setup)
607605
{
608-
NodeContext node;
609-
node.fee_estimator = std::make_unique<CBlockPolicyEstimator>();
610-
node.mempool = std::make_unique<CTxMemPool>(node.fee_estimator.get());
611-
auto chain = interfaces::MakeChain(node);
612-
const std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(chain.get(), m_node.coinjoin_loader.get(), "", CreateDummyWalletDatabase());
613-
wallet->SetupLegacyScriptPubKeyMan();
606+
const std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(m_node.chain.get(), m_node.coinjoin_loader.get(), "", CreateDummyWalletDatabase()); wallet->SetupLegacyScriptPubKeyMan();
614607
wallet->SetMinVersion(FEATURE_LATEST);
615608
wallet->SetWalletFlag(WALLET_FLAG_DISABLE_PRIVATE_KEYS);
616609
BOOST_CHECK(!wallet->TopUpKeyPool(1000));
@@ -637,19 +630,15 @@ static size_t CalculateNestedKeyhashInputSize(bool use_max_sig)
637630
// Create outer P2SH script for the output
638631
CScript script_pubkey = GetScriptForRawPubKey(pubkey);
639632

640-
NodeContext node;
641-
node.fee_estimator = std::make_unique<CBlockPolicyEstimator>();
642-
node.mempool = std::make_unique<CTxMemPool>(node.fee_estimator.get());
643-
auto chain = interfaces::MakeChain(node);
644-
CWallet wallet(chain.get(), /*coinjoin_loader=*/ nullptr, "", CreateDummyWalletDatabase());
645-
AddKey(wallet, key);
646-
auto spk_man = wallet.GetLegacyScriptPubKeyMan();
647-
spk_man->AddCScript(inner_script);
633+
// Add inner-script to key store and key to watchonly
634+
FillableSigningProvider keystore;
635+
keystore.AddCScript(inner_script);
636+
keystore.AddKeyPubKey(key, pubkey);
648637

649638
// Fill in dummy signatures for fee calculation.
650639
SignatureData sig_data;
651640

652-
if (!ProduceSignature(*spk_man, use_max_sig ? DUMMY_MAXIMUM_SIGNATURE_CREATOR : DUMMY_SIGNATURE_CREATOR, script_pubkey, sig_data)) {
641+
if (!ProduceSignature(keystore, use_max_sig ? DUMMY_MAXIMUM_SIGNATURE_CREATOR : DUMMY_SIGNATURE_CREATOR, script_pubkey, sig_data)) {
653642
// We're hand-feeding it correct arguments; shouldn't happen
654643
assert(false);
655644
}
@@ -805,7 +794,6 @@ BOOST_FIXTURE_TEST_CASE(CreateWalletWithoutChain, BasicTestingSetup)
805794
BOOST_FIXTURE_TEST_CASE(ZapSelectTx, TestChain100Setup)
806795
{
807796
gArgs.ForceSetArg("-unsafesqlitesync", "1");
808-
auto chain = interfaces::MakeChain(m_node);
809797
auto wallet = TestLoadWallet(m_node.chain.get(), m_node.coinjoin_loader.get());
810798
CKey key;
811799
key.MakeNewKey(true);

0 commit comments

Comments
 (0)