teos.inspector¶
-
exception
InspectionFailed
(erno, reason)[source]¶ Bases:
Exception
Raise this the inspector finds a problem with any of the appointment fields.
-
class
Inspector
(min_to_self_delay)[source]¶ Bases:
object
The
Inspector
class is in charge of verifying that the appointment data provided by the user is correct.- Parameters
min_to_self_delay (
int
) – the minimum to_self_delay accepted in appointments.
-
static
check_blob
(encrypted_blob)[source]¶ Checks if the provided
encrypted_blob
may be correct.- Parameters
encrypted_blob (
str
) – the encrypted blob to be checked (hex-encoded).- Raises
InspectionFailed – if any of the fields is wrong.
-
static
check_locator
(locator)[source]¶ Checks if the provided
locator
is correct.Locators must be 16-byte hex-encoded strings.
- Parameters
locator (
str
) – the locator to be checked.- Raises
InspectionFailed – if any of the fields is wrong.
-
check_to_self_delay
(to_self_delay)[source]¶ Checks if the provided
to_self_delay
is correct.To self delays must be greater or equal to
MIN_TO_SELF_DELAY
.- Parameters
to_self_delay (
int
) – Theto_self_delay
encoded in thecsv
ofto_remote
output of the commitment transaction this appointment is covering.- Raises
InspectionFailed – if any of the fields is wrong.
-
inspect
(appointment_data)[source]¶ Inspects whether the data provided by the user is correct.
- Parameters
appointment_data (
dict
) – a dictionary containing the appointment data.- Returns
An appointment initialized with the provided data.
- Return type
- Raises
InspectionFailed – if any of the fields is wrong.