Make sure we handle spurious bitcoin-cli failures during startup See [#2687](https://github.com/ElementsProject/lightning/issues/2687) for details
(node_factory, bitcoind)
| 2267 | |
| 2268 | |
| 2269 | def 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") |
nothing calls this directly
no test coverage detected