diff --git a/lnprototest/funding.py b/lnprototest/funding.py index 6734825..6f2a94c 100644 --- a/lnprototest/funding.py +++ b/lnprototest/funding.py @@ -358,10 +358,6 @@ def from_utxo( tx.wit = CTxWitness([CTxInWitness(CScriptWitness([sig, inkey_pub.format()]))]) return funding, tx.serialize().hex() - def script_pub_key(self) -> str: - """Return the script pub key""" - return CScript([script.OP_0, sha256(self.redeemscript()).digest()]).hex() - def channel_id(self) -> str: # BOLT #2: This message introduces the `channel_id` to identify the # channel. It's derived from the funding transaction by combining the diff --git a/tests/helpers.py b/tests/helpers.py index 4309089..acd7336 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -150,7 +150,7 @@ def gen_random_keyset(counter: int = 20) -> KeySet: ) -def get_traceback(e): +def get_traceback(e: Exception) -> str: lines = traceback.format_exception(type(e), e, e.__traceback__) return "".join(lines) diff --git a/tests/test_bolt2-01-close_channel.py b/tests/test_bolt2-01-close_channel.py index 6683429..f75f1b1 100644 --- a/tests/test_bolt2-01-close_channel.py +++ b/tests/test_bolt2-01-close_channel.py @@ -32,6 +32,7 @@ Msg, Runner, TryAll, + OneOf, ) from helpers import run_runner, merge_events_sequences, tx_spendable from lnprototest.stash import channel_id @@ -74,18 +75,29 @@ def test_close_channel_shutdown_msg_normal_case(runner: Runner) -> None: # the status of the channel is changed. # We may or we MUST? # FIXME: when this have sense? when there is not update? - TryAll( + OneOf( # channel_update to change the state of the channel from # NORMAL -> SHUTDOWN - [ExpectMsg("channel_update")], + [ + ExpectMsg("channel_update"), + ExpectMsg("shutdown", channel_id=channel_idx), + ], # channel_update to change the state of the connection from # NORMAL -> SHUTDOWN -> ONCHAIN - [ExpectMsg("channel_update"), ExpectMsg("channel_update")], + [ + ExpectMsg("channel_update"), + ExpectMsg("channel_update"), + ExpectMsg("shutdown", channel_id=channel_idx), + ], + [ + ExpectMsg("channel_update"), + ExpectMsg("channel_update"), + ExpectMsg("channel_update"), + ExpectMsg("shutdown", channel_id=channel_idx), + ], # No channel_update received - [], + [ExpectMsg("shutdown", channel_id=channel_idx)], ), - # Some times I receive a channel update, why? - ExpectMsg("shutdown", channel_id=channel_idx), # FIXME: We should not be able to ping the node right? ], # ln implementation sent the shutdown message