Пример #1
0
 def parse(self, byte_string):
     tlv_parsers = {
         1: self.parse_tlv1,
         2: self.parse_tlv2,
         3: self.parse_tlv3,
         254: self.parse_tlv4
     }
     return Namespace.parse(byte_string, tlv_parsers)
Пример #2
0
 def parse(byte_string, extension_parsers=None):
     tlv_parsers = {
         2: TlvHopPayload.parse_amt_to_forward,
         4: TlvHopPayload.parse_outgoing_cltv_value,
         6: TlvHopPayload.parse_short_channel_id,
         8: TlvHopPayload.parse_payment_data
     }
     if extension_parsers:
         tlv_parsers.update(extension_parsers)
     parsed, err = Namespace.parse(byte_string, tlv_parsers)
     if err:
         print("err 123: %s" % err)
         return None, err
     return {'format': 'tlv', 'tlvs': parsed}, None
Пример #3
0
 def parse(self, byte_string):
     tlv_parsers = {0: self.parse_tlv1, 11: self.parse_tlv2}
     return Namespace.parse(byte_string, tlv_parsers)