def test_read_tlv_stream_tests2(self):
    lnser = LNSerializer()
    for tlv_stream_name in ('n1', 'n2'):
        with self.subTest(tlv_stream_name=tlv_stream_name):
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('')), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('2100')), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd020100')), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00fd00')), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00ff00')), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('fe0200000100')), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('ff020000000000000100')), tlv_stream_name=tlv_stream_name))
    self.assertEqual({'tlv1': {'amount_msat': 0}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('0100')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 1}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('010101')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 256}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('01020100')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 65536}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('0103010000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 16777216}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('010401000000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 4294967296}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('01050100000000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 1099511627776}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('0106010000000000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 281474976710656}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('010701000000000000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 72057594037927936}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('01080100000000000000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv2': {'scid': ShortChannelID.from_components(0, 0, 550)}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('02080000000000000226')), tlv_stream_name='n1'))
    self.assertEqual({'tlv3': {'node_id': bfh('023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb'), 'amount_msat_1': 1, 'amount_msat_2': 2}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('0331023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb00000000000000010000000000000002')), tlv_stream_name='n1'))
    self.assertEqual({'tlv4': {'cltv_delta': 550}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00fe020226')), tlv_stream_name='n1'))
def test_read_tlv_stream_tests2(self):
    lnser = LNSerializer()
    for tlv_stream_name in ('n1', 'n2'):
        with self.subTest(tlv_stream_name=tlv_stream_name):
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh()), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('2100')), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd020100')), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00fd00')), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00ff00')), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('fe0200000100')), tlv_stream_name=tlv_stream_name))
            self.assertEqual({}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('ff020000000000000100')), tlv_stream_name=tlv_stream_name))
    self.assertEqual({'tlv1': {'amount_msat': 0}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('0100')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 1}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('010101')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 256}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('01020100')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 65536}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('0103010000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 16777216}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('010401000000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 4294967296}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('01050100000000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 1099511627776}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('0106010000000000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 281474976710656}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('010701000000000000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv1': {'amount_msat': 72057594037927936}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('01080100000000000000')), tlv_stream_name='n1'))
    self.assertEqual({'tlv2': {'scid': ShortChannelID.from_components(0, 0, 550)}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('02080000000000000226')), tlv_stream_name='n1'))
    self.assertEqual({'tlv3': {'node_id': bfh('023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb'), 'amount_msat_1': 1, 'amount_msat_2': 2}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('0331023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb00000000000000010000000000000002')), tlv_stream_name='n1'))
    self.assertEqual({'tlv4': {'cltv_delta': 550}}, lnser.read_tlv_stream(fd=io.BytesIO(bfh('fd00fe020226')), tlv_stream_name='n1'))