diff --git a/bolt11/models/routehint.py b/bolt11/models/routehint.py index 766e498..9fea1db 100644 --- a/bolt11/models/routehint.py +++ b/bolt11/models/routehint.py @@ -41,10 +41,10 @@ def data(self) -> Bits: for route in self.routes: route_hints.append( BitArray(hex=route.public_key) - + pack("intbe:64", scid_to_int(route.short_channel_id)) - + pack("intbe:32", route.base_fee) - + pack("intbe:32", route.ppm_fee) - + pack("intbe:16", route.cltv_expiry_delta) + + pack("uintbe:64", scid_to_int(route.short_channel_id)) + + pack("uintbe:32", route.base_fee) + + pack("uintbe:32", route.ppm_fee) + + pack("uintbe:16", route.cltv_expiry_delta) ) return route_hints diff --git a/tests/test_route_hints.py b/tests/test_route_hints.py index e0929d4..e7b31ff 100644 --- a/tests/test_route_hints.py +++ b/tests/test_route_hints.py @@ -100,3 +100,23 @@ def test_route_hint_unordered(self): check_decoded_routes(decoded.route_hints, ex["route_hints"]) re_encoded = encode(decoded) assert re_encoded == ex["payment_request"] + + +class TestRouteHintsSize: + def test_channel_id_size(self): + big_channel_id = "16774490x12969991x22027" + hints = RouteHint.from_list( + [ + { + "public_key": ( + "029e03a901b85534ff1e92c43c74431f7ce72046060fcf7a95c37e148f78c77255" + ), + "short_channel_id": big_channel_id, + "base_fee": 1, + "ppm_fee": 20, + "cltv_expiry_delta": 3, + } + ] + ) + + assert hints.data