@@ -21,6 +21,7 @@ using wallet::DatabaseOptions;
2121using wallet::DatabaseStatus;
2222using wallet::ISMINE_SPENDABLE;
2323using wallet::MakeWalletDatabase;
24+ using wallet::TxStateInactive;
2425using wallet::WALLET_FLAG_DESCRIPTORS;
2526using wallet::WalletContext;
2627
@@ -46,6 +47,19 @@ static void BenchUnloadWallet(std::shared_ptr<CWallet>&& wallet)
4647 UnloadWallet (std::move (wallet));
4748}
4849
50+ static void AddTx (CWallet& wallet)
51+ {
52+ bilingual_str error;
53+ CTxDestination dest;
54+ wallet.GetNewDestination (OutputType::BECH32, " " , dest, error);
55+
56+ CMutableTransaction mtx;
57+ mtx.vout .push_back ({COIN, GetScriptForDestination (dest)});
58+ mtx.vin .push_back (CTxIn ());
59+
60+ wallet.AddToWallet (MakeTransactionRef (mtx), TxStateInactive{});
61+ }
62+
4963static void WalletLoading (benchmark::Bench& bench, bool legacy_wallet)
5064{
5165 const auto test_setup = MakeNoLogFileContext<TestingSetup>();
@@ -63,7 +77,7 @@ static void WalletLoading(benchmark::Bench& bench, bool legacy_wallet)
6377
6478 // Generate a bunch of transactions and addresses to put into the wallet
6579 for (int i = 0 ; i < 5000 ; ++i) {
66- generatetoaddress (test_setup-> m_node , getnewaddress ( *wallet) );
80+ AddTx ( *wallet);
6781 }
6882
6983 // reload the wallet for the actual benchmark
0 commit comments