lightning icon indicating copy to clipboard operation
lightning copied to clipboard

For an invoice generated via an offer, decodepay isn't working anymore, while pay still is

Open hMsats opened this issue 2 years ago • 5 comments

Issue and Steps to Reproduce

Lightning node 1: lightning-cli offer any test returns:

lno1pgz8getnwstzzq5gsfzq98zep9vnqw9tr8exn9ruwgx7xs37fyterdrv0jf0wcnekc

Lightning node 2: lightning-cli fetchinvoice offer=lno1pgz8getnwstzzq5gsfzq98zep9vnqw9tr8exn9ruwgx7xs37fyterdrv0jf0wcnekc amount_msat=200000 returns:

{
   "invoice": "lni1qqgdwu2v5mqskzml6u80u2haalxruzsyw3jhxaqkyypg3qjyq2w9jz2exqu2kx0jdx28cusdudprujghjx6xclyj7a38ndjjqvps6szcyyp9uwjmywwmguzvqqujrhutf3rxhzr5pxr062tdnae8er3q06dsnvdqnqpg3qjyq2w9jz2exqu2kx0jdx28cusdudprujghjx6xclyj7a38ndsrpqzq4alcv65d6qaahfr4kyqv0at8pmtuxrqamcqx653hc8xlw2cszqkuvduq78d75tyhmgrdczy2kjefrl6yksf73yd6ft0waag405yaauqr9qsu2lf426qxupuj3d733nj4y7gsh2sjk5gzsq9s35nqw4g87wccyrsw0u60thk63n2rduhzltv85vr6pgsuqqqqqqqqqqqqqqqjqqqqqqqqqqqqq8fykt06c5sqqqqqpfqyvjap3j4gyz2np6nh8xdxzh5lnsas674cqga8wsftfxqstw285wze7k89lz4e02srqvx5pvppq2ygy3qzn3vsjkfs8z43nunfj378yr0rgglyj9u3k3k8eyhhvfumduzqjupanmexql7gj0whkplur993ze0hp3a8h4l7zqh83nexj4htn5t4zkau3tu9acljl8dyaqurwygg97yx093u8s2md8l26kkh2e9ylgg",
   "changes": {}
}

Lightning node 2: lightning-cli decodepay lni1qqgdwu2v5mqskzml6u80u2haalxruzsyw3jhxaqkyypg3qjyq2w9jz2exqu2kx0jdx28cusdudprujghjx6xclyj7a38ndjjqvps6szcyyp9uwjmywwmguzvqqujrhutf3rxhzr5pxr062tdnae8er3q06dsnvdqnqpg3qjyq2w9jz2exqu2kx0jdx28cusdudprujghjx6xclyj7a38ndsrpqzq4alcv65d6qaahfr4kyqv0at8pmtuxrqamcqx653hc8xlw2cszqkuvduq78d75tyhmgrdczy2kjefrl6yksf73yd6ft0waag405yaauqr9qsu2lf426qxupuj3d733nj4y7gsh2sjk5gzsq9s35nqw4g87wccyrsw0u60thk63n2rduhzltv85vr6pgsuqqqqqqqqqqqqqqqjqqqqqqqqqqqqq8fykt06c5sqqqqqpfqyvjap3j4gyz2np6nh8xdxzh5lnsas674cqga8wsftfxqstw285wze7k89lz4e02srqvx5pvppq2ygy3qzn3vsjkfs8z43nunfj378yr0rgglyj9u3k3k8eyhhvfumduzqjupanmexql7gj0whkplur993ze0hp3a8h4l7zqh83nexj4htn5t4zkau3tu9acljl8dyaqurwygg97yx093u8s2md8l26kkh2e9ylgg returns:

{
   "code": -1,
   "message": "Invalid bolt11: Bad bech32 string"
}

Lightning node 2: lightning-cli pay lni1qqgdwu2v5mqskzml6u80u2haalxruzsyw3jhxaqkyypg3qjyq2w9jz2exqu2kx0jdx28cusdudprujghjx6xclyj7a38ndjjqvps6szcyyp9uwjmywwmguzvqqujrhutf3rxhzr5pxr062tdnae8er3q06dsnvdqnqpg3qjyq2w9jz2exqu2kx0jdx28cusdudprujghjx6xclyj7a38ndsrpqzq4alcv65d6qaahfr4kyqv0at8pmtuxrqamcqx653hc8xlw2cszqkuvduq78d75tyhmgrdczy2kjefrl6yksf73yd6ft0waag405yaauqr9qsu2lf426qxupuj3d733nj4y7gsh2sjk5gzsq9s35nqw4g87wccyrsw0u60thk63n2rduhzltv85vr6pgsuqqqqqqqqqqqqqqqjqqqqqqqqqqqqq8fykt06c5sqqqqqpfqyvjap3j4gyz2np6nh8xdxzh5lnsas674cqga8wsftfxqstw285wze7k89lz4e02srqvx5pvppq2ygy3qzn3vsjkfs8z43nunfj378yr0rgglyj9u3k3k8eyhhvfumduzqjupanmexql7gj0whkplur993ze0hp3a8h4l7zqh83nexj4htn5t4zkau3tu9acljl8dyaqurwygg97yx093u8s2md8l26kkh2e9ylgg returns:

{
   "destination": "02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6",
   "payment_hash": "9530ea77399a615e9f9c3b0d7ab8023a77412b498105b947a3859f58e5f8ab97",
   "created_at": 1689917890.076,
   "parts": 1,
   "amount_msat": 200000,
   "amount_sent_msat": 200000,
   "payment_preimage": "11db5d5a20c209c3565a25625228629d117f57e1272f6455b7cd2675bdda0fd9",
   "status": "complete"
}

For "normal invoices" decodepay is ok:

Lightning node 1: lightning-cli invoice 200000 bla bla returns:

{
   "payment_hash": "3a08ace3783e74d290e2609e290dd921b31d20b8e8bfcb85ddc359cd0bb86281",
   "expires_at": 1690523179,
   "bolt11": "lnbc2u1pjt5xatsp5pkk7a6k90pq4us94jdrhnrqj0dsy2460lxs29m2z5v4gj99rmsxspp58gy2ecmc8e6d9y8zvz0zjrweyxe36g9cazluhpwacdvu6zacv2qsdq9vfkxzxqyjw5qcqpjrzjqv7n3cr7y4qk9qs5eqvyeak9vgc3qkv8yd37nafckt69gdzp3ddu2zah4qqqg7sqqqqqqqqqqqqqphgq9q9qxpqysgq6mtf5m8zgtm3vmhdlvrjm089jtknk2reuweskvf2htk9radjtgf83a906qnhf9p594ul3sz6h562fptuup8kp2nqaupvmz2hmugyr7cqksqqhu",
   "payment_secret": "0dadeeeac578415e40b59347798c127b6045574ff9a0a2ed42a32a8914a3dc0d"
}

Lightning node 2: lightning-cli decodepay lnbc2u1pjt5xatsp5pkk7a6k90pq4us94jdrhnrqj0dsy2460lxs29m2z5v4gj99rmsxspp58gy2ecmc8e6d9y8zvz0zjrweyxe36g9cazluhpwacdvu6zacv2qsdq9vfkxzxqyjw5qcqpjrzjqv7n3cr7y4qk9qs5eqvyeak9vgc3qkv8yd37nafckt69gdzp3ddu2zah4qqqg7sqqqqqqqqqqqqqphgq9q9qxpqysgq6mtf5m8zgtm3vmhdlvrjm089jtknk2reuweskvf2htk9radjtgf83a906qnhf9p594ul3sz6h562fptuup8kp2nqaupvmz2hmugyr7cqksqqhu returns:

{
   "currency": "bc",
   "created_at": 1689918379,
   "expiry": 604800,
   "payee": "02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6",
   "amount_msat": 200000,
   "description": "bla",
   "min_final_cltv_expiry": 18,
   "payment_secret": "0dadeeeac578415e40b59347798c127b6045574ff9a0a2ed42a32a8914a3dc0d",
   "features": "02024100",
   "routes": [
      [
         {
            "pubkey": "033d38e07e2541628214c8184cf6c562311059872363e9f538b2f45434418b5bc5",
            "short_channel_id": "767912x1146x0",
            "fee_base_msat": 0,
            "fee_proportional_millionths": 221,
            "cltv_expiry_delta": 40
         }
      ]
   ],
   "payment_hash": "3a08ace3783e74d290e2609e290dd921b31d20b8e8bfcb85ddc359cd0bb86281",
   "signature": "3045022100d6d69a6ce242f7166eedfb072dbce592ed3b2879e3b30b312abaec51f5b25a12022078f4afd0277494342d79f8c05abd34a4857ce04f60aa60ef02cd8957df1041fb"
}

While my bolt12 lightning game kept working, this made my hacked version of Spark-wallet stop working. That's how I noticed, although a bit late. I'm going to add decodepay into my game as an extra check (when this issue has been fixed).

getinfo output

"version": "v23.05-289-g5afd0ab",

hMsats avatar Jul 21 '23 06:07 hMsats

Oops: I should have used decode probably since I'm using allow-deprecated-apis=false. Closing this "non-issue"

EDIT: had to fix Spark-wallet to only use decode.

hMsats avatar Jul 21 '23 06:07 hMsats

Reopening this issue: maybe decodepay should work also in this case? If I'm wrong here, please close the issue.

Running CL with experimental-offers and allow-deprecated-apis=false in config

hMsats avatar Jul 21 '23 07:07 hMsats

Yeah from docs this should works

The decodepay RPC command checks and parses a bolt11 string as specified by the BOLT 11 specification.

I will look into it

vincenzopalazzo avatar Jul 21 '23 07:07 vincenzopalazzo

There are two options: either we remove the 'decodepay' and use only 'decode,' or we decode any BOLT11 type within 'decodepay.'

I am more in favor of removing it because it does not add any value to have two different commands that do the same thing (for a subset of input). However, this requires a bit of code refactoring to enable the logic to work even when offers are disabled.

I will try to make a patch in the next week (ofc the decodepay will be deprecated and not removed)

vincenzopalazzo avatar Oct 14 '23 11:10 vincenzopalazzo

this requires a bit of code refactoring to enable the logic to work even when offers are disabled.

@vincenzopalazzo Are you mentioning that we should make 'decodepay' work for all BOLT11 type before deprecating? Because I checked, and 'decode' works irrespective of whether offers are enabled or disabled. Or did I get it wrong?

raehat avatar May 04 '24 03:05 raehat

We should deprecate decodepay, decode takes its place (which decodes much more stuff).

(The man page says this was added in 23.05, but that's wrong, it's ancient).

rustyrussell avatar Aug 11 '24 02:08 rustyrussell

This is fixed by #7551

hMsats avatar Aug 11 '24 11:08 hMsats