Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: lncli INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS #8380

Closed
zapomatic opened this issue Jan 14, 2024 · 13 comments · Fixed by #8387
Closed

[bug]: lncli INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS #8380

zapomatic opened this issue Jan 14, 2024 · 13 comments · Fixed by #8387
Labels

Comments

@zapomatic
Copy link

Background

Using buildroute + sendtoroute to construct a triangle and send funds through does not appear to work on lncli.
Getting INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS error without any other idea why the payment is not working.

Full script, built path, and output below.

Your environment

  • version of lnd
lncli version 0.17.3-beta commit=v0.17.3-beta

Steps to reproduce

# LNBϟG Hub3
OUT_PUBKEY=02c91d6aa51aa940608b497b6beebcb1aec05be3c47704b682b3889424679ca490
# adam.masterofpearls.net
IN_PUBKEY=029efe15ef5f0fcc2fdd6b910405e78056b28c9b64e1feff5f13b8dce307e67cad
# Zap-O-Matic
MY_PUBKEY=026d0169e8c220d8e789de1e7543f84b9041bbb3e819ab14b9824d37caa94f1eb2
INV_AMOUNT=100
INV_AMOUNT_MSAT=100000
read INV_RHASH INV_PAY_REQ INV_PAY_ADDR < <(echo $(lncli addinvoice --amt $INV_AMOUNT | jq -r '.r_hash, .payment_request, .payment_addr'))
lncli buildroute --payment_addr $INV_PAY_ADDR --amt $INV_AMOUNT --hops $OUT_PUBKEY,$IN_PUBKEY,$MY_PUBKEY | jq -r '(.route.hops[-1] | .mpp_record) |= {payment_addr:"'$INV_PAY_ADDR'", total_amt_msat: "'$INV_AMOUNT_MSAT'"}' | lncli sendtoroute --payment_hash=$INV_RHASH -

Expected behaviour

Payment succeeds or a more actionable error message informs what went wrong.

Actual behaviour

{
    "attempt_id": "33937",
    "status": "FAILED",
    "route": {
        "total_time_lock": 825998,
        "total_fees": "0",
        "total_amt": "100",
        "hops": [
            {
                "chan_id": "906394505130934286",
                "chan_capacity": "10000000",
                "amt_to_forward": "100",
                "fee": "0",
                "expiry": 825958,
                "amt_to_forward_msat": "100000",
                "fee_msat": "0",
                "pub_key": "02c91d6aa51aa940608b497b6beebcb1aec05be3c47704b682b3889424679ca490",
                "tlv_payload": true,
                "mpp_record": null,
                "amp_record": null,
                "custom_records": {},
                "metadata": ""
            },
            {
                "chan_id": "890985949038837767",
                "chan_capacity": "88888888",
                "amt_to_forward": "100",
                "fee": "0",
                "expiry": 825814,
                "amt_to_forward_msat": "100000",
                "fee_msat": "0",
                "pub_key": "029efe15ef5f0fcc2fdd6b910405e78056b28c9b64e1feff5f13b8dce307e67cad",
                "tlv_payload": true,
                "mpp_record": null,
                "amp_record": null,
                "custom_records": {},
                "metadata": ""
            },
            {
                "chan_id": "906394505130934278",
                "chan_capacity": "8000000",
                "amt_to_forward": "100",
                "fee": "0",
                "expiry": 825814,
                "amt_to_forward_msat": "100000",
                "fee_msat": "0",
                "pub_key": "026d0169e8c220d8e789de1e7543f84b9041bbb3e819ab14b9824d37caa94f1eb2",
                "tlv_payload": true,
                "mpp_record": {
                    "payment_addr": "f00b989ce85bdae2fb2539bb6dabf5f500b979e6bf96b733c4451bde7b82684d",
                    "total_amt_msat": "100000"
                },
                "amp_record": null,
                "custom_records": {},
                "metadata": ""
            }
        ],
        "total_fees_msat": "0",
        "total_amt_msat": "100000"
    },
    "attempt_time_ns": "1705211144479747837",
    "resolve_time_ns": "1705211178161571293",
    "failure": {
        "code": "INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS",
        "channel_update": null,
        "htlc_msat": "0",
        "onion_sha_256": "",
        "cltv_expiry": 0,
        "flags": 0,
        "failure_source_index": 3,
        "height": 825734
    },
    "preimage": ""
}
@zapomatic zapomatic added bug Unintended code behaviour needs triage labels Jan 14, 2024
@ziggie1984
Copy link
Collaborator

So it's by design that you will not receive a detailed error why the payment is not accepted, this helps against attacks.

But because it is a rebalance payment as I see, you should see the reason in the logs of your node.

Switch on the HSWC to debug and look for this log line:
https://github.com/lightningnetwork/lnd/blob/master/htlcswitch/link.go#L1351-L1352

@zapomatic
Copy link
Author

zapomatic commented Jan 14, 2024

Thanks for the response. Can you elaborate on how to switch on the HSWC logging? Does that require setting debuglevel=debug and restarting or is there a hot way to enable it (or a different config way)?

@zapomatic
Copy link
Author

nevermind, I found it here:

debuglevel=info,HSWC=debug

trying now

@zapomatic
Copy link
Author

ok, great, so now I see:

received cancel resolution for (Chan ID=824361:2226:6, HTLC ID=12) with outcome: expiry too soon

Should I be setting a different flag somewhere in buildroute or addinvoice. Is this beacause the default expiry for addinvoice is 1 hour, but the first hop expiry is much longer?

That Chan ID belongs to the middle node. It's unclear to me why the first hop got an expiry of 825958, but then it went down to 825814 for the next two...

@guggero
Copy link
Collaborator

guggero commented Jan 15, 2024

This error sounds to me like one of the nodes isn't properly synced to the network and has a different block height than the others.

@ziggie1984
Copy link
Collaborator

Can you post the final_cltv_delta of the invoice and the blockheight your node is synced on, and try the payment again and post the error especially the failure blockheight ?

@zapomatic
Copy link
Author

zapomatic commented Jan 15, 2024

My node is fully synced: 825901 (same as mempool.space shows)

Invoice:

{
            "memo": "",
            "r_preimage": "3a1ddce4f781dcbe76cd04fba282ffefc3c92005ee82da3af70151ecff6f9487",
            "r_hash": "1c680498a75f07473c3f902dd45218b59ef1fc4739b330062a22ad861c573308",
            "value": "100",
            "value_msat": "100000",
            "settled": false,
            "creation_date": "1705331564",
            "settle_date": "0",
            "payment_request": "lnbc1u1pj62jmvpp5r35qfx98tur5w0pljqkag5sckk00rlz88xenqp32y2kcv8zhxvyqdqqcqzrrxqyz5vqsp5s4fdn0afck0gqg2zvs5xcr0jykfk0tgkfqjvh2g5c5g0pd76flys9qyyssqauur3lyarccmndcwepk6rh5w5hjpn5pe8l3xd2y6gx3u39tyaapnp4esykvmj54d93v32z8e0x0z7er0enurwmy0cq0v2ujsa723m8sqtgw2f9",
            "description_hash": "",
            "expiry": "86400",
            "fallback_addr": "",
            "cltv_expiry": "99",
            "route_hints": [],
            "private": false,
            "add_index": "570",
            "settle_index": "0",
            "amt_paid": "0",
            "amt_paid_sat": "0",
            "amt_paid_msat": "0",
            "state": "OPEN",
            "htlcs": [],
            "features": {
                "9": {
                    "name": "tlv-onion",
                    "is_required": false,
                    "is_known": true
                },
                "14": {
                    "name": "payment-addr",
                    "is_required": true,
                    "is_known": true
                },
                "17": {
                    "name": "multi-path-payments",
                    "is_required": false,
                    "is_known": true
                }
            },
            "is_keysend": false,
            "payment_addr": "8552d9bfa9c59e80214264286c0df2259367ad164824cba914c510f0b7da4fc9",
            "is_amp": false,
            "amp_invoice_state": {}
        }

payment test again:

{
    "attempt_id": "37001",
    "status": "FAILED",
    "route": {
        "total_time_lock": 826165,
        "total_fees": "0",
        "total_amt": "100",
        "hops": [
            {
                "chan_id": "906394505130934286",
                "chan_capacity": "10000000",
                "amt_to_forward": "100",
                "fee": "0",
                "expiry": 826125,
                "amt_to_forward_msat": "100000",
                "fee_msat": "0",
                "pub_key": "02c91d6aa51aa940608b497b6beebcb1aec05be3c47704b682b3889424679ca490",
                "tlv_payload": true,
                "mpp_record": null,
                "amp_record": null,
                "custom_records": {},
                "metadata": ""
            },
            {
                "chan_id": "891083805680730116",
                "chan_capacity": "222222222",
                "amt_to_forward": "100",
                "fee": "0",
                "expiry": 825981,
                "amt_to_forward_msat": "100000",
                "fee_msat": "0",
                "pub_key": "029efe15ef5f0fcc2fdd6b910405e78056b28c9b64e1feff5f13b8dce307e67cad",
                "tlv_payload": true,
                "mpp_record": null,
                "amp_record": null,
                "custom_records": {},
                "metadata": ""
            },
            {
                "chan_id": "906394505130934278",
                "chan_capacity": "8000000",
                "amt_to_forward": "100",
                "fee": "0",
                "expiry": 825981,
                "amt_to_forward_msat": "100000",
                "fee_msat": "0",
                "pub_key": "026d0169e8c220d8e789de1e7543f84b9041bbb3e819ab14b9824d37caa94f1eb2",
                "tlv_payload": true,
                "mpp_record": {
                    "payment_addr": "8552d9bfa9c59e80214264286c0df2259367ad164824cba914c510f0b7da4fc9",
                    "total_amt_msat": "100000"
                },
                "amp_record": null,
                "custom_records": {},
                "metadata": ""
            }
        ],
        "total_fees_msat": "0",
        "total_amt_msat": "100000"
    },
    "attempt_time_ns": "1705331707150017224",
    "resolve_time_ns": "1705331768345827588",
    "failure": {
        "code": "INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS",
        "channel_update": null,
        "htlc_msat": "0",
        "onion_sha_256": "",
        "cltv_expiry": 0,
        "flags": 0,
        "failure_source_index": 3,
        "height": 825901
    },
    "preimage": ""
}

logs:

2024-01-15 15:16:08.336 [DBG] HSWC: ChannelLink(c32913f9d93b1d81ad5c7930cb3110f04de4c00d5454b5dcc6054c42925553d0:14): settle-fail-filter &{1 [0]}
2024-01-15 15:16:08.336 [DBG] HSWC: ChannelLink(c32913f9d93b1d81ad5c7930cb3110f04de4c00d5454b5dcc6054c42925553d0:14): Failed to send 100000 mSAT
2024-01-15 15:16:08.336 [DBG] HSWC: Closed completed FAIL circuit for 1c680498a75f07473c3f902dd45218b59ef1fc4739b330062a22ad861c573308: (0:0:0, 37001) <-> (824361:2226:14, 32)
2024-01-15 15:16:08.336 [DBG] HSWC: Storing result for paymentID=37001
2024-01-15 15:16:08.340 [DBG] HSWC: Received network result *lnwire.UpdateFailHTLC for attemptID=37001
2024-01-15 15:16:08.342 [INF] WTCL: (anchor) Queued backup(d0535592424c05c6dcb554540dc0e44df01031cb30795cad811d3bd9f91329cd, 128) successfully for session 02ff3c7a6e3079e29d429e8d3da537122d48e6c5efdeadadc97f7faca676d579b2
2024-01-15 15:16:08.345 [DBG] HSWC: Tearing down open circuit with FAIL pkt, removing circuit=(Chan ID=0:0:0, HTLC ID=37001) with keystone=(Chan ID=824361:2226:14, HTLC ID=32)
2024-01-15 15:16:08.345 [WRN] CRTR: Attempt 37001 for payment 1c680498a75f07473c3f902dd45218b59ef1fc4739b330062a22ad861c573308 failed: IncorrectOrUnknownPaymentDetails(amt=100000 mSAT, height=825901)@3
2024-01-15 15:16:08.348 [DBG] HSWC: Closed completed FAIL circuit for 1c680498a75f07473c3f902dd45218b59ef1fc4739b330062a22ad861c573308: (0:0:0, 37001) <-> (824361:2226:14, 32)
2024-01-15 15:16:08.359 [INF] CRTR: Payment 1c680498a75f07473c3f902dd45218b59ef1fc4739b330062a22ad861c573308 failed: final_outcome=incorrect_payment_details, raw_err=IncorrectOrUnknownPaymentDetails(amt=100000 mSAT, height=825901)@3

@ziggie1984
Copy link
Collaborator

ziggie1984 commented Jan 15, 2024

Your problem is the following:

Your final_cltv_delta is 99 in the invoice. But buildroute uses 80 as a default so just use the custom final_ctlv_delta when building the route.

buildroute --final_cltv_delta ...

@ziggie1984
Copy link
Collaborator

Normally lnd uses 80 as well, so I guess you are using the DefaultCLTVExpiry setting in the lnd.conf. lncli is not aware of this config change.

@zapomatic
Copy link
Author

That worked perfectly! Thanks for all the help. Is this worth a more descriptive error message?

@zapomatic
Copy link
Author

zapomatic commented Jan 15, 2024

Given that high fee environment docs encourage nodes to update bitcoin.timelockdelta=144, I think this is something a lot of new node runners are probably experiencing but not realizing as tools like igniter, or circular rebalance instructions from services like lightningnetwork.plus fail. Granted, these services should update their logic/instructions to add the --final_cltv_delta flag, but they might not realize they need to do that without a more specific error message.

@guggero
Copy link
Collaborator

guggero commented Jan 15, 2024

A more explicit error message would need to be sent by the receiver of the payment. So a change in the spec would probably be required. Also, due to privacy reasons some errors are very vague on purpose. Therefore I don't think there's much to be done here.
Perhaps it would be worth updating the documentation for the BuildRoute RPC to mention the final CLTV delta requirement?

@ziggie1984
Copy link
Collaborator

Agree, let's update the docs, I think that's the best we can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants