Skip to content

Commit a72af2e

Browse files
committed
bench: disable birth time block skip for wallet_create_tx.cpp
As the benchmarks inside wallet_create_tx.cpp assert the wallet balance at the end, they require all blocks to be scanned by the wallet. So, we need to ensure that no blocks are skipped by the recently added wallet birth time functionality. This just means setting the wallet birthtime to the genesis block time. So the wallet is always older than any new block.
1 parent f0758d8 commit a72af2e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bench/wallet_create_tx.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ static void WalletCreateTx(benchmark::Bench& bench, const OutputType output_type
8383
{
8484
const auto test_setup = MakeNoLogFileContext<const TestingSetup>();
8585

86+
// Set clock to genesis block, so the descriptors/keys creation time don't interfere with the blocks scanning process.
87+
SetMockTime(test_setup->m_node.chainman->GetParams().GenesisBlock().nTime);
8688
CWallet wallet{test_setup->m_node.chain.get(), "", CreateMockableWalletDatabase()};
8789
{
8890
LOCK(wallet.cs_wallet);
@@ -136,6 +138,8 @@ static void WalletCreateTx(benchmark::Bench& bench, const OutputType output_type
136138
static void AvailableCoins(benchmark::Bench& bench, const std::vector<OutputType>& output_type)
137139
{
138140
const auto test_setup = MakeNoLogFileContext<const TestingSetup>();
141+
// Set clock to genesis block, so the descriptors/keys creation time don't interfere with the blocks scanning process.
142+
SetMockTime(test_setup->m_node.chainman->GetParams().GenesisBlock().nTime);
139143
CWallet wallet{test_setup->m_node.chain.get(), "", CreateMockableWalletDatabase()};
140144
{
141145
LOCK(wallet.cs_wallet);

0 commit comments

Comments
 (0)