http: Avoid crash when g_thread_http was never started

g_thread_http can not be joined when it is not joinable. Avoid crashing
the node by adding the required check and add a test.
This commit is contained in:
MarcoFalke
2020-05-18 09:17:28 -04:00
parent fa12a37b27
commit faf45d1f1f
2 changed files with 11 additions and 3 deletions

View File

@@ -99,5 +99,13 @@ class HTTPBasicsTest(BitcoinTestFramework):
self.test_auth(self.nodes[1], self.rpcuser, self.rpcpassword)
self.log.info('Check that failure to write cookie file will abort the node gracefully')
self.stop_node(0)
cookie_file = os.path.join(get_datadir_path(self.options.tmpdir, 0), self.chain, '.cookie.tmp')
os.mkdir(cookie_file)
init_error = 'Error: Unable to start HTTP server. See debug log for details.'
self.nodes[0].assert_start_raises_init_error(expected_msg=init_error)
if __name__ == '__main__':
HTTPBasicsTest().main()