Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify about the length of a r field in invoice #865

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 8 additions & 6 deletions 11-payment-encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,14 @@ Currently defined tagged fields are:
* `x` (6): `data_length` variable. `expiry` time in seconds (big-endian). Default is 3600 (1 hour) if not specified.
* `c` (24): `data_length` variable. `min_final_cltv_expiry` to use for the last HTLC in the route. Default is 18 if not specified.
* `f` (9): `data_length` variable, depending on version. Fallback on-chain address: for Bitcoin, this starts with a 5-bit `version` and contains a witness program or P2PKH or P2SH address.
* `r` (3): `data_length` variable. One or more entries containing extra routing information for a private route; there may be more than one `r` field
* `pubkey` (264 bits)
* `short_channel_id` (64 bits)
* `fee_base_msat` (32 bits, big-endian)
* `fee_proportional_millionths` (32 bits, big-endian)
* `cltv_expiry_delta` (16 bits, big-endian)
* `r` (3): `data_length` variable. One or more entries containing extra routing information for a private route; there may be more than one `r` field.
* Fields are
* `pubkey` (264 bits)
* `short_channel_id` (64 bits)
* `fee_base_msat` (32 bits, big-endian)
* `fee_proportional_millionths` (32 bits, big-endian)
* `cltv_expiry_delta` (16 bits, big-endian)
* Be aware that `data_length` can express `2^10` (=1024 bits) as the longest, and a single hop will be 51 bytes (= 408 bits). So currently there is no way to specify a hint with more than two hops.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weirdly, data_length is expressed in 5-bit amounts, so there is 5120 bits. You can fit 12 hops in there.

* `9` (5): `data_length` variable. One or more 5-bit values containing features
supported or required for receiving this payment.
See [Feature Bits](#feature-bits).
Expand Down