From f5cae3b4035ece57a1a2a69bac0c0aef07ee6eb5 Mon Sep 17 00:00:00 2001 From: Duke Date: Fri, 13 Sep 2024 04:37:48 -0400 Subject: [PATCH] getinfo rpc needs a cs_wallet lock Without it we get an AssertLockHeld when calling GetKeyPoolSize . We could probably make this lock apply to less code, possibly only the single line that calls GetKeyPoolSize() needs it. --- src/rpc/misc.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index f70f60f79..97ed6348e 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -231,11 +231,12 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk) + HelpExampleCli("getinfo", "") + HelpExampleRpc("getinfo", "") ); - //#ifdef ENABLE_WALLET - // LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); - //#else + +#ifdef ENABLE_WALLET + LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); +#else LOCK(cs_main); - //#endif +#endif proxyType proxy; GetProxy(NET_IPV4, proxy);