22 auto test_setup = MakeNoLogFileContext<TestingSetup>();
26 SecureString secure_pass{password.begin(), password.end()};
29 context.
args = &test_setup->m_args;
30 context.
chain = test_setup->m_node.chain.get();
38 for (
unsigned int i = 0; i < key_count; i++) {
42 std::vector<std::unique_ptr<Descriptor>> desc =
Parse(
"combo(" +
EncodeSecret(key) +
")", keys, error,
false);
44 Assert(
wallet->AddWalletDescriptor(w_desc, keys,
"",
false));
67 wallet->EncryptWallet(secure_pass);
69 for (
const auto& [
_, key] :
wallet->mapMasterKeys){
#define Assert(val)
Identity function.
An encapsulated private key.
std::vector< B > randbytes(size_t len) noexcept
Generate random bytes.
Main entry point to nanobench's benchmarking facility.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
Bench & batch(T b) noexcept
Sets the batch size.
Bench & unit(char const *unit)
Sets the operation unit.
static constexpr unsigned int DEFAULT_DERIVE_ITERATIONS
Default/minimum number of key derivation rounds.
Descriptor with some wallet metadata.
static UniValue Parse(std::string_view raw, ParamFormat format=ParamFormat::JSON)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
CKey GenerateRandomKey(bool compressed) noexcept
std::string EncodeSecret(const CKey &key)
BENCHMARK(WalletBalanceDirty)
constexpr unsigned int KEY_COUNT
static void WalletEncryptDescriptors(benchmark::Bench &bench)
void TestUnloadWallet(std::shared_ptr< CWallet > &&wallet)
std::unique_ptr< WalletDatabase > CreateMockableWalletDatabase(MockableData records)
std::unique_ptr< WalletDatabase > DuplicateMockDatabase(WalletDatabase &database)
static void WalletEncrypt(benchmark::Bench &bench, unsigned int key_count)
std::shared_ptr< CWallet > TestLoadWallet(std::unique_ptr< WalletDatabase > database, WalletContext &context)
std::shared_ptr< CWallet > TestCreateWallet(std::unique_ptr< WalletDatabase > database, WalletContext &context, uint64_t create_flags)
@ WALLET_FLAG_DESCRIPTORS
Indicate that this wallet supports DescriptorScriptPubKeyMan.
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
WalletContext struct containing references to state shared between CWallet instances,...
interfaces::Chain * chain
consteval auto _(util::TranslatedLiteral str)
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.