ElementsProject / lightning

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

Offers decode command displaying incorrect node_id #4909

Open vwoo opened 3 years ago

vwoo commented 3 years ago

When I run the decode command on a offer, the node_id is missing the first two characters.

I am trying to pay a testnet offer I found on twitter: https://twitter.com/evankaloudis/status/1454593888270917634

The output of "lightning-cli decode lno1qgsyxjtl6luzd9t3pr62xr7eemp6awnejusgf6gw45q75vcfqqqqqqqgq9jq5pryv4kk783qehau2zsfusxs4kl9fgn4aj5meargt0t866t4tz7tytrvp67dp030qspau0tpgmf4f7vafzpxpxzajhk3xpdte5jgzf5fhckwgrk6hzp32l9lt3htvxf8sdxn8h6w0ps68lz2lm83unqqa4huwu5038cfpxdd7":

{ "type": "bolt12 offer", "offer_id": "19582d91fdfb774cde30f7254f1b04f0b1b72c4b14baba873e35112647effc8c", "chains": [ "43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000" ], "amount_msat": "100msat", "description": "demo", "node_id": "cdfbc50a09e40d0adbe54a275eca9bcf4685bd67d697558bcb22c6c0ebcd0be2", "signature": "3de3d6146d354f99d488260985d95ed1305abcd24812689be2ce40edab883157cbf5c6eb61927834d33df4e7861a3fc4afecf1e4c00ed6fc7728f89f09099adf", "valid": true }

expected node_id: 02cdfbc50a09e40d0adbe54a275eca9bcf4685bd67d697558bcb22c6c0ebcd0be2 actual node_id: cdfbc50a09e40d0adbe54a275eca9bcf4685bd67d697558bcb22c6c0ebcd0be2

getinfo output

"version": "v0.10.2" "blockheight": 2103115 "network": "testnet"

cdecker commented 3 years ago

Yes, offers make use of the more modern x-only pubkeys, where the first byte (02 or 03) re-derived by recovering from the signature or by looking at the nodes in the network.

Added @rustyrussell in case he wants to add the rationale behind that choice.