Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bolt11/models/routehint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 20 additions & 0 deletions tests/test_route_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading