Without this PR, BitcoinTestFramework.start_nodes()
, upon failing to establish RPC connections and calling stop_nodes()
, would end up attempting to call the stop()
-RPC, raising additional exceptions which made the shutdown less clean.
Since we now avoiding the additional exceptions which in some cases provided useful clues, we instead capture information about the original exceptions being triggered and ignored within TestNode.wait_for_rpc_connection()
. This means we now have the more informative:
AssertionError: [node 0] Unable to connect to bitcoind after 60s (ignored errors: {'missing_credentials': 1, 'OSError.ECONNREFUSED': 239}, latest error: ConnectionRefusedError(111, 'Connection refused'))
As long as the increased complexity and maintenance burden is low, exposing previously silenced exceptions in combination with having a cleaner shutdown clears the muddy waters for devs trying to figure out root causes.
Related: #30390