diff --git a/sauron/requirements.txt b/sauron/requirements.txt index 7fd22f35e..1794cb833 100644 --- a/sauron/requirements.txt +++ b/sauron/requirements.txt @@ -1,2 +1,2 @@ -pyln-client>=23.2,<=24.5 +pyln-client>=23.2 requests[socks]>=2.23.0 diff --git a/sauron/tests/test_sauron_esplora_bitcoin.py b/sauron/tests/test_sauron_esplora_bitcoin.py index 2a00347cb..5b8137b2e 100644 --- a/sauron/tests/test_sauron_esplora_bitcoin.py +++ b/sauron/tests/test_sauron_esplora_bitcoin.py @@ -1,7 +1,6 @@ #!/usr/bin/python import os - import pyln import pytest from pyln.testing import utils @@ -10,20 +9,29 @@ pyln.testing.fixtures.network_daemons["bitcoin"] = utils.BitcoinD - class LightningNode(utils.LightningNode): def __init__(self, *args, **kwargs): pyln.testing.utils.TEST_NETWORK = "bitcoin" utils.LightningNode.__init__(self, *args, **kwargs) lightning_dir = args[1] - self.daemon = LightningD(lightning_dir, None, port=self.daemon.port) # noqa: F405 - options = { - "disable-plugin": "bcli", + old_opts = self.daemon.opts + self.daemon = LightningD(lightning_dir, None) # noqa: F405 + new_opts = { + "disable-plugin": ["bcli"], "network": "bitcoin", "plugin": os.path.join(os.path.dirname(__file__), "../sauron.py"), "sauron-api-endpoint": "https://blockstream.info/api", } - self.daemon.opts.update(options) + self.daemon.opts.update(old_opts) + self.daemon.opts.update(new_opts) + opts_to_disable = [ + "bitcoin-datadir", + "bitcoin-rpcpassword", + "bitcoin-rpcuser", + "dev-bitcoind-poll", + ] + for opt in opts_to_disable: + self.daemon.opts.pop(opt) # Monkey patch def set_feerates(self, feerates, wait_for_effect=True): @@ -36,7 +44,7 @@ def node_cls(monkeypatch): yield LightningNode -def test_rpc_getchaininfo(node_factory): +def test_esplora_bitcoin_getchaininfo(node_factory): """ Test getchaininfo """ @@ -52,7 +60,7 @@ def test_rpc_getchaininfo(node_factory): assert not response["ibd"] -def test_rpc_getrawblockbyheight(node_factory): +def test_esplora_bitcoin_getrawblockbyheight(node_factory): """ Test getrawblockbyheight """ @@ -67,7 +75,7 @@ def test_rpc_getrawblockbyheight(node_factory): assert response == expected_response @pytest.mark.skip(reason="testing_theory") -def test_rpc_sendrawtransaction_invalid(node_factory): +def test_esplora_bitcoin_sendrawtransaction_invalid(node_factory): """ Test sendrawtransaction """ @@ -85,7 +93,7 @@ def test_rpc_sendrawtransaction_invalid(node_factory): assert response == expected_response -def test_rpc_getutxout(node_factory): +def test_esplora_bitcoin_getutxout(node_factory): """ Test getutxout """ @@ -106,7 +114,7 @@ def test_rpc_getutxout(node_factory): assert response == expected_response -def test_rpc_estimatefees(node_factory): +def test_esplora_bitcoin_estimatefees(node_factory): """ Test estimatefees """ diff --git a/sauron/tests/test_sauron_esplora_signet.py b/sauron/tests/test_sauron_esplora_signet.py index cdab34641..6c7ab5e16 100644 --- a/sauron/tests/test_sauron_esplora_signet.py +++ b/sauron/tests/test_sauron_esplora_signet.py @@ -1,7 +1,6 @@ #!/usr/bin/python import os - import pyln import pytest from pyln.testing import utils @@ -10,20 +9,29 @@ pyln.testing.fixtures.network_daemons["signet"] = utils.BitcoinD - class LightningNode(utils.LightningNode): def __init__(self, *args, **kwargs): pyln.testing.utils.TEST_NETWORK = "signet" utils.LightningNode.__init__(self, *args, **kwargs) lightning_dir = args[1] - self.daemon = LightningD(lightning_dir, None, port=self.daemon.port) # noqa: F405 - options = { - "disable-plugin": "bcli", + old_opts = self.daemon.opts + self.daemon = LightningD(lightning_dir, None) # noqa: F405 + new_opts = { + "disable-plugin": ["bcli"], "network": "signet", "plugin": os.path.join(os.path.dirname(__file__), "../sauron.py"), "sauron-api-endpoint": "https://blockstream.info/signet/api", } - self.daemon.opts.update(options) + self.daemon.opts.update(old_opts) + self.daemon.opts.update(new_opts) + opts_to_disable = [ + "bitcoin-datadir", + "bitcoin-rpcpassword", + "bitcoin-rpcuser", + "dev-bitcoind-poll", + ] + for opt in opts_to_disable: + self.daemon.opts.pop(opt) # Monkey patch def set_feerates(self, feerates, wait_for_effect=True): @@ -36,7 +44,7 @@ def node_cls(monkeypatch): yield LightningNode -def test_rpc_getchaininfo(node_factory): +def test_esplora_signet_getchaininfo(node_factory): """ Test getchaininfo """ @@ -52,7 +60,7 @@ def test_rpc_getchaininfo(node_factory): assert not response["ibd"] -def test_rpc_getrawblockbyheight(node_factory): +def test_esplora_signet_getrawblockbyheight(node_factory): """ Test getrawblockbyheight """ @@ -67,7 +75,7 @@ def test_rpc_getrawblockbyheight(node_factory): assert response == expected_response @pytest.mark.skip(reason="testing_theory") -def test_rpc_sendrawtransaction_invalid(node_factory): +def test_esplora_signet_sendrawtransaction_invalid(node_factory): """ Test sendrawtransaction """ @@ -84,7 +92,7 @@ def test_rpc_sendrawtransaction_invalid(node_factory): assert response.get("success") is False, "Expected success to be False" -def test_rpc_getutxout(node_factory): +def test_esplora_signet_getutxout(node_factory): """ Test getutxout """ @@ -105,7 +113,7 @@ def test_rpc_getutxout(node_factory): assert response == expected_response -def test_rpc_estimatefees(node_factory): +def test_esplora_signet_estimatefees(node_factory): """ Test estimatefees """ diff --git a/sauron/tests/test_sauron_esplora_testnet.py b/sauron/tests/test_sauron_esplora_testnet.py index 2ae617d24..2aab29a04 100644 --- a/sauron/tests/test_sauron_esplora_testnet.py +++ b/sauron/tests/test_sauron_esplora_testnet.py @@ -1,29 +1,36 @@ #!/usr/bin/python import os - import pyln -import pytest from pyln.testing import utils from pyln.testing.fixtures import * # noqa: F403 from util import LightningD pyln.testing.fixtures.network_daemons["testnet"] = utils.BitcoinD - class LightningNode(utils.LightningNode): def __init__(self, *args, **kwargs): pyln.testing.utils.TEST_NETWORK = "testnet" utils.LightningNode.__init__(self, *args, **kwargs) lightning_dir = args[1] - self.daemon = LightningD(lightning_dir, None, port=self.daemon.port) # noqa: F405 - options = { - "disable-plugin": "bcli", + old_opts = self.daemon.opts + self.daemon = LightningD(lightning_dir, None) # noqa: F405 + new_opts = { + "disable-plugin": ["bcli"], "network": "testnet", "plugin": os.path.join(os.path.dirname(__file__), "../sauron.py"), "sauron-api-endpoint": "https://blockstream.info/testnet/api", } - self.daemon.opts.update(options) + self.daemon.opts.update(old_opts) + self.daemon.opts.update(new_opts) + opts_to_disable = [ + "bitcoin-datadir", + "bitcoin-rpcpassword", + "bitcoin-rpcuser", + "dev-bitcoind-poll", + ] + for opt in opts_to_disable: + self.daemon.opts.pop(opt) # Monkey patch def set_feerates(self, feerates, wait_for_effect=True): @@ -36,7 +43,7 @@ def node_cls(monkeypatch): yield LightningNode -def test_rpc_getchaininfo(node_factory): +def test_esplora_testnet_getchaininfo(node_factory): """ Test getchaininfo """ @@ -52,7 +59,7 @@ def test_rpc_getchaininfo(node_factory): assert not response["ibd"] -def test_rpc_getrawblockbyheight(node_factory): +def test_esplora_testnet_getrawblockbyheight(node_factory): """ Test getrawblockbyheight """ @@ -67,7 +74,7 @@ def test_rpc_getrawblockbyheight(node_factory): assert response == expected_response @pytest.mark.skip(reason="testing_theory") -def test_rpc_sendrawtransaction_invalid(node_factory): +def test_esplora_testnet_sendrawtransaction_invalid(node_factory): """ Test sendrawtransaction """ @@ -84,7 +91,7 @@ def test_rpc_sendrawtransaction_invalid(node_factory): assert response.get("success") is False, "Expected success to be False" -def test_rpc_getutxout(node_factory): +def test_esplora_testnet_getutxout(node_factory): """ Test getutxout """ @@ -105,7 +112,7 @@ def test_rpc_getutxout(node_factory): assert response == expected_response -def test_rpc_estimatefees(node_factory): +def test_esplora_testnet_estimatefees(node_factory): """ Test estimatefees """ diff --git a/sauron/tests/test_sauron_esplora_tor_proxy.py b/sauron/tests/test_sauron_esplora_tor_proxy.py index 9c0bd60ff..ffdf95a48 100644 --- a/sauron/tests/test_sauron_esplora_tor_proxy.py +++ b/sauron/tests/test_sauron_esplora_tor_proxy.py @@ -1,7 +1,6 @@ #!/usr/bin/python import os - import pyln import pytest from pyln.testing import utils @@ -10,21 +9,30 @@ pyln.testing.fixtures.network_daemons["bitcoin"] = utils.BitcoinD - class LightningNode(utils.LightningNode): def __init__(self, *args, **kwargs): pyln.testing.utils.TEST_NETWORK = "bitcoin" utils.LightningNode.__init__(self, *args, **kwargs) lightning_dir = args[1] - self.daemon = LightningD(lightning_dir, None, port=self.daemon.port) # noqa: F405 - options = { - "disable-plugin": "bcli", + old_opts = self.daemon.opts + self.daemon = LightningD(lightning_dir, None) # noqa: F405 + new_opts = { + "disable-plugin": ["bcli"], "network": "bitcoin", "plugin": os.path.join(os.path.dirname(__file__), "../sauron.py"), "sauron-api-endpoint": "https://blockstream.info/api", "sauron-tor-proxy": "localhost:9050", } - self.daemon.opts.update(options) + self.daemon.opts.update(old_opts) + self.daemon.opts.update(new_opts) + opts_to_disable = [ + "bitcoin-datadir", + "bitcoin-rpcpassword", + "bitcoin-rpcuser", + "dev-bitcoind-poll", + ] + for opt in opts_to_disable: + self.daemon.opts.pop(opt) # Monkey patch def set_feerates(self, feerates, wait_for_effect=True): diff --git a/sauron/tests/test_sauron_mempoolspace_signet.py b/sauron/tests/test_sauron_mempoolspace_signet.py index 06c6080f9..8502b874f 100644 --- a/sauron/tests/test_sauron_mempoolspace_signet.py +++ b/sauron/tests/test_sauron_mempoolspace_signet.py @@ -1,7 +1,6 @@ #!/usr/bin/python import os - import pyln import pytest from pyln.testing import utils @@ -10,33 +9,41 @@ pyln.testing.fixtures.network_daemons["signet"] = utils.BitcoinD - class LightningNode(utils.LightningNode): def __init__(self, *args, **kwargs): pyln.testing.utils.TEST_NETWORK = "signet" utils.LightningNode.__init__(self, *args, **kwargs) lightning_dir = args[1] - self.daemon = LightningD(lightning_dir, None, port=self.daemon.port) # noqa: F405 - options = { - "disable-plugin": "bcli", + old_opts = self.daemon.opts + self.daemon = LightningD(lightning_dir, None) # noqa: F405 + new_opts = { + "disable-plugin": ["bcli"], "network": "signet", "plugin": os.path.join(os.path.dirname(__file__), "../sauron.py"), "sauron-api-endpoint": "https://mutinynet.com/api", } - self.daemon.opts.update(options) + self.daemon.opts.update(old_opts) + self.daemon.opts.update(new_opts) + opts_to_disable = [ + "bitcoin-datadir", + "bitcoin-rpcpassword", + "bitcoin-rpcuser", + "dev-bitcoind-poll", + ] + for opt in opts_to_disable: + self.daemon.opts.pop(opt) # Monkey patch def set_feerates(self, feerates, wait_for_effect=True): return None - @pytest.fixture def node_cls(monkeypatch): monkeypatch.setenv("TEST_NETWORK", "signet") yield LightningNode -def test_rpc_getchaininfo(node_factory): +def test_mempoolspace_signet_getchaininfo(node_factory): """ Test getchaininfo """ @@ -52,7 +59,7 @@ def test_rpc_getchaininfo(node_factory): assert not response["ibd"] -def test_rpc_getrawblockbyheight(node_factory): +def test_mempoolspace_signet_getrawblockbyheight(node_factory): """ Test getrawblockbyheight """ @@ -67,7 +74,7 @@ def test_rpc_getrawblockbyheight(node_factory): assert response == expected_response @pytest.mark.skip(reason="testing_theory") -def test_rpc_sendrawtransaction_invalid(node_factory): +def test_mempoolspace_signet_sendrawtransaction_invalid(node_factory): """ Test sendrawtransaction """ @@ -85,7 +92,7 @@ def test_rpc_sendrawtransaction_invalid(node_factory): assert response == expected_response -def test_rpc_getutxout(node_factory): +def test_mempoolspace_signet_getutxout(node_factory): """ Test getutxout """ @@ -106,7 +113,7 @@ def test_rpc_getutxout(node_factory): assert response == expected_response -def test_rpc_estimatefees(node_factory): +def test_mempoolspace_signet_estimatefees(node_factory): """ Test estimatefees """ diff --git a/sauron/tests/util.py b/sauron/tests/util.py index f060aa844..808141eac 100644 --- a/sauron/tests/util.py +++ b/sauron/tests/util.py @@ -4,18 +4,6 @@ class LightningD(utils.LightningD): - def __init__(self, lightning_dir, *args, **kwargs): - super().__init__(lightning_dir, *args, **kwargs) - - opts_to_disable = [ - "bitcoin-datadir", - "bitcoin-rpcpassword", - "bitcoin-rpcuser", - "dev-bitcoind-poll", - ] - for opt in opts_to_disable: - self.opts.pop(opt) - # Monkey patch def start(self, stdin=None, wait_for_initialized=True, stderr_redir=False): utils.TailableProc.start(