Skip to content

Commit

Permalink
fix: runner_features added
Browse files Browse the repository at this point in the history
  • Loading branch information
Psycho-Pirate committed Jun 20, 2023
1 parent e51fb97 commit 1c0032d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
1 change: 1 addition & 0 deletions lnprototest/clightning/clightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
Conn,
namespace,
MustNotMsg,
bitfield,
)
from lnprototest import wait_for
from typing import Dict, Any, Callable, List, Optional, cast
Expand Down
10 changes: 10 additions & 0 deletions lnprototest/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ def teardown(self):
and it is used to clean up the root dir where the tests are run."""
shutil.rmtree(self.directory)

def runner_features(
self,
additional_features: Optional[List[int]] = None,
field_name: Optional[str] = None,
) -> str:
"""
Provide the features required by the node.
"""
return ""

@abstractmethod
def is_running(self) -> bool:
"""Return a boolean value that tells whether the runner is running
Expand Down
18 changes: 15 additions & 3 deletions tests/test_bolt2-01-close_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ def test_close_channel_shutdown_msg_normal_case_receiver_side(runner: Runner) ->
# the option that the helper method feels for us
test_opts = {}
pre_events_conn = connect_to_node_helper(
runner, tx_spendable=tx_spendable, conn_privkey="03"
runner=runner,
tx_spendable=tx_spendable,
conn_privkey="03",
global_features=runner.runner_features(field_name="global_features"),
features=runner.runner_features(field_name="features"),
)
pre_events = open_and_announce_channel_helper(
runner, conn_privkey="03", opts=test_opts
Expand Down Expand Up @@ -105,7 +109,11 @@ def test_close_channel_shutdown_msg_normal_case_sender_side(runner: Runner) -> N
# the option that the helper method feels for us
test_opts = {}
pre_events_conn = connect_to_node_helper(
runner, tx_spendable=tx_spendable, conn_privkey="03"
runner=runner,
tx_spendable=tx_spendable,
conn_privkey="03",
global_features=runner.runner_features(field_name="global_features"),
features=runner.runner_features(field_name="features"),
)
pre_events = open_and_announce_channel_helper(
runner, conn_privkey="03", opts=test_opts
Expand Down Expand Up @@ -140,7 +148,11 @@ def test_close_channel_shutdown_msg_wrong_script_pubkey_receiver_side(
# the option that the helper method feels for us
test_opts = {}
pre_events_conn = connect_to_node_helper(
runner, tx_spendable=tx_spendable, conn_privkey="03"
runner=runner,
tx_spendable=tx_spendable,
conn_privkey="03",
global_features=runner.runner_features(field_name="global_features"),
features=runner.runner_features(field_name="features"),
)
pre_events = open_and_announce_channel_helper(
runner, conn_privkey="03", opts=test_opts
Expand Down
12 changes: 10 additions & 2 deletions tests/test_bolt2-01-open_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ def test_open_channel_from_accepter_side(runner: Runner) -> None:
local_funding_privkey = "20"
local_keyset = gen_random_keyset(int(local_funding_privkey))
connections_events = connect_to_node_helper(
runner=runner, tx_spendable=tx_spendable, conn_privkey="02"
runner=runner,
tx_spendable=tx_spendable,
conn_privkey="02",
global_features=runner.runner_features(field_name="global_features"),
features=runner.runner_features(field_name="features"),
)

# Accepter side: we initiate a new channel.
Expand Down Expand Up @@ -179,7 +183,11 @@ def test_open_channel_opener_side(runner: Runner) -> None:
local_funding_privkey = "20"
local_keyset = gen_random_keyset(int(local_funding_privkey))
connections_events = connect_to_node_helper(
runner=runner, tx_spendable=tx_spendable, conn_privkey="02"
runner=runner,
tx_spendable=tx_spendable,
conn_privkey="02",
global_features=runner.runner_features(field_name="global_features"),
features=runner.runner_features(field_name="features"),
)

# Now we test the 'opener' side of an open_channel (node initiates)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_bolt2-02-reestablish.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def test_reestablish(runner: Runner) -> None:
runner=runner,
tx_spendable=tx_spendable,
conn_privkey="02",
global_features=runner.runner_features(field_name="global_features"),
features=runner.runner_features(field_name="features"),
)

test_events = [
Expand Down

0 comments on commit 1c0032d

Please sign in to comment.