From e2b1f6c6d5f43b5815834672c28666039724435a Mon Sep 17 00:00:00 2001 From: bitromortac <bitromortac@protonmail.com> Date: Wed, 26 Jan 2022 16:52:38 +0100 Subject: [PATCH] lnutil: exceptions for LN protocol errors/warnings The exceptions are meant to be raised in places where the BOLTs require the sending of warning or error messages. They are necessary to handle protocol failures occuring helper functions that check constraints. --- electrum/lnutil.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/electrum/lnutil.py b/electrum/lnutil.py index 8a4878746..bba793321 100644 --- a/electrum/lnutil.py +++ b/electrum/lnutil.py @@ -362,6 +362,16 @@ class NoPathFound(PaymentFailure): def __str__(self): return _('No path found') + +class LNProtocolError(Exception): + """Raised in peer methods to trigger an error message.""" + + +class LNProtocolWarning(Exception): + """Raised in peer methods to trigger a warning message.""" + + + # TODO make some of these values configurable? REDEEM_AFTER_DOUBLE_SPENT_DELAY = 30