def parse(byte_string): scid, remainder, err = Namespace.pop_short_channel_id(byte_string) if err: return None, err #print("scid: %s, remainder: %s\n" % (scid, remainder.hex())) amt_to_forward, remainder, err = Namespace.pop_u64(remainder) if err: return None, err #print("amt: %s, remainder: %s\n" % (amt_to_forward, remainder.hex())) outgoing_cltv_value, remainder, err = Namespace.pop_u32(remainder) if err: return None, err #print("outgoing: %s, remainder: %s\n" % (outgoing_cltv_value, # remainder.hex())) padding, remainder, err = Namespace.pop_bytes(12, remainder) if err: return None, err #print("padding %s, remainder: %s\n" % (padding, remainder.hex())) if len(remainder) != 0: return None, "unexpected remaining bytes" return { 'format': 'legacy', 'short_channel_id': scid, 'amt_to_forward': amt_to_forward, 'outgoing_cltv_value': outgoing_cltv_value, 'padding': padding }, None