From fa7ecc56d7b2cb3d03cc55c96d66bdac2414b293 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Tue, 16 Jul 2024 10:28:58 +0200 Subject: [PATCH] Clarify maximum length of an invoice description We previously stated in the docs that the invoice description can be at most `1023` bytes long, which is wrong. According to BOLT 11 it's at most 1023*5 bits (639 bytes) long. --- lightning-invoice/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightning-invoice/src/lib.rs b/lightning-invoice/src/lib.rs index e427bf3ccb9..d64da322a76 100644 --- a/lightning-invoice/src/lib.rs +++ b/lightning-invoice/src/lib.rs @@ -1511,8 +1511,8 @@ impl TaggedField { impl Description { - /// Creates a new `Description` if `description` is at most 1023 __bytes__ long, - /// returns [`CreationError::DescriptionTooLong`] otherwise + /// Creates a new `Description` if `description` is at most 1023 * 5 bits (i.e., 639 bytes) + /// long, and returns [`CreationError::DescriptionTooLong`] otherwise. /// /// Please note that single characters may use more than one byte due to UTF8 encoding. pub fn new(description: String) -> Result {