lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.67k stars 2.07k forks source link

commitment transaction dips peer below chan reserve #6940

Closed philipp1992 closed 9 months ago

philipp1992 commented 2 years ago

Background

Im running 3 LND instances

lnd-1--chan--lnd-2--chan--lnd-3

When creating a hodlinvoice on 3, i get the following error: [DBG] LNWL: ChannelPoint(606249f2b0cad6976cbb120d242dfc90c327648dfccb5b3e6275e819b5366b89:0): May add outgoing htlc rejected: commitment transaction dips peer below chan reserve

The channels have pending / stuck HTLC, but the amount of those is not as high as it would cause the above error.

From lnd-2

LND-2:/# lncli --rpcserver=localhost:10000 --macaroonpath=/data/chain/bitcoin/testnet/admin.macaroon --tlscertpath=/data/tls.cert listchannels --peer $LND1 |grep unsett "unsettled_balance": "79543", "unsettled_balance": "59172",

LND-2:/# lncli --rpcserver=localhost:10000 --macaroonpath=/data/chain/bitcoin/testnet/admin.macaroon --tlscertpath=/data/tls.cert listchannels --peer $LND3 |grep unsett "unsettled_balance": "0", "unsettled_balance": "115114",

Your environment

lnd-2 listchannels lnd-1


{
    "channels": [
        {
            "active": true,
            "remote_pubkey": "02d075fc84c5e79a972cae66221316c71347b902283f30eee2a190c857b46241bf",
            "channel_point": "2afe4eb76bed3ca8f6427474cd82f2d087f5dc5ed06caa2b2798781e6cd14168:1",
            "chan_id": "2514911846702448641",
            "capacity": "15000000",
            "local_balance": "477014",
            "remote_balance": "14465732",
            "commit_fee": "720",
            "commit_weight": "2836",
            "fee_per_kw": "253",
            "unsettled_balance": "55874",
            "total_satoshis_sent": "158713",
            "total_satoshis_received": "691601",
            "num_updates": "957",
            "pending_htlcs": [
                {
                    "incoming": false,
                    "amount": "6303",
                    "hash_lock": "0d338a628bda87f0dcd50916d2fa19b64187204ae5a649e9c714fcef3c3b2679",
                    "expiration_height": 2347737,
                    "htlc_index": "152",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "401"
                },
                {
                    "incoming": false,
                    "amount": "7341",
                    "hash_lock": "d819f717ceca53726cf8c361144a95952cf0e7d9fccf708df0e8a08e81486e40",
                    "expiration_height": 2347737,
                    "htlc_index": "153",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "402"
                },
                {
                    "incoming": false,
                    "amount": "6092",
                    "hash_lock": "de73f2bd458374c0ae96431e11f4e097478ac5fed3198cb75a2843f9eb7ac6bb",
                    "expiration_height": 2347737,
                    "htlc_index": "154",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "404"
                },
                {
                    "incoming": false,
                    "amount": "676",
                    "hash_lock": "57df6c1ccc63716d457969e45563bf5b33c135124bf2fac777c4fbfe52597a2f",
                    "expiration_height": 2347737,
                    "htlc_index": "155",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "405"
                },
                {
                    "incoming": false,
                    "amount": "6793",
                    "hash_lock": "0146ccef3f79f4bf3bd8a4c8865d9b49543d0ec31ac80c6c9a4410a90873e0b6",
                    "expiration_height": 2347737,
                    "htlc_index": "156",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "406"
                },
                {
                    "incoming": false,
                    "amount": "7334",
                    "hash_lock": "632f3fa7a79306a15a34bac02b9951619f8f2f94df3810438d0532402d4fd1b5",
                    "expiration_height": 2347737,
                    "htlc_index": "157",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "407"
                },
                {
                    "incoming": false,
                    "amount": "817",
                    "hash_lock": "b97808c9ad0f488e885946328614e94d73bb8cc67718a75754f25774c50d1b64",
                    "expiration_height": 2347737,
                    "htlc_index": "158",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "408"
                },
                {
                    "incoming": false,
                    "amount": "6109",
                    "hash_lock": "8a716be1037a352c17dd50bb453b7758c6494dc5af3d1e3303fcf5be22d0cf22",
                    "expiration_height": 2347737,
                    "htlc_index": "159",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "410"
                },
                {
                    "incoming": false,
                    "amount": "7060",
                    "hash_lock": "00704ed4d70b7a630b6d947abcb492507333838906743a888edbd4f2786ed8da",
                    "expiration_height": 2347738,
                    "htlc_index": "160",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "413"
                },
                {
                    "incoming": false,
                    "amount": "7349",
                    "hash_lock": "de8d909861b4f5cd0115476b8c3150e306dff31c75c8a1c13081eb730784beac",
                    "expiration_height": 2347740,
                    "htlc_index": "161",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "416"
                }
            ],
            "csv_delay": 3,
            "private": false,
            "initiator": false,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "150000",
            "remote_chan_reserve_sat": "150000",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "5447240",
            "uptime": "5447006",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 3,
                "chan_reserve_sat": "150000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "14850000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 3,
                "chan_reserve_sat": "150000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "14850000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            }
        },
        {
            "active": true,
            "remote_pubkey": "02d075fc84c5e79a972cae66221316c71347b902283f30eee2a190c857b46241bf",
            "channel_point": "2e718abe5b65ae5b31d32c15cd8bfd3c39e1313700642d518142726b0af745eb:1",
            "chan_id": "2514906349145358337",
            "capacity": "15000000",
            "local_balance": "14633771",
            "remote_balance": "307081",
            "commit_fee": "1094",
            "commit_weight": "3008",
            "fee_per_kw": "253",
            "unsettled_balance": "57725",
            "total_satoshis_sent": "307081",
            "total_satoshis_received": "0",
            "num_updates": "472",
            "pending_htlcs": [
                {
                    "incoming": false,
                    "amount": "6457",
                    "hash_lock": "c93d3fe69c0f116ae4207e38a3f3dbe756d3f544e617b7c5f081b859559b1aeb",
                    "expiration_height": 2347735,
                    "htlc_index": "244",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "391"
                },
                {
                    "incoming": false,
                    "amount": "7334",
                    "hash_lock": "820d579a2ad1200374cffd0488691220ab9430d8b2d511446f5e334c2d8876b5",
                    "expiration_height": 2347735,
                    "htlc_index": "245",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "392"
                },
                {
                    "incoming": false,
                    "amount": "6937",
                    "hash_lock": "20e1e1735412ffb79f0de859a38022f6298aa953536fbb549afbf51688a3a8d6",
                    "expiration_height": 2347737,
                    "htlc_index": "251",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "403"
                },
                {
                    "incoming": false,
                    "amount": "7349",
                    "hash_lock": "5ff50c2323383fce2be50ad2988abc4dc3dd99eaff41f04283069ce03aeef199",
                    "expiration_height": 2347737,
                    "htlc_index": "252",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "409"
                },
                {
                    "incoming": false,
                    "amount": "6084",
                    "hash_lock": "bbfb7ea8e650d9e53005e18a633c775453a9708b6d364dc389e1dbdeb4816850",
                    "expiration_height": 2347738,
                    "htlc_index": "253",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "411"
                },
                {
                    "incoming": false,
                    "amount": "7334",
                    "hash_lock": "8040c1a890efb6073cc584571018337ad4ba3f80d69d4a687a871fa3a0e87446",
                    "expiration_height": 2347738,
                    "htlc_index": "254",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "412"
                },
                {
                    "incoming": false,
                    "amount": "6003",
                    "hash_lock": "f823f49db1671c4cef35c99551a7eb4aba3656ebd5103d72c516f037c62014de",
                    "expiration_height": 2347740,
                    "htlc_index": "255",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "414"
                },
                {
                    "incoming": false,
                    "amount": "331",
                    "hash_lock": "3f2d207251c2a0ea04ca6b07f1877c26d0b07bfbf43cd6eb11a3dfbd74e7393d",
                    "expiration_height": 2347740,
                    "htlc_index": "256",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "415"
                },
                {
                    "incoming": false,
                    "amount": "7099",
                    "hash_lock": "63debdabfd84228799716da9ed152d06a33245b084e4dc3962361e7b1e9a73e4",
                    "expiration_height": 2347740,
                    "htlc_index": "257",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "417"
                },
                {
                    "incoming": false,
                    "amount": "891",
                    "hash_lock": "07c177ea46fd40989a7dd762eaf392ba712c71048cfcb23e4ebc96a84f0ebe0b",
                    "expiration_height": 2347740,
                    "htlc_index": "258",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "418"
                },
                {
                    "incoming": false,
                    "amount": "640",
                    "hash_lock": "ba6f7dc3968aee39dde273f3bf5222727e0bd2191313acc1c459f9c347d29d80",
                    "expiration_height": 2347740,
                    "htlc_index": "259",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "419"
                },
                {
                    "incoming": false,
                    "amount": "1266",
                    "hash_lock": "e7366d3ccfa29e16ab211eded54fbdf3d6fccf66eeb6b3c20e5b60a31656fc74",
                    "expiration_height": 2347744,
                    "htlc_index": "260",
                    "forwarding_channel": "2514911846702514177",
                    "forwarding_htlc_index": "420"
                }
            ],
            "csv_delay": 3,
            "private": false,
            "initiator": true,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "150000",
            "remote_chan_reserve_sat": "150000",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "5449234",
            "uptime": "5449000",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 3,
                "chan_reserve_sat": "150000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "14850000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 3,
                "chan_reserve_sat": "150000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "14850000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            }
        }
    ]
}

lnd2 listchannels lnd-3


{
    "channels": [
        {
            "active": true,
            "remote_pubkey": "0245d3a17856831ff07e70e1963cb89ec545b5be7cdeccf311a736bb2e2e25ee13",
            "channel_point": "606249f2b0cad6976cbb120d242dfc90c327648dfccb5b3e6275e819b5366b89:0",
            "chan_id": "2581288264158347264",
            "capacity": "15000000",
            "local_balance": "14879772",
            "remote_balance": "119284",
            "commit_fee": "284",
            "commit_weight": "1116",
            "fee_per_kw": "253",
            "unsettled_balance": "0",
            "total_satoshis_sent": "119284",
            "total_satoshis_received": "0",
            "num_updates": "54",
            "pending_htlcs": [
            ],
            "csv_delay": 3,
            "private": false,
            "initiator": true,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "150000",
            "remote_chan_reserve_sat": "150000",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "21231",
            "uptime": "21231",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 3,
                "chan_reserve_sat": "150000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "14850000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 3,
                "chan_reserve_sat": "150000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "14850000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            }
        },
        {
            "active": true,
            "remote_pubkey": "0245d3a17856831ff07e70e1963cb89ec545b5be7cdeccf311a736bb2e2e25ee13",
            "channel_point": "2d9b5dbb8fccfe069c575916cf1dbaa9b951be92504c241289d4fa1802d2f4c2:1",
            "chan_id": "2514911846702514177",
            "capacity": "15000000",
            "local_balance": "217087",
            "remote_balance": "14667433",
            "commit_fee": "1531",
            "commit_weight": "4728",
            "fee_per_kw": "253",
            "unsettled_balance": "113621",
            "total_satoshis_sent": "228820",
            "total_satoshis_received": "445907",
            "num_updates": "867",
            "pending_htlcs": [
                {
                    "incoming": true,
                    "amount": "6458",
                    "hash_lock": "c93d3fe69c0f116ae4207e38a3f3dbe756d3f544e617b7c5f081b859559b1aeb",
                    "expiration_height": 2347753,
                    "htlc_index": "391",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "244"
                },
                {
                    "incoming": true,
                    "amount": "7335",
                    "hash_lock": "820d579a2ad1200374cffd0488691220ab9430d8b2d511446f5e334c2d8876b5",
                    "expiration_height": 2347753,
                    "htlc_index": "392",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "245"
                },
                {
                    "incoming": true,
                    "amount": "6304",
                    "hash_lock": "0d338a628bda87f0dcd50916d2fa19b64187204ae5a649e9c714fcef3c3b2679",
                    "expiration_height": 2347755,
                    "htlc_index": "401",
                    "forwarding_channel": "2514911846702448641",
                    "forwarding_htlc_index": "152"
                },
                {
                    "incoming": true,
                    "amount": "7342",
                    "hash_lock": "d819f717ceca53726cf8c361144a95952cf0e7d9fccf708df0e8a08e81486e40",
                    "expiration_height": 2347755,
                    "htlc_index": "402",
                    "forwarding_channel": "2514911846702448641",
                    "forwarding_htlc_index": "153"
                },
                {
                    "incoming": true,
                    "amount": "6938",
                    "hash_lock": "20e1e1735412ffb79f0de859a38022f6298aa953536fbb549afbf51688a3a8d6",
                    "expiration_height": 2347755,
                    "htlc_index": "403",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "251"
                },
                {
                    "incoming": true,
                    "amount": "6093",
                    "hash_lock": "de73f2bd458374c0ae96431e11f4e097478ac5fed3198cb75a2843f9eb7ac6bb",
                    "expiration_height": 2347755,
                    "htlc_index": "404",
                    "forwarding_channel": "2514911846702448641",
                    "forwarding_htlc_index": "154"
                },
                {
                    "incoming": true,
                    "amount": "677",
                    "hash_lock": "57df6c1ccc63716d457969e45563bf5b33c135124bf2fac777c4fbfe52597a2f",
                    "expiration_height": 2347755,
                    "htlc_index": "405",
                    "forwarding_channel": "2514911846702448641",
                    "forwarding_htlc_index": "155"
                },
                {
                    "incoming": true,
                    "amount": "6794",
                    "hash_lock": "0146ccef3f79f4bf3bd8a4c8865d9b49543d0ec31ac80c6c9a4410a90873e0b6",
                    "expiration_height": 2347755,
                    "htlc_index": "406",
                    "forwarding_channel": "2514911846702448641",
                    "forwarding_htlc_index": "156"
                },
                {
                    "incoming": true,
                    "amount": "7335",
                    "hash_lock": "632f3fa7a79306a15a34bac02b9951619f8f2f94df3810438d0532402d4fd1b5",
                    "expiration_height": 2347755,
                    "htlc_index": "407",
                    "forwarding_channel": "2514911846702448641",
                    "forwarding_htlc_index": "157"
                },
                {
                    "incoming": true,
                    "amount": "818",
                    "hash_lock": "b97808c9ad0f488e885946328614e94d73bb8cc67718a75754f25774c50d1b64",
                    "expiration_height": 2347755,
                    "htlc_index": "408",
                    "forwarding_channel": "2514911846702448641",
                    "forwarding_htlc_index": "158"
                },
                {
                    "incoming": true,
                    "amount": "7350",
                    "hash_lock": "5ff50c2323383fce2be50ad2988abc4dc3dd99eaff41f04283069ce03aeef199",
                    "expiration_height": 2347755,
                    "htlc_index": "409",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "252"
                },
                {
                    "incoming": true,
                    "amount": "6110",
                    "hash_lock": "8a716be1037a352c17dd50bb453b7758c6494dc5af3d1e3303fcf5be22d0cf22",
                    "expiration_height": 2347755,
                    "htlc_index": "410",
                    "forwarding_channel": "2514911846702448641",
                    "forwarding_htlc_index": "159"
                },
                {
                    "incoming": true,
                    "amount": "6085",
                    "hash_lock": "bbfb7ea8e650d9e53005e18a633c775453a9708b6d364dc389e1dbdeb4816850",
                    "expiration_height": 2347756,
                    "htlc_index": "411",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "253"
                },
                {
                    "incoming": true,
                    "amount": "7335",
                    "hash_lock": "8040c1a890efb6073cc584571018337ad4ba3f80d69d4a687a871fa3a0e87446",
                    "expiration_height": 2347756,
                    "htlc_index": "412",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "254"
                },
                {
                    "incoming": true,
                    "amount": "7061",
                    "hash_lock": "00704ed4d70b7a630b6d947abcb492507333838906743a888edbd4f2786ed8da",
                    "expiration_height": 2347756,
                    "htlc_index": "413",
                    "forwarding_channel": "2514911846702448641",
                    "forwarding_htlc_index": "160"
                },
                {
                    "incoming": true,
                    "amount": "6004",
                    "hash_lock": "f823f49db1671c4cef35c99551a7eb4aba3656ebd5103d72c516f037c62014de",
                    "expiration_height": 2347758,
                    "htlc_index": "414",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "255"
                },
                {
                    "incoming": true,
                    "amount": "332",
                    "hash_lock": "3f2d207251c2a0ea04ca6b07f1877c26d0b07bfbf43cd6eb11a3dfbd74e7393d",
                    "expiration_height": 2347758,
                    "htlc_index": "415",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "256"
                },
                {
                    "incoming": true,
                    "amount": "7350",
                    "hash_lock": "de8d909861b4f5cd0115476b8c3150e306dff31c75c8a1c13081eb730784beac",
                    "expiration_height": 2347758,
                    "htlc_index": "416",
                    "forwarding_channel": "2514911846702448641",
                    "forwarding_htlc_index": "161"
                },
                {
                    "incoming": true,
                    "amount": "7100",
                    "hash_lock": "63debdabfd84228799716da9ed152d06a33245b084e4dc3962361e7b1e9a73e4",
                    "expiration_height": 2347758,
                    "htlc_index": "417",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "257"
                },
                {
                    "incoming": true,
                    "amount": "892",
                    "hash_lock": "07c177ea46fd40989a7dd762eaf392ba712c71048cfcb23e4ebc96a84f0ebe0b",
                    "expiration_height": 2347758,
                    "htlc_index": "418",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "258"
                },
                {
                    "incoming": true,
                    "amount": "641",
                    "hash_lock": "ba6f7dc3968aee39dde273f3bf5222727e0bd2191313acc1c459f9c347d29d80",
                    "expiration_height": 2347758,
                    "htlc_index": "419",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "259"
                },
                {
                    "incoming": true,
                    "amount": "1267",
                    "hash_lock": "e7366d3ccfa29e16ab211eded54fbdf3d6fccf66eeb6b3c20e5b60a31656fc74",
                    "expiration_height": 2347762,
                    "htlc_index": "420",
                    "forwarding_channel": "2514906349145358337",
                    "forwarding_htlc_index": "260"
                }
            ],
            "csv_delay": 3,
            "private": false,
            "initiator": false,
            "chan_status_flags": "ChanStatusDefault",
            "local_chan_reserve_sat": "150000",
            "remote_chan_reserve_sat": "150000",
            "static_remote_key": false,
            "commitment_type": "ANCHORS",
            "lifetime": "5447275",
            "uptime": "5447064",
            "close_address": "",
            "push_amount_sat": "0",
            "thaw_height": 0,
            "local_constraints": {
                "csv_delay": 3,
                "chan_reserve_sat": "150000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "14850000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            },
            "remote_constraints": {
                "csv_delay": 3,
                "chan_reserve_sat": "150000",
                "dust_limit_sat": "354",
                "max_pending_amt_msat": "14850000000",
                "min_htlc_msat": "1",
                "max_accepted_htlcs": 483
            }
        }
    ]
}

lnd-3 log

2022-09-23 12:51:29.463 [DBG] CRTR: Payment e7366d3ccfa29e16ab211eded54fbdf3d6fccf66eeb6b3c20e5b60a31656fc74 in state terminate=false, active_shards=0, rem_value=1266000 mSAT, fee_limit=100000000000 mSAT
2022-09-23 12:51:29.471 [DBG] CRTR: PaymentSession(e7366d3ccfa29e16ab211eded54fbdf3d6fccf66eeb6b3c20e5b60a31656fc74): pathfinding for amt=1266000 mSAT
2022-09-23 12:51:29.472 [DBG] LNWL: ChannelPoint(606249f2b0cad6976cbb120d242dfc90c327648dfccb5b3e6275e819b5366b89:0): May add outgoing htlc rejected: commitment transaction dips peer below chan reserve
2022-09-23 12:51:29.474 [DBG] CRTR: Pathfinding absolute attempt cost: 101.266 sats
2022-09-23 12:51:29.475 [DBG] LNWL: ChannelPoint(606249f2b0cad6976cbb120d242dfc90c327648dfccb5b3e6275e819b5366b89:0): May add outgoing htlc rejected: commitment transaction dips peer below chan reserve
2022-09-23 12:51:29.479 [DBG] CRTR: Found route: probability=0.9025, hops=2, fee=1001 mSAT
2022-09-23 12:51:29.481 [DBG] CRTR: Pathfinding perf metrics: nodes=2, edges=65, time=10.226725ms
2022-09-23 12:51:29.557 [DBG] HSWC: ChannelLink(2d9b5dbb8fccfe069c575916cf1dbaa9b951be92504c241289d4fa1802d2f4c2:1): queueing keystone of ADD open circuit: (Chan ID=0:0:0, HTLC ID=3083)->(Chan ID=2287299:32:1, HTLC ID=420)
2022-09-23 12:51:29.558 [DBG] PEER: Sending UpdateAddHTLC(chan_id=c2f4d20218fad48912244c5092be51b9a9ba1dcf1659579c06fecc8fbb5d9b2c, id=420, amt=1267001 mSAT, expiry=2347762, hash=e7366d3ccfa29e16ab211eded54fbdf3d6fccf66eeb6b3c20e5b60a31656fc74) to 02c37560a8f8b82c065abe4c0ce92525398de43931e35196d0155e51c26bde10b4@161.97.146.5:23307
2022-09-23 12:51:29.558 [DBG] CRTR: Payment e7366d3ccfa29e16ab211eded54fbdf3d6fccf66eeb6b3c20e5b60a31656fc74 (pid=3083) successfully sent to switch, route: 2514911846702514177 (1267001 mSAT) -> 2514906349145358337 (1266000 mSAT), cltv 2347762
2022-09-23 12:51:29.560 [DBG] CRTR: Payment e7366d3ccfa29e16ab211eded54fbdf3d6fccf66eeb6b3c20e5b60a31656fc74 in state terminate=false, active_shards=1, rem_value=0 mSAT, fee_limit=99999998999 mSAT
Roasbeef commented 2 years ago

Are you able to reproduce this with lnd v0.15.1?

This sounds expected: each time you add an HTLC, you need to also pay for the fee to add that to the commitment transaction. If you try to add an HTLC, but maybe have the correct balance, it's possible after adding the required fee (at the current fee rate) you don't have enough to still maintain the reserve.

philipp1992 commented 2 years ago

even with the fees added to the calculation, it does not add up to a number that would exceed the channel reserves or am i missing something here?

Base Fees (mSats) 1,000 Fee Rate (milli mSats) 1 Fee Rate (%) 0.0001 Time Lock Delta 18

is it possible to lower the timelock to less than 18 blocks , so we dont have too many pending HTLCs?

Roasbeef commented 2 years ago

So I mean chain fees here. Each HTLC you have increases the size of the commitment transaction. So it's possible that you have enough to send, but once you add the HTLC, those fees are too much.

is it possible to lower the timelock to less than 18 blocks , so we dont have too many pending HTLCs?

These aren't really correlated. However I strongly recommend you increase that CLTV delta to more than 18 blocks (our default is 40, and we're looking at increasing it even further). This is a security parameter, if you can't get a confirmation in that period, then you can risk losing HTLCs.

philipp1992 commented 1 year ago

can you elaborate what you mean with chain fees? does the fee_sat parameter of the payment affect this? shouldnt this also be an [Err] log instead of a debug one?

So it's possible that you have enough to send, but once you add the HTLC, those fees are too much. can you tell that from the logs ive posted?

bitromortac commented 1 year ago

In the initial issue you wrote When creating a hodlinvoice on 3, but from the logs it looks like you attempt a payment from lnd-3 is that correct?

From the logs

            "remote_pubkey": "0245d3a17856831ff07e70e1963cb89ec545b5be7cdeccf311a736bb2e2e25ee13",
            "channel_point": "606249f2b0cad6976cbb120d242dfc90c327648dfccb5b3e6275e819b5366b89:0",
            "chan_id": "2581288264158347264",
            "capacity": "15000000",
            "local_balance": "14879772",
            "remote_balance": "119284",

we can see that the remote balance is already below the channel reserve (150000).

Roasbeef commented 9 months ago

Fixed by https://github.com/lightningnetwork/lnd/pull/8096