MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_bitcoind_fail_first

Function test_bitcoind_fail_first

tests/test_misc.py:2269–2288  ·  view source on GitHub ↗

Make sure we handle spurious bitcoin-cli failures during startup See [#2687](https://github.com/ElementsProject/lightning/issues/2687) for details

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

2267
2268
2269def test_bitcoind_fail_first(node_factory, bitcoind):
2270 """Make sure we handle spurious bitcoin-cli failures during startup
2271
2272 See [#2687](https://github.com/ElementsProject/lightning/issues/2687) for
2273 details
2274
2275 """
2276 # Do not start the lightning node since we need to instrument bitcoind
2277 # first.
2278 l1 = node_factory.get_node(start=False, may_fail=True)
2279
2280 # Instrument bitcoind to fail some queries first.
2281 def crash_bitcoincli(r):
2282 return {'id': r['id'], 'result': 'not_a_valid_blockhash', 'error': None}
2283
2284 l1.daemon.rpcproxy.mock_rpc('getblockhash', crash_bitcoincli)
2285 l1.daemon.start(wait_for_initialized=False, stderr_redir=True)
2286
2287 assert l1.daemon.wait() == 1
2288 assert l1.daemon.is_in_stderr('bad response to getrawblockbyheight')
2289
2290
2291@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "Fees on elements are different")

Callers

nothing calls this directly

Calls 5

mock_rpcMethod · 0.80
is_in_stderrMethod · 0.80
get_nodeMethod · 0.45
startMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected