def test_decode_onion_error(self):
    orf = OnionRoutingFailure.from_bytes(bfh('400f0000000017d2d8b0001d9458'))
    self.assertEqual(('incorrect_or_unknown_payment_details', {'htlc_msat': 399694000, 'height': 1938520}), OnionWireSerializer.decode_msg(orf.to_bytes()))
    self.assertEqual({'htlc_msat': 399694000, 'height': 1938520}, orf.decode_data())
    orf2 = OnionRoutingFailure(26399, bytes.fromhex('0000000017d2d8b0001d9458'))
    with self.assertRaises(UnknownMsgType):
        OnionWireSerializer.decode_msg(orf2.to_bytes())
    self.assertEqual(None, orf2.decode_data())
def test_decode_onion_error(self):
    orf = OnionRoutingFailure.from_bytes(bfh('400f0000000017d2d8b0001d9458'))
    self.assertEqual(('incorrect_or_unknown_payment_details', {'htlc_msat': 399694000, 'height': 1938520}), OnionWireSerializer.decode_msg(orf.to_bytes()))
    self.assertEqual({'htlc_msat': 399694000, 'height': 1938520}, orf.decode_data())
    orf2 = OnionRoutingFailure(26399, bytes.fromhex('0000000017d2d8b0001d9458'))
    with self.assertRaises(UnknownMsgType):
        OnionWireSerializer.decode_msg(orf2.to_bytes())
    self.assertEqual(None, orf2.decode_data())