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();
34 std::vector<std::pair<WalletDescriptor, FlatSigningProvider>> descs;
35 descs.reserve(key_count);
36 for (
unsigned int i = 0; i < key_count; i++) {
40 std::vector<std::unique_ptr<Descriptor>> desc =
Parse(
"combo(" +
EncodeSecret(key) +
")", keys, error,
false);
42 descs.emplace_back(w_desc, keys);
49 std::unique_ptr<WalletDatabase> database;
50 std::shared_ptr<CWallet>
wallet;
61 for (
auto& [desc, keys] : descs) {
62 Assert(
wallet->AddWalletDescriptor(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 & batch(T b) noexcept
Sets the batch size.
Bench & unit(char const *unit)
Sets the operation unit.
detail::SetupRunner< SetupOp > setup(SetupOp setupOp)
Configure an untimed setup step per epoch (forces single-iteration epochs).
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)
std::unique_ptr< WalletDatabase > CreateMockableWalletDatabase()
constexpr unsigned int KEY_COUNT
static void WalletEncryptDescriptors(benchmark::Bench &bench)
void TestUnloadWallet(std::shared_ptr< CWallet > &&wallet)
static void WalletEncrypt(benchmark::Bench &bench, unsigned int key_count)
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.