Lightning Invoice need “payment_secret” feature

uenohiro4
Nayuta Engineering Blog
2 min readJan 31, 2023

When Nayuta Wallet testing, we received an email from a closed tester, reporting that remittance failed with on-the-fly channel creation (a mechanism to open a channel via LSP by paying a fee if there is no channel that can be paid) (currently fixed).

In the case of on-the-fly channel creation, if the amount received at the most recent Lightning node of Nayuta Wallet is not greater than the channel opening fee, an error will be returned and stop transfering.

Normally, this is fine, but when remittances are made using MPP, a pattern occurs where the total exceeds the fee, but not alone, and in such cases, an error has to be returned.

To avoid using MPP, I read BOLT#9 and removed basic_mpp from invoice features.

I also removed the dependent feature payment_secret, but that was the cause of the transfer failure.

In BOLT#11, the field name “s” (meaning payment_secret) MUST be written, but I did not notice it.

The Lightning node that loaded an invoice with no “paymenet_secret” field had various behaviors.

  • Successful read invoice and transfer
  • Read invoice error
  • Read invoice and transfer starts, but an error occurs

The transfer was successful by adding the payment_secret field to the invoice.

--

--