ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.81k stars 887 forks source link

BOLT12: can't decode offer (invalid token) #7402

Open urza opened 2 months ago

urza commented 2 months ago

This is public bolt12 offer of @Sjors

lno1pg4y7ur9dcs8xmm4wf3k2gryv4mx2mr0wpkk2mn5ypjx7mnpw35k7m3qvehhygzndfhhyuc5pefk5mmjwvs9qun0wehk7um5rcsrwlufzdn408gvmlpgxw7rywsaq9g5a6jq6jxvapknrcucyglqevlsgqgf4k7rc5runmkuex8ue6jrj0r9jszltusclp4yd0z4mekwa7k8dfskd2ltdlfmcdnm6f0sv5jsrs6t3vkql8nav0vl6w4l44gmaf4c

when I try to decode it with CLN 24.05 I get:

cln decode lno1pg4y7ur9dcs8xmm4wf3k2gryv4mx2mr0wpkk2mn5ypjx7mnpw35k7m3qvehhygzndfhhyuc5pefk5mmjwvs9qun0wehk7um5rcsrwlufzdn408gvmlpgxw7rywsaq9g5a6jq6jxvapknrcucyglqevlsgqgf4k7rc5runmkuex8ue6jrj0r9jszltusclp4yd0z4mekwa7k8dfskd2ltdlfmcdnm6f0sv5jsrs6t3vkql8nav0vl6w4l44gmaf4c
{
   "code": -32602,
   "message": "string: invalid offer data: invalid token '\"lno1pg4y7ur9dcs8xmm4wf3k2gryv4mx2mr0wpkk2mn5ypjx7mnpw35k7m3qvehhygzndfhhyuc5pefk5mmjwvs9qun0wehk7um5rcsrwlufzdn408gvmlpgxw7rywsaq9g5a6jq6jxvapknrcucyglqevlsgqgf4k7rc5runmkuex8ue6jrj0r9jszltusclp4yd0z4mekwa7k8dfskd2ltdlfmcdnm6f0sv5jsrs6t3vkql8nav0vl6w4l44gmaf4c\"'"
}
Sjors commented 2 months ago

Strangely my lightning-cli decode ... also says its invalid. But it comes straight from the listoffers RPC.

      {
         "offer_id": "...",
         "active": true,
         "single_use": false,
         "bolt12": "lno1...f4c",
         "used": false,
         "label": "open-source-donation"
      },
Sjors commented 2 months ago

I vaguely remember the spec changed a while ago, but in that case I would expect it to marked as invalid, or maybe not active.

jkczyz commented 2 months ago

Looks like this offer is using TLV type 20 for the issuer whereas the spec was changed to use that for max quantity.

Sjors commented 2 months ago

I'm happy to generate a new offer of course, but it would still be good if cln marked it as incorrect somehow.