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

Function test_bitcoin_backend

tests/test_plugin.py:2117–2147  ·  view source on GitHub ↗

This tests interaction with the Bitcoin backend, but not specifically bcli

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

2115
2116
2117def test_bitcoin_backend(node_factory, bitcoind):
2118 """
2119 This tests interaction with the Bitcoin backend, but not specifically bcli
2120 """
2121 l1 = node_factory.get_node(start=False, options={"disable-plugin": "bcli"},
2122 may_fail=True)
2123
2124 # We don't start if we haven't all the required methods registered.
2125 plugin = os.path.join(os.getcwd(), "tests/plugins/bitcoin/part1.py")
2126 l1.daemon.opts["plugin"] = plugin
2127 l1.daemon.start(wait_for_initialized=False, stderr_redir=True)
2128 l1.daemon.wait_for_log("Missing a Bitcoin plugin command")
2129 # Will exit with failure code.
2130 assert l1.daemon.wait() == 1
2131 assert l1.daemon.is_in_stderr(r"Could not access the plugin for sendrawtransaction")
2132 # Now we should start if all the commands are registered, even if they
2133 # are registered by two distincts plugins.
2134 del l1.daemon.opts["plugin"]
2135 l1.daemon.opts["plugin-dir"] = os.path.join(os.getcwd(),
2136 "tests/plugins/bitcoin/")
2137 # (it fails when it tries to use them, so startup fails)
2138 l1.daemon.start(wait_for_initialized=False)
2139 l1.daemon.wait_for_log("All Bitcoin plugin commands registered")
2140 assert l1.daemon.wait() == 1
2141
2142 # But restarting with just bcli is ok
2143 del l1.daemon.opts["plugin-dir"]
2144 del l1.daemon.opts["disable-plugin"]
2145 l1.start()
2146 assert l1.daemon.is_in_log("bitcoin-cli initialized and connected to"
2147 " bitcoind")
2148
2149
2150def test_bitcoin_backend_gianttx(node_factory, bitcoind):

Callers

nothing calls this directly

Calls 7

joinMethod · 0.80
wait_for_logMethod · 0.80
is_in_stderrMethod · 0.80
is_in_logMethod · 0.80
get_nodeMethod · 0.45
startMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected