Changeset View
Changeset View
Standalone View
Standalone View
src/bench/wallet_balance.cpp
Show All 24 Lines | TestingSetup test_setup{ | ||||
"-nodebug", | "-nodebug", | ||||
}, | }, | ||||
}; | }; | ||||
const auto &ADDRESS_WATCHONLY = ADDRESS_ECREG_UNSPENDABLE; | const auto &ADDRESS_WATCHONLY = ADDRESS_ECREG_UNSPENDABLE; | ||||
const Config &config = GetConfig(); | const Config &config = GetConfig(); | ||||
NodeContext node; | CWallet wallet{test_setup.m_node.chain.get(), "", | ||||
std::unique_ptr<interfaces::Chain> chain = | CreateMockWalletDatabase()}; | ||||
interfaces::MakeChain(node, config.GetChainParams()); | |||||
CWallet wallet{chain.get(), "", CreateMockWalletDatabase()}; | |||||
{ | { | ||||
wallet.SetupLegacyScriptPubKeyMan(); | wallet.SetupLegacyScriptPubKeyMan(); | ||||
bool first_run; | bool first_run; | ||||
if (wallet.LoadWallet(first_run) != DBErrors::LOAD_OK) { | if (wallet.LoadWallet(first_run) != DBErrors::LOAD_OK) { | ||||
assert(false); | assert(false); | ||||
} | } | ||||
} | } | ||||
auto handler = chain->handleNotifications({&wallet, [](CWallet *) {}}); | auto handler = test_setup.m_node.chain->handleNotifications( | ||||
{&wallet, [](CWallet *) {}}); | |||||
const std::optional<std::string> address_mine{ | const std::optional<std::string> address_mine{ | ||||
add_mine ? std::optional<std::string>{getnewaddress(config, wallet)} | add_mine ? std::optional<std::string>{getnewaddress(config, wallet)} | ||||
: std::nullopt}; | : std::nullopt}; | ||||
if (add_watchonly) { | if (add_watchonly) { | ||||
importaddress(wallet, ADDRESS_WATCHONLY); | importaddress(wallet, ADDRESS_WATCHONLY); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |