Skip to content

Commit eb7bbb4

Browse files
fix: Correct error check for expected errors
This commit addresses an issue with the error checking mechanism. Currently, the `ExpectError` function only verifies the occurrence of an error during the connection, without considering the specific error message expected. The upcoming changes in [1] will simplify lnprototest, but until then, this fix provides a straightforward and effective solution for checking error messages. [1] #95 Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent ffaa96f commit eb7bbb4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lnprototest/event.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,14 @@ def action(self, runner: "Runner") -> bool:
542542
error = runner.check_error(self, self.find_conn(runner))
543543
if error is None:
544544
raise EventError(self, "No error found")
545+
error = bytes.fromhex(error)
546+
msg = Message.read(namespace(), io.BytesIO(error))
547+
logging.info(f"message received {msg.messagetype.name}, hex {error.hex()}")
548+
if msg.messagetype.name not in "error":
549+
raise EventError(
550+
self,
551+
f"not error found but received `{msg.messagetype.name}` with hex: `{error.hex()}`",
552+
)
545553
return True
546554

547555

0 commit comments

Comments
 (0)