diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 1e27924dfdbc6..8560f7ff82888 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -172,7 +173,8 @@ static bool AppInit(NodeContext& node) // -server defaults to true for bitcoind but not for the GUI so do this here args.SoftSetBoolArg("-server", true); // Set this early so that parameter interactions go to console - InitLogging(args); + interfaces::Ipc* ipc = node.init->ipc(); + InitLogging(args, ipc ? ipc->logSuffix() : nullptr); InitParameterInteraction(args); if (!AppInitBasicSetup(args, node.exit_status)) { // InitError will have been called with detailed error, which ends up on console diff --git a/src/init.cpp b/src/init.cpp index d6c80d8f84d47..08631ed3216a3 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -830,9 +830,9 @@ void InitParameterInteraction(ArgsManager& args) * Note that this is called very early in the process lifetime, so you should be * careful about what global state you rely on here. */ -void InitLogging(const ArgsManager& args) +void InitLogging(const ArgsManager& args, const char* log_suffix) { - init::SetLoggingOptions(args); + init::SetLoggingOptions(args, log_suffix); init::LogPackageVersion(); } diff --git a/src/init.h b/src/init.h index 6d8a35d80ea0c..78e3c840189a1 100644 --- a/src/init.h +++ b/src/init.h @@ -33,7 +33,7 @@ bool ShutdownRequested(node::NodeContext& node); void Interrupt(node::NodeContext& node); void Shutdown(node::NodeContext& node); //!Initialize the logging infrastructure -void InitLogging(const ArgsManager& args); +void InitLogging(const ArgsManager& args, const char* log_suffix); //!Parameter interaction: change current parameters depending on various rules void InitParameterInteraction(ArgsManager& args); diff --git a/src/init/bitcoin-gui.cpp b/src/init/bitcoin-gui.cpp index 0f9c845037ace..821ecb43a0614 100644 --- a/src/init/bitcoin-gui.cpp +++ b/src/init/bitcoin-gui.cpp @@ -22,7 +22,7 @@ const char* EXE_NAME = "bitcoin-gui"; class BitcoinGuiInit : public interfaces::Init { public: - BitcoinGuiInit(const char* arg0) : m_ipc(interfaces::MakeIpc(EXE_NAME, arg0, *this)) + BitcoinGuiInit(const char* arg0) : m_ipc(interfaces::MakeIpc(EXE_NAME, ".gui", arg0, *this)) { ipc::capnp::SetupNodeClient(m_ipc->context()); } diff --git a/src/init/bitcoin-node.cpp b/src/init/bitcoin-node.cpp index 3fdffe5f41117..fc502a519b256 100644 --- a/src/init/bitcoin-node.cpp +++ b/src/init/bitcoin-node.cpp @@ -34,8 +34,7 @@ class BitcoinNodeInit : public interfaces::Init { public: BitcoinNodeInit(node::NodeContext& node, const char* arg0) - : m_node(node), - m_ipc(interfaces::MakeIpc(EXE_NAME, arg0, *this)) + : m_node(node), m_ipc(interfaces::MakeIpc(EXE_NAME, "", arg0, *this)) { InitContext(m_node); m_node.init = this; @@ -43,7 +42,7 @@ class BitcoinNodeInit : public interfaces::Init // spawned by a bitcoin-gui process, after the ArgsManager configuration // is transferred from the parent process to the child process. m_ipc->context().init_process = [this] { - InitLogging(*Assert(m_node.args)); + InitLogging(*Assert(m_node.args), m_ipc->logSuffix()); InitParameterInteraction(*Assert(m_node.args)); }; ipc::capnp::SetupNodeServer(m_ipc->context()); diff --git a/src/init/bitcoin-wallet-ipc.cpp b/src/init/bitcoin-wallet-ipc.cpp index 14112ca17bc1f..dad3649de271d 100644 --- a/src/init/bitcoin-wallet-ipc.cpp +++ b/src/init/bitcoin-wallet-ipc.cpp @@ -42,7 +42,7 @@ const char* EXE_NAME = "bitcoin-wallet"; class BitcoinWalletInit : public interfaces::Init { public: - BitcoinWalletInit(const char* arg0) : m_ipc(interfaces::MakeIpc(EXE_NAME, arg0, *this)) + BitcoinWalletInit(const char* arg0) : m_ipc(interfaces::MakeIpc(EXE_NAME, ".wallet", arg0, *this)) { // Extra initialization code that runs when a bitcoin-wallet process is // spawned by a bitcoin-node process, after the ArgsManager @@ -58,7 +58,7 @@ class BitcoinWalletInit : public interfaces::Init // util::Globals class that becomes a memberof kernel::Context m_kernel.emplace(); m_ecc_context.emplace(); - init::SetLoggingOptions(gArgs); + init::SetLoggingOptions(gArgs, m_ipc->logSuffix()); if (auto result = init::SetLoggingCategories(gArgs); !result) { throw std::runtime_error(util::ErrorString(result).original); } diff --git a/src/init/common.cpp b/src/init/common.cpp index 36142c2b9a018..9df9f7f18c094 100644 --- a/src/init/common.cpp +++ b/src/init/common.cpp @@ -41,10 +41,11 @@ void AddLoggingArgs(ArgsManager& argsman) argsman.AddArg("-shrinkdebugfile", "Shrink debug.log file on client startup (default: 1 when no -debug)", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); } -void SetLoggingOptions(const ArgsManager& args) +void SetLoggingOptions(const ArgsManager& args, const char* log_suffix) { LogInstance().m_print_to_file = !args.IsArgNegated("-debuglogfile"); LogInstance().m_file_path = AbsPathForConfigVal(args, args.GetPathArg("-debuglogfile", DEFAULT_DEBUGLOGFILE)); + if (log_suffix && LogInstance().m_file_path != "/dev/null") LogInstance().m_file_path += log_suffix; LogInstance().m_print_to_console = args.GetBoolArg("-printtoconsole", !args.GetBoolArg("-daemon", false)); LogInstance().m_log_timestamps = args.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS); LogInstance().m_log_time_micros = args.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS); diff --git a/src/init/common.h b/src/init/common.h index b61a77c6d4643..69e7694d665e1 100644 --- a/src/init/common.h +++ b/src/init/common.h @@ -14,7 +14,7 @@ class ArgsManager; namespace init { void AddLoggingArgs(ArgsManager& args); -void SetLoggingOptions(const ArgsManager& args); +void SetLoggingOptions(const ArgsManager& args, const char* log_suffix); [[nodiscard]] util::Result SetLoggingCategories(const ArgsManager& args); [[nodiscard]] util::Result SetLoggingLevel(const ArgsManager& args); bool StartLogging(const ArgsManager& args); diff --git a/src/interfaces/ipc.h b/src/interfaces/ipc.h index fb340552c5ca4..b3ca71e0c4220 100644 --- a/src/interfaces/ipc.h +++ b/src/interfaces/ipc.h @@ -81,6 +81,9 @@ class Ipc //! IPC context struct accessor (see struct definition for more description). virtual ipc::Context& context() = 0; + //! Suffix for debug.log to avoid output clashes from different processes. + virtual const char* logSuffix() = 0; + protected: //! Internal implementation of public addCleanup method (above) as a //! type-erased virtual function, since template functions can't be virtual. @@ -88,7 +91,7 @@ class Ipc }; //! Return implementation of Ipc interface. -std::unique_ptr MakeIpc(const char* exe_name, const char* process_argv0, Init& init); +std::unique_ptr MakeIpc(const char* exe_name, const char* log_suffix, const char* process_argv0, Init& init); } // namespace interfaces #endif // BITCOIN_INTERFACES_IPC_H diff --git a/src/ipc/interfaces.cpp b/src/ipc/interfaces.cpp index 33555f05d4ce0..f8d4a27337e8c 100644 --- a/src/ipc/interfaces.cpp +++ b/src/ipc/interfaces.cpp @@ -29,8 +29,8 @@ namespace { class IpcImpl : public interfaces::Ipc { public: - IpcImpl(const char* exe_name, const char* process_argv0, interfaces::Init& init) - : m_exe_name(exe_name), m_process_argv0(process_argv0), m_init(init), + IpcImpl(const char* exe_name, const char* log_suffix, const char* process_argv0, interfaces::Init& init) + : m_exe_name(exe_name), m_log_suffix(log_suffix), m_process_argv0(process_argv0), m_init(init), m_protocol(ipc::capnp::MakeCapnpProtocol()), m_process(ipc::MakeProcess()) { } @@ -91,7 +91,9 @@ class IpcImpl : public interfaces::Ipc m_protocol->addCleanup(type, iface, std::move(cleanup)); } Context& context() override { return m_protocol->context(); } + const char* logSuffix() override { return m_log_suffix; } const char* m_exe_name; + const char* m_log_suffix; const char* m_process_argv0; interfaces::Init& m_init; std::unique_ptr m_protocol; @@ -101,8 +103,8 @@ class IpcImpl : public interfaces::Ipc } // namespace ipc namespace interfaces { -std::unique_ptr MakeIpc(const char* exe_name, const char* process_argv0, Init& init) +std::unique_ptr MakeIpc(const char* exe_name, const char* log_suffix, const char* process_argv0, Init& init) { - return std::make_unique(exe_name, process_argv0, init); + return std::make_unique(exe_name, log_suffix, process_argv0, init); } } // namespace interfaces diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index 0deebf0fb6a43..faca556368d93 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include #include #include @@ -97,7 +99,11 @@ class NodeImpl : public Node { public: explicit NodeImpl(NodeContext& context) { setContext(&context); } - void initLogging() override { InitLogging(args()); } + void initLogging() override + { + interfaces::Ipc* ipc = m_context->init->ipc(); + InitLogging(args(), ipc ? ipc->logSuffix() : nullptr); + } void initParameterInteraction() override { InitParameterInteraction(args()); } bilingual_str getWarnings() override { return Join(Assert(m_context->warnings)->GetMessages(), Untranslated("
")); } int getExitStatus() override { return Assert(m_context)->exit_status.load(); } diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index f6945c04f02db..c7d92399b630d 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -327,13 +327,14 @@ void BitcoinApplication::startThread() connect(this, &BitcoinApplication::requestedShutdown, &m_executor.value(), &InitExecutor::shutdown); } -void BitcoinApplication::parameterSetup() +void BitcoinApplication::parameterSetup(interfaces::Init& init) { // Default printtoconsole to false for the GUI. GUI programs should not // print to the console unnecessarily. gArgs.SoftSetBoolArg("-printtoconsole", false); - InitLogging(gArgs); + interfaces::Ipc* ipc = init.ipc(); + InitLogging(gArgs, ipc ? ipc->logSuffix() : nullptr); InitParameterInteraction(gArgs); } @@ -673,7 +674,7 @@ int GuiMain(int argc, char* argv[]) // Install qDebug() message handler to route to debug.log qInstallMessageHandler(DebugMessageHandler); // Allow parameter interaction before we create the options model - app.parameterSetup(); + app.parameterSetup(*init); GUIUtil::LogQtInfo(); if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false)) diff --git a/src/qt/bitcoin.h b/src/qt/bitcoin.h index 1423a8bbc698f..1d2906c6f92fa 100644 --- a/src/qt/bitcoin.h +++ b/src/qt/bitcoin.h @@ -43,7 +43,7 @@ class BitcoinApplication: public QApplication void createPaymentServer(); #endif /// parameter interaction/setup based on rules - void parameterSetup(); + void parameterSetup(interfaces::Init& init); /// Create options model [[nodiscard]] bool createOptionsModel(bool resetSettings); /// Initialize prune setting diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp index 10abcb00eb816..200f719a70e60 100644 --- a/src/qt/test/apptests.cpp +++ b/src/qt/test/apptests.cpp @@ -52,7 +52,7 @@ void TestRpcCommand(RPCConsole* console) } // namespace //! Entry point for BitcoinApplication tests. -void AppTests::appTests() +void AppTests::appTests(interfaces::Init& init) { #ifdef Q_OS_MACOS if (QApplication::platformName() == "minimal") { @@ -67,7 +67,7 @@ void AppTests::appTests() #endif qRegisterMetaType("interfaces::BlockAndHeaderTipInfo"); - m_app.parameterSetup(); + m_app.parameterSetup(init); QVERIFY(m_app.createOptionsModel(/*resetSettings=*/true)); QScopedPointer style(NetworkStyle::instantiate(Params().GetChainType())); m_app.setupPlatformStyle(); diff --git a/src/qt/test/apptests.h b/src/qt/test/apptests.h index f0a555005d20d..deab018ccbd9e 100644 --- a/src/qt/test/apptests.h +++ b/src/qt/test/apptests.h @@ -14,6 +14,10 @@ class BitcoinApplication; class BitcoinGUI; class RPCConsole; +namespace interfaces { +class Init; +} // namespace interfaces + class AppTests : public QObject { Q_OBJECT @@ -21,7 +25,7 @@ class AppTests : public QObject explicit AppTests(BitcoinApplication& app) : m_app(app) {} private Q_SLOTS: - void appTests(); + void appTests(interfaces::Init& init); void guiTests(BitcoinGUI* window); void consoleTests(RPCConsole* console); diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index fa89ceb332af2..255b4c647df85 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -172,7 +172,7 @@ BasicTestingSetup::BasicTestingSetup(const ChainType chainType, TestOpts opts) SelectParams(chainType); if (G_TEST_LOG_FUN) LogInstance().PushBackCallback(G_TEST_LOG_FUN); - InitLogging(*m_node.args); + InitLogging(*m_node.args, /* log_suffix= */ nullptr); AppInitParameterInteraction(*m_node.args); LogInstance().StartLogging(); m_node.warnings = std::make_unique(); diff --git a/test/functional/combine_logs.py b/test/functional/combine_logs.py index 33c81bde13180..eac93a61064f7 100755 --- a/test/functional/combine_logs.py +++ b/test/functional/combine_logs.py @@ -95,6 +95,10 @@ def read_logs(tmp_dir): break files.append(("node%d" % i, logfile)) + wallet_logfile = "{}/node{}/regtest/debug.log.wallet".format(tmp_dir, i) + if os.path.isfile(wallet_logfile): + files.append(("wall%d" % i, wallet_logfile)) + return heapq.merge(*[get_log_events(source, f) for source, f in files]) diff --git a/test/functional/feature_posix_fs_permissions.py b/test/functional/feature_posix_fs_permissions.py index 28b1803891362..aa66090efbf67 100755 --- a/test/functional/feature_posix_fs_permissions.py +++ b/test/functional/feature_posix_fs_permissions.py @@ -35,7 +35,7 @@ def run_test(self): self.check_directory_permissions(datadir) walletsdir = self.nodes[0].wallets_path self.check_directory_permissions(walletsdir) - debuglog = self.nodes[0].debug_log_path + debuglog = self.nodes[0].debug_log_path(wallet=False) self.check_file_permissions(debuglog) diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 697bd819dce07..7e88265482f7e 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -463,9 +463,13 @@ def replace_in_config(self, replacements): def chain_path(self) -> Path: return self.datadir_path / self.chain - @property - def debug_log_path(self) -> Path: - return self.chain_path / 'debug.log' + def debug_log_path(self, wallet: bool) -> Path: + path = self.chain_path / 'debug.log' + if wallet: + wallet_path = path.with_name(path.name + ".wallet") + if wallet_path.exists(): + path = wallet_path + return path @property def blocks_path(self) -> Path: @@ -483,26 +487,26 @@ def read_xor_key(self) -> bytes: def wallets_path(self) -> Path: return self.chain_path / "wallets" - def debug_log_size(self, **kwargs) -> int: - with open(self.debug_log_path, **kwargs) as dl: + def debug_log_size(self, wallet: bool, **kwargs) -> int: + with open(self.debug_log_path(wallet), **kwargs) as dl: dl.seek(0, 2) return dl.tell() @contextlib.contextmanager - def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2): + def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2, wallet=False): if unexpected_msgs is None: unexpected_msgs = [] assert_equal(type(expected_msgs), list) assert_equal(type(unexpected_msgs), list) time_end = time.time() + timeout * self.timeout_factor - prev_size = self.debug_log_size(encoding="utf-8") # Must use same encoding that is used to read() below + prev_size = self.debug_log_size(wallet, encoding="utf-8") # Must use same encoding that is used to read() below yield while True: found = True - with open(self.debug_log_path, encoding="utf-8", errors="replace") as dl: + with open(self.debug_log_path(wallet), encoding="utf-8", errors="replace") as dl: dl.seek(prev_size) log = dl.read() print_log = " - " + "\n - ".join(log.splitlines()) @@ -520,20 +524,20 @@ def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2): self._raise_assertion_error('Expected messages "{}" does not partially match log:\n\n{}\n\n'.format(str(expected_msgs), print_log)) @contextlib.contextmanager - def busy_wait_for_debug_log(self, expected_msgs, timeout=60): + def busy_wait_for_debug_log(self, expected_msgs, timeout=60, wallet=False): """ Block until we see a particular debug log message fragment or until we exceed the timeout. Return: the number of log lines we encountered when matching """ time_end = time.time() + timeout * self.timeout_factor - prev_size = self.debug_log_size(mode="rb") # Must use same mode that is used to read() below + prev_size = self.debug_log_size(wallet, mode="rb") # Must use same mode that is used to read() below yield while True: found = True - with open(self.debug_log_path, "rb") as dl: + with open(self.debug_log_path(wallet), "rb") as dl: dl.seek(prev_size) log = dl.read() diff --git a/test/functional/wallet_dump.py b/test/functional/wallet_dump.py index 3a4f23a124538..74f9de41703fb 100755 --- a/test/functional/wallet_dump.py +++ b/test/functional/wallet_dump.py @@ -209,7 +209,7 @@ def run_test(self): assert result['ismine'] self.log.info('Check that wallet is flushed') - with self.nodes[0].assert_debug_log(['Flushing wallet.dat'], timeout=20): + with self.nodes[0].assert_debug_log(['Flushing wallet.dat'], timeout=20, wallet=True): self.nodes[0].getnewaddress() # Make sure that dumpwallet doesn't have a lock order issue when there is an unconfirmed tx and it is reloaded diff --git a/test/functional/wallet_fast_rescan.py b/test/functional/wallet_fast_rescan.py index 4ac441516e5f6..d78fe9a4ff6de 100755 --- a/test/functional/wallet_fast_rescan.py +++ b/test/functional/wallet_fast_rescan.py @@ -65,26 +65,26 @@ def run_test(self): self.generate(node, 1) self.log.info("Import wallet backup with block filter index") - with node.assert_debug_log(['fast variant using block filters']): + with node.assert_debug_log(['fast variant using block filters'], wallet=True): node.restorewallet('rescan_fast', WALLET_BACKUP_FILENAME) txids_fast = self.get_wallet_txids(node, 'rescan_fast') self.log.info("Import non-active descriptors with block filter index") node.createwallet(wallet_name='rescan_fast_nonactive', descriptors=True, disable_private_keys=True, blank=True) - with node.assert_debug_log(['fast variant using block filters']): + with node.assert_debug_log(['fast variant using block filters'], wallet=True): w = node.get_wallet_rpc('rescan_fast_nonactive') w.importdescriptors([{"desc": descriptor['desc'], "timestamp": 0} for descriptor in descriptors]) txids_fast_nonactive = self.get_wallet_txids(node, 'rescan_fast_nonactive') self.restart_node(0, [f'-keypool={KEYPOOL_SIZE}', '-blockfilterindex=0']) self.log.info("Import wallet backup w/o block filter index") - with node.assert_debug_log(['slow variant inspecting all blocks']): + with node.assert_debug_log(['slow variant inspecting all blocks'], wallet=True): node.restorewallet("rescan_slow", WALLET_BACKUP_FILENAME) txids_slow = self.get_wallet_txids(node, 'rescan_slow') self.log.info("Import non-active descriptors w/o block filter index") node.createwallet(wallet_name='rescan_slow_nonactive', descriptors=True, disable_private_keys=True, blank=True) - with node.assert_debug_log(['slow variant inspecting all blocks']): + with node.assert_debug_log(['slow variant inspecting all blocks'], wallet=True): w = node.get_wallet_rpc('rescan_slow_nonactive') w.importdescriptors([{"desc": descriptor['desc'], "timestamp": 0} for descriptor in descriptors]) txids_slow_nonactive = self.get_wallet_txids(node, 'rescan_slow_nonactive') diff --git a/test/functional/wallet_groups.py b/test/functional/wallet_groups.py index 8d6c96c0e004c..241662311a6a9 100755 --- a/test/functional/wallet_groups.py +++ b/test/functional/wallet_groups.py @@ -127,7 +127,7 @@ def run_test(self): self.nodes[0].sendtoaddress(addr_aps, 1.0) self.nodes[0].sendtoaddress(addr_aps, 1.0) self.generate(self.nodes[0], 1) - with self.nodes[3].assert_debug_log([f'Fee non-grouped = {tx4_ungrouped_fee}, grouped = {tx4_grouped_fee}, using grouped']): + with self.nodes[3].assert_debug_log([f'Fee non-grouped = {tx4_ungrouped_fee}, grouped = {tx4_grouped_fee}, using grouped'], wallet=True): txid4 = self.nodes[3].sendtoaddress(self.nodes[0].getnewaddress(), 0.1) tx4 = self.nodes[3].getrawtransaction(txid4, True) # tx4 should have 2 inputs and 2 outputs although one output would @@ -138,7 +138,7 @@ def run_test(self): addr_aps2 = self.nodes[3].getnewaddress() [self.nodes[0].sendtoaddress(addr_aps2, 1.0) for _ in range(5)] self.generate(self.nodes[0], 1) - with self.nodes[3].assert_debug_log([f'Fee non-grouped = {tx5_6_ungrouped_fee}, grouped = {tx5_6_grouped_fee}, using non-grouped']): + with self.nodes[3].assert_debug_log([f'Fee non-grouped = {tx5_6_ungrouped_fee}, grouped = {tx5_6_grouped_fee}, using non-grouped'], wallet=True): txid5 = self.nodes[3].sendtoaddress(self.nodes[0].getnewaddress(), 2.95) tx5 = self.nodes[3].getrawtransaction(txid5, True) # tx5 should have 3 inputs (1.0, 1.0, 1.0) and 2 outputs @@ -151,7 +151,7 @@ def run_test(self): addr_aps3 = self.nodes[4].getnewaddress() [self.nodes[0].sendtoaddress(addr_aps3, 1.0) for _ in range(5)] self.generate(self.nodes[0], 1) - with self.nodes[4].assert_debug_log([f'Fee non-grouped = {tx5_6_ungrouped_fee}, grouped = {tx5_6_grouped_fee}, using grouped']): + with self.nodes[4].assert_debug_log([f'Fee non-grouped = {tx5_6_ungrouped_fee}, grouped = {tx5_6_grouped_fee}, using grouped'], wallet=True): txid6 = self.nodes[4].sendtoaddress(self.nodes[0].getnewaddress(), 2.95) tx6 = self.nodes[4].getrawtransaction(txid6, True) # tx6 should have 5 inputs and 2 outputs diff --git a/test/functional/wallet_importdescriptors.py b/test/functional/wallet_importdescriptors.py index 84c07b6a282aa..683550d845fc9 100755 --- a/test/functional/wallet_importdescriptors.py +++ b/test/functional/wallet_importdescriptors.py @@ -689,7 +689,7 @@ def run_test(self): encrypted_wallet.walletpassphrase("passphrase", 99999) with concurrent.futures.ThreadPoolExecutor(max_workers=1) as thread: - with self.nodes[0].assert_debug_log(expected_msgs=["Rescan started from block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206... (slow variant inspecting all blocks)"], timeout=10): + with self.nodes[0].assert_debug_log(expected_msgs=["Rescan started from block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206... (slow variant inspecting all blocks)"], timeout=10, wallet=True): importing = thread.submit(encrypted_wallet.importdescriptors, requests=[descriptor]) # Set the passphrase timeout to 1 to test that the wallet remains unlocked during the rescan diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py index 156f4279b4381..82fdea2a334a7 100755 --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -132,7 +132,7 @@ def wallet_file(name): os.mkdir(wallet_dir('no_access')) os.chmod(wallet_dir('no_access'), 0) try: - with self.nodes[0].assert_debug_log(expected_msgs=['Error scanning']): + with self.nodes[0].assert_debug_log(expected_msgs=['Error scanning'], wallet=True): walletlist = self.nodes[0].listwalletdir()['wallets'] finally: # Need to ensure access is restored for cleanup diff --git a/test/functional/wallet_resendwallettransactions.py b/test/functional/wallet_resendwallettransactions.py index 49c8ef1c5fe45..386620d697325 100755 --- a/test/functional/wallet_resendwallettransactions.py +++ b/test/functional/wallet_resendwallettransactions.py @@ -72,7 +72,7 @@ def run_test(self): self.log.info("Bump time & check that transaction is rebroadcast") # Transaction should be rebroadcast approximately 24 hours in the future, # but can range from 12-36. So bump 36 hours to be sure. - with node.assert_debug_log(['resubmit 1 unconfirmed transactions']): + with node.assert_debug_log(['resubmit 1 unconfirmed transactions'], wallet=True): node.setmocktime(now + 36 * 60 * 60) # Tell scheduler to call MaybeResendWalletTxs now. node.mockscheduler(60) @@ -130,7 +130,7 @@ def run_test(self): evict_time = block_time + 60 * 60 * DEFAULT_MEMPOOL_EXPIRY_HOURS + 5 # Flush out currently scheduled resubmit attempt now so that there can't be one right between eviction and check. - with node.assert_debug_log(['resubmit 2 unconfirmed transactions']): + with node.assert_debug_log(['resubmit 2 unconfirmed transactions'], wallet=True): node.setmocktime(evict_time) node.mockscheduler(60) @@ -141,7 +141,7 @@ def run_test(self): assert_raises_rpc_error(-5, "Transaction not in mempool", node.getmempoolentry, child_txid) # Rebroadcast and check that parent and child are both in the mempool - with node.assert_debug_log(['resubmit 2 unconfirmed transactions']): + with node.assert_debug_log(['resubmit 2 unconfirmed transactions'], wallet=True): node.setmocktime(evict_time + 36 * 60 * 60) # 36 hrs is the upper limit of the resend timer node.mockscheduler(60) node.getmempoolentry(txid) diff --git a/test/functional/wallet_transactiontime_rescan.py b/test/functional/wallet_transactiontime_rescan.py index 102eda32e0edb..b5a7db75a7e88 100755 --- a/test/functional/wallet_transactiontime_rescan.py +++ b/test/functional/wallet_transactiontime_rescan.py @@ -203,7 +203,7 @@ def run_test(self): encrypted_wallet.sethdseed(seed=hd_seed) with concurrent.futures.ThreadPoolExecutor(max_workers=1) as thread: - with minernode.assert_debug_log(expected_msgs=["Rescan started from block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206... (slow variant inspecting all blocks)"], timeout=5): + with minernode.assert_debug_log(expected_msgs=["Rescan started from block 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206... (slow variant inspecting all blocks)"], timeout=5, wallet=True): rescanning = thread.submit(encrypted_wallet.rescanblockchain) # set the passphrase timeout to 1 to test that the wallet remains unlocked during the rescan