teos.inspector¶
-
exception
InspectionFailed(erno, reason)[source]¶ Bases:
ExceptionRaise this the inspector finds a problem with any of the appointment fields.
-
class
Inspector(min_to_self_delay)[source]¶ Bases:
objectThe
Inspectorclass 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_blobmay 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
locatoris 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_delayis correct.To self delays must be greater or equal to
MIN_TO_SELF_DELAY.- Parameters
to_self_delay (
int) – Theto_self_delayencoded in thecsvofto_remoteoutput 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.