18
18
19
19
using wallet::CWallet;
20
20
using wallet::CreateMockableWalletDatabase;
21
- using wallet::DatabaseFormat;
22
- using wallet::DatabaseOptions;
23
21
using wallet::TxStateInactive;
24
22
using wallet::WALLET_FLAG_DESCRIPTORS;
25
23
using wallet::WalletContext;
26
24
using wallet::WalletDatabase;
27
25
28
- static std::shared_ptr<CWallet> BenchLoadWallet (std::unique_ptr<WalletDatabase> database, WalletContext& context, DatabaseOptions& options )
26
+ static std::shared_ptr<CWallet> BenchLoadWallet (std::unique_ptr<WalletDatabase> database, WalletContext& context, uint64_t create_flags )
29
27
{
30
28
bilingual_str error;
31
29
std::vector<bilingual_str> warnings;
32
- auto wallet = CWallet::Create (context, " " , std::move (database), options. create_flags , error, warnings);
30
+ auto wallet = CWallet::Create (context, " " , std::move (database), create_flags, error, warnings);
33
31
NotifyWalletLoaded (context, wallet);
34
32
if (context.chain ) {
35
33
wallet->postInitProcess ();
@@ -56,23 +54,19 @@ static void AddTx(CWallet& wallet)
56
54
static void WalletLoading (benchmark::Bench& bench, bool legacy_wallet)
57
55
{
58
56
const auto test_setup = MakeNoLogFileContext<TestingSetup>();
59
- test_setup->m_args .ForceSetArg (" -unsafesqlitesync" , " 1" );
60
57
61
58
WalletContext context;
62
59
context.args = &test_setup->m_args ;
63
60
context.chain = test_setup->m_node .chain .get ();
64
61
65
62
// Setup the wallet
66
63
// Loading the wallet will also create it
67
- DatabaseOptions options;
68
- if (legacy_wallet) {
69
- options.require_format = DatabaseFormat::BERKELEY;
70
- } else {
71
- options.create_flags = WALLET_FLAG_DESCRIPTORS;
72
- options.require_format = DatabaseFormat::SQLITE;
64
+ uint64_t create_flags = 0 ;
65
+ if (!legacy_wallet) {
66
+ create_flags = WALLET_FLAG_DESCRIPTORS;
73
67
}
74
68
auto database = CreateMockableWalletDatabase ();
75
- auto wallet = BenchLoadWallet (std::move (database), context, options );
69
+ auto wallet = BenchLoadWallet (std::move (database), context, create_flags );
76
70
77
71
// Generate a bunch of transactions and addresses to put into the wallet
78
72
for (int i = 0 ; i < 1000 ; ++i) {
@@ -85,7 +79,7 @@ static void WalletLoading(benchmark::Bench& bench, bool legacy_wallet)
85
79
BenchUnloadWallet (std::move (wallet));
86
80
87
81
bench.epochs (5 ).run ([&] {
88
- wallet = BenchLoadWallet (std::move (database), context, options );
82
+ wallet = BenchLoadWallet (std::move (database), context, create_flags );
89
83
90
84
// Cleanup
91
85
database = DuplicateMockDatabase (wallet->GetDatabase ());
0 commit comments