aboutsummaryrefslogtreecommitdiff
path: root/src/bench/wallet_create_tx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bench/wallet_create_tx.cpp')
-rw-r--r--src/bench/wallet_create_tx.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/bench/wallet_create_tx.cpp b/src/bench/wallet_create_tx.cpp
index 160534b63c..84e02d2a26 100644
--- a/src/bench/wallet_create_tx.cpp
+++ b/src/bench/wallet_create_tx.cpp
@@ -16,7 +16,6 @@
using wallet::CWallet;
using wallet::CreateMockableWalletDatabase;
-using wallet::DBErrors;
using wallet::WALLET_FLAG_DESCRIPTORS;
struct TipBlock
@@ -90,17 +89,17 @@ static void WalletCreateTx(benchmark::Bench& bench, const OutputType output_type
LOCK(wallet.cs_wallet);
wallet.SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
wallet.SetupDescriptorScriptPubKeyMans();
- if (wallet.LoadWallet() != DBErrors::LOAD_OK) assert(false);
}
// Generate destinations
- CScript dest = GetScriptForDestination(getNewDestination(wallet, output_type));
+ const auto dest{getNewDestination(wallet, output_type)};
// Generate chain; each coinbase will have two outputs to fill-up the wallet
const auto& params = Params();
+ const CScript coinbase_out{GetScriptForDestination(dest)};
unsigned int chain_size = 5000; // 5k blocks means 10k UTXO for the wallet (minus 200 due COINBASE_MATURITY)
for (unsigned int i = 0; i < chain_size; ++i) {
- generateFakeBlock(params, test_setup->m_node, wallet, dest);
+ generateFakeBlock(params, test_setup->m_node, wallet, coinbase_out);
}
// Check available balance
@@ -130,7 +129,7 @@ static void WalletCreateTx(benchmark::Bench& bench, const OutputType output_type
bench.epochIterations(5).run([&] {
LOCK(wallet.cs_wallet);
- const auto& tx_res = CreateTransaction(wallet, recipients, -1, coin_control);
+ const auto& tx_res = CreateTransaction(wallet, recipients, /*change_pos=*/std::nullopt, coin_control);
assert(tx_res);
});
}
@@ -145,7 +144,6 @@ static void AvailableCoins(benchmark::Bench& bench, const std::vector<OutputType
LOCK(wallet.cs_wallet);
wallet.SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
wallet.SetupDescriptorScriptPubKeyMans();
- if (wallet.LoadWallet() != DBErrors::LOAD_OK) assert(false);
}
// Generate destinations
@@ -185,4 +183,4 @@ static void WalletAvailableCoins(benchmark::Bench& bench) { AvailableCoins(bench
BENCHMARK(WalletCreateTxUseOnlyPresetInputs, benchmark::PriorityLevel::LOW)
BENCHMARK(WalletCreateTxUsePresetInputsAndCoinSelection, benchmark::PriorityLevel::LOW)
-BENCHMARK(WalletAvailableCoins, benchmark::PriorityLevel::LOW); \ No newline at end of file
+BENCHMARK(WalletAvailableCoins, benchmark::PriorityLevel::LOW);