alexbosworth / ln-service

Node.js interface to LND
MIT License
318 stars 61 forks source link

some is_pending are true but should be false #139

Open nicolasburtey opened 3 years ago

nicolasburtey commented 3 years ago

doing a await lnService.getClosedChannels({lnd}) and looping over the close_payments array.

I have this result on one of the item:

  {
    ...
    close_transaction_id: '56606548dd251395d67a41a355bc54aa40d1061bb065e81c403815e3506c746d',
   ...
    close_payments: [
      {
        is_paid: false,
        spent_by: 'fcfd551b8dad977156399bb368f34bbb8ced5fbfb3c19f9360e5a90428bb01f2',
        transaction_id: 'd85f18f3755d85b2fb29f9331886c5e20c42749df7926c5202f6e21f41951047',
        is_pending: false,
        transaction_vout: 0,
        is_refunded: true,
        is_outgoing: true,
        tokens: 373777
      },
      {
        spent_by: '091eeaabecc9d5a7750c8032914ef52151fc25e9ecc3cb550322c0e4c1c755ad',
        transaction_id: '82ada5a715b24ac00dbc9ff7270a5aa701e899b7d83aea1846aafdb0283d3c52',
        is_paid: false,
        is_pending: false,
        tokens: 381093,
        is_refunded: true,
        transaction_vout: 0,
        is_outgoing: true
      },
      {
        is_refunded: false,
        transaction_vout: 0,
        tokens: 392171,
        is_pending: true,
        spent_by: 'd85f18f3755d85b2fb29f9331886c5e20c42749df7926c5202f6e21f41951047',
        is_outgoing: true,
        transaction_id: '56606548dd251395d67a41a355bc54aa40d1061bb065e81c403815e3506c746d',
        is_paid: false
      },
      {
        transaction_vout: 1,
        tokens: 399487,
        spent_by: '82ada5a715b24ac00dbc9ff7270a5aa701e899b7d83aea1846aafdb0283d3c52',
        is_paid: false,
        is_pending: true,
        transaction_id: '56606548dd251395d67a41a355bc54aa40d1061bb065e81c403815e3506c746d',
        is_outgoing: true,
        is_refunded: false
      }
    ],
   ...
  },

looking at the transaction, they have been mined ~6 months ago. and are still pending: true.

I don't know if this is a state issue in lnd, or if this is how Ln Service fetches the value that is not right?

alexbosworth commented 3 years ago

I'm not sure, pending in the result maps to "first stage" outcome in the response, normally when it was resolved it would map to "claimed" or "timeout"

nicolasburtey commented 3 years ago

do you know if there is a way to mitigate such issues? Worth opening a ticket on the main lnd repo? The issue happened probably 2 lnd version ago. I had the issue on 2 different channels.

As a workaround, is it possible to force delete the channel such that it no longer in the db?

alexbosworth commented 3 years ago

Can you paste the output of the lncli closedchannels to see if it is mapping ok?

alexbosworth commented 3 years ago

I don't think you can force delete a channel aside from abandonchannel

nicolasburtey commented 3 years ago
"resolutions": [
                {
                    "resolution_type": "OUTGOING_HTLC",
                    "outcome": "TIMEOUT",
                    "outpoint": {
                        "txid_bytes": "471095411fe2f602526c92f79d74420ce2c5861833f929fbb2855d75f3185fd8",
                        "txid_str": "d85f18f3755d85b2fb29f9331886c5e20c42749df7926c5202f6e21f41951047",
                        "output_index": 0
                    },
                    "amount_sat": "373777",
                    "sweep_txid": "fcfd551b8dad977156399bb368f34bbb8ced5fbfb3c19f9360e5a90428bb01f2"
                },
                {
                    "resolution_type": "OUTGOING_HTLC",
                    "outcome": "TIMEOUT",
                    "outpoint": {
                        "txid_bytes": "523c3d28b0fdaa4618ea3ad8b799e801a75a0a27f79fbc0dc04ab215a7a5ad82",
                        "txid_str": "82ada5a715b24ac00dbc9ff7270a5aa701e899b7d83aea1846aafdb0283d3c52",
                        "output_index": 0
                    },
                    "amount_sat": "381093",
                    "sweep_txid": "091eeaabecc9d5a7750c8032914ef52151fc25e9ecc3cb550322c0e4c1c755ad"
                },
                {
                    "resolution_type": "OUTGOING_HTLC",
                    "outcome": "FIRST_STAGE",
                    "outpoint": {
                        "txid_bytes": "6d746c50e31538401ce865b01b06d140aa54bc55a3417ad6951325dd48656056",
                        "txid_str": "56606548dd251395d67a41a355bc54aa40d1061bb065e81c403815e3506c746d",
                        "output_index": 0
                    },
                    "amount_sat": "392171",
                    "sweep_txid": "d85f18f3755d85b2fb29f9331886c5e20c42749df7926c5202f6e21f41951047"
                },
                {
                    "resolution_type": "OUTGOING_HTLC",
                    "outcome": "FIRST_STAGE",
                    "outpoint": {
                        "txid_bytes": "6d746c50e31538401ce865b01b06d140aa54bc55a3417ad6951325dd48656056",
                        "txid_str": "56606548dd251395d67a41a355bc54aa40d1061bb065e81c403815e3506c746d",
                        "output_index": 1
                    },
                    "amount_sat": "399487",
                    "sweep_txid": "82ada5a715b24ac00dbc9ff7270a5aa701e899b7d83aea1846aafdb0283d3c52"
                },
                {
                    "resolution_type": "COMMIT",
                    "outcome": "CLAIMED",
                    "outpoint": {
                        "txid_bytes": "6d746c50e31538401ce865b01b06d140aa54bc55a3417ad6951325dd48656056",
                        "txid_str": "56606548dd251395d67a41a355bc54aa40d1061bb065e81c403815e3506c746d",
                        "output_index": 2
                    },
                    "amount_sat": "4638822",
                    "sweep_txid": "3a43bc132fb9fecaed0365d2a5e2b6ae4b9aa10bc21069cc8e40452bdc3c2fee"
                }
            ]
        },

seems to be a bug from lnd?

could there be any issue to abandon channel for a closed channel (beyond losing the history on this channel)?

alexbosworth commented 3 years ago

It seems weird that it says it's in FIRST STAGE forever yeah, I could see it if it were a very small amount