+#[derive(PartialEq)]
+pub(crate) enum HTLCType {
+ AcceptedHTLC,
+ OfferedHTLC
+}
+
+impl HTLCType {
+ /// Check if a given tx witnessScript len matchs one of a pre-signed HTLC
+ pub(crate) fn scriptlen_to_htlctype(witness_script_len: usize) -> Option<HTLCType> {
+ if witness_script_len == 133 {
+ Some(HTLCType::OfferedHTLC)
+ } else if witness_script_len >= 136 && witness_script_len <= 139 {
+ Some(HTLCType::AcceptedHTLC)
+ } else {
+ None
+ }
+ }
+}
+