container: hledger-flow: electrum: add lightning, backwards compat #227

Merged
AaronFiore merged 0 commits from refs/pull/227/head into master 2025-10-29 23:20:39 +00:00
AaronFiore commented 2025-10-10 22:01:40 +00:00 (Migrated from gitea.com)

Description

⚠️ Do not merge until electrum resolves history bug

The electrum lightning history issue has been moved to #233


This PR is needed for backwards compatibility, as the new electrum format will break import - even if lightning is never used.

Agreement

### Description ~⚠️ Do not merge until electrum resolves history bug~ The electrum lightning history issue has been moved to #233 --- This PR is needed for backwards compatibility, as the new electrum format will break import - even if lightning is never used. ### Agreement - [x] I have read and understood the [Development](https://gitea.com/EvergreenCrypto/docker-finance#development) and [License](https://gitea.com/EvergreenCrypto/docker-finance#license-and-disclaimer) documentation
AaronFiore commented 2025-10-10 23:10:30 +00:00 (Migrated from gitea.com)

When using the following:

  • electrum 4.6.2 (linux desktop)
  • testnet3
  • lightning (trampoline enabled)

After having opened a channel and sent some sats, a cooperative close had lead to a forced close by remote; leaving me with local txs sweep local_anchor and sweep our_ctx_to_local for many confirmations (as expected).

However, once fully confirmed:

  • None of the subsequent oc txs are accurately labeled
    • They also appear to not have a group_id
  • The final Close channel is without a ln hash or oc txid and has a lone group_id (without any other txs in that group)
    • Since the CSV export does not contain group_id or any identifying hash for this tx, it effectively becomes a "mystery" tx and relies on associating through label (which won't work here, as rules are processed linearly).

onchain_history

[
    {
        "amount_sat": 128436,
        "bc_balance": "0.00128436",
        "bc_value": "0.00128436",
        "confirmations": 1110,
        "date": "2025-10-02 19:18",
        "fee_sat": null,
        "group_id": null,
        "height": 4735488,
        "incoming": true,
        "label": "Testnet3 faucet (income)",
        "monotonic_timestamp": 1759457891,
        "timestamp": 1759457891,
        "txid": "a01c1a2deaa047ef3fd49c01360ddbab88e071a37e85d5446a2a713efa6e5500",
        "txpos_in_block": 128,
        "wanted_height": null
    },
    {
        "amount_sat": 168871,
        "bc_balance": "0.00297307",
        "bc_value": "0.00168871",
        "confirmations": 1110,
        "date": "2025-10-02 19:18",
        "fee_sat": null,
        "group_id": null,
        "height": 4735488,
        "incoming": true,
        "label": "Testnet3 faucet (income)",
        "monotonic_timestamp": 1759457891,
        "timestamp": 1759457891,
        "txid": "1802953f7f1889fa8034a8170e5b709100f67dad2bae3a110bb80287b53b2811",
        "txpos_in_block": 129,
        "wanted_height": null
    },
    {
        "amount_sat": 181488,
        "bc_balance": "0.00478795",
        "bc_value": "0.00181488",
        "confirmations": 1110,
        "date": "2025-10-02 19:18",
        "fee_sat": null,
        "group_id": null,
        "height": 4735488,
        "incoming": true,
        "label": "Testnet3 faucet (income)",
        "monotonic_timestamp": 1759457891,
        "timestamp": 1759457891,
        "txid": "db9a16c4661ef161f7bd099ab4c65391dbd6b220055365892ee6958b3d9b431f",
        "txpos_in_block": 130,
        "wanted_height": null
    },
    {
        "amount_sat": -200634,
        "bc_balance": "0.00278161",
        "bc_value": "-0.00200634",
        "confirmations": 1096,
        "date": "2025-10-02 19:56",
        "fee_sat": 634,
        "group_id": "e522cf029812d0b9e7e38e66eb069314b14978d5473faeb7302fdd75366475eb",
        "height": 4735502,
        "incoming": false,
        "label": "Open channel 4735502x1x2",
        "monotonic_timestamp": 1759460195,
        "timestamp": 1759460195,
        "txid": "e522cf029812d0b9e7e38e66eb069314b14978d5473faeb7302fdd75366475eb",
        "txpos_in_block": 1,
        "wanted_height": null
    },
    {
        "amount_sat": 198197,
        "bc_balance": "0.00476358",
        "bc_value": "0.00198197",
        "confirmations": 972,
        "date": "2025-10-03 15:52",
        "fee_sat": 1803,
        "group_id": "fb4c75494cabda8b066d13a5b7d2df4392cd67707ddbf7845ecfff6520a072c2",
        "height": 4735626,
        "incoming": true,
        "label": "Close channel 4735502x1x2",
        "monotonic_timestamp": 1759531975,
        "timestamp": 1759531975,
        "txid": "fb4c75494cabda8b066d13a5b7d2df4392cd67707ddbf7845ecfff6520a072c2",
        "txpos_in_block": 5,
        "wanted_height": null
    },
    {
        "amount_sat": -102797,
        "bc_balance": "0.00373561",
        "bc_value": "-0.00102797",
        "confirmations": 971,
        "date": "2025-10-03 16:12",
        "fee_sat": 2797,
        "group_id": null,
        "height": 4735627,
        "incoming": false,
        "label": "Testnet3 faucet (donate)",
        "monotonic_timestamp": 1759533176,
        "timestamp": 1759533176,
        "txid": "f6f208349a6c5bac419bf2258b599526e3ad1b073204c4feee1c8fdd04567fea",
        "txpos_in_block": 8,
        "wanted_height": null
    },
    {
        "amount_sat": -204941,
        "bc_balance": "0.0016862",
        "bc_value": "-0.00204941",
        "confirmations": 968,
        "date": "2025-10-03 17:18",
        "fee_sat": 4941,
        "group_id": "6333ecd263e5a2c8e20764ff47a1d95d13257da7593e61244a0a9eacad558af2",
        "height": 4735630,
        "incoming": false,
        "label": "Open channel 4735630x17x2",
        "monotonic_timestamp": 1759537091,
        "timestamp": 1759537091,
        "txid": "6333ecd263e5a2c8e20764ff47a1d95d13257da7593e61244a0a9eacad558af2",
        "txpos_in_block": 17,
        "wanted_height": null
    },
    {
        "amount_sat": -2120,
        "bc_balance": "0.001665",
        "bc_value": "-0.0000212",
        "confirmations": 941,
        "date": "2025-10-04 00:46",
        "fee_sat": 2450,
        "group_id": null,
        "height": 4735657,
        "incoming": false,
        "label": "",
        "monotonic_timestamp": 1759563962,
        "timestamp": 1759563962,
        "txid": "83f0a0d8bec9e6e549c30b88f3dc50a6f11c9782361c9f394de540925b5b465c",
        "txpos_in_block": 27,
        "wanted_height": null
    },
    {
        "amount_sat": 190600,
        "bc_balance": "0.003571",
        "bc_value": "0.001906",
        "confirmations": 213,
        "date": "2025-10-08 14:03",
        "fee_sat": 1572,
        "group_id": null,
        "height": 4736385,
        "incoming": true,
        "label": "",
        "monotonic_timestamp": 1759957413,
        "timestamp": 1759957413,
        "txid": "4bf6e24b9a6d8f82f7c320a88d667b46c01ccba7bd0bc425417221005c0a9c26",
        "txpos_in_block": 28,
        "wanted_height": null
    }
]

lightning_history

[
    {
        "amount_msat": 200000000,
        "date": "2025-10-02 19:56",
        "direction": null,
        "fee_msat": null,
        "group_id": "e522cf029812d0b9e7e38e66eb069314b14978d5473faeb7302fdd75366475eb",
        "label": "Open channel 4735502x1x2",
        "ln_value": "0.002",
        "payment_hash": null,
        "preimage": null,
        "timestamp": 1759460195,
        "type": "channel_opening"
    },
    {
        "amount_msat": -200000000,
        "date": "2025-10-03 15:52",
        "direction": null,
        "fee_msat": null,
        "group_id": "fb4c75494cabda8b066d13a5b7d2df4392cd67707ddbf7845ecfff6520a072c2",
        "label": "Close channel 4735502x1x2",
        "ln_value": "-0.002",
        "payment_hash": null,
        "preimage": null,
        "timestamp": 1759531975,
        "type": "channel_closing"
    },
    {
        "amount_msat": 200000000,
        "date": "2025-10-03 17:18",
        "direction": null,
        "fee_msat": null,
        "group_id": "6333ecd263e5a2c8e20764ff47a1d95d13257da7593e61244a0a9eacad558af2",
        "label": "Open channel 4735630x17x2",
        "ln_value": "0.002",
        "payment_hash": null,
        "preimage": null,
        "timestamp": 1759537091,
        "type": "channel_opening"
    },
    {
        "amount_msat": -11000,
        "date": "2025-10-03 19:02",
        "direction": 0,
        "fee_msat": 10000,
        "group_id": null,
        "label": "1 Blockaccino",
        "ln_value": "-0.00000011",
        "payment_hash": "e801e7b766542f5a2b7e38b0f4bcc585333bc66a0ca35e978157b45c2490f0b5",
        "preimage": "fa345d430101020ad622c9b626c6e242277b7ec7c8eaeb2eeb1324fb2620472c",
        "timestamp": 1759543370,
        "type": "payment"
    },
    {
        "amount_msat": -5050000,
        "date": "2025-10-03 19:04",
        "direction": 0,
        "fee_msat": 50000,
        "group_id": null,
        "label": "1 Scala Chip Frappuccino",
        "ln_value": "-0.0000505",
        "payment_hash": "c77a7035ae00f96a6e054e98412f7dcdebae606dd7e536e249bea76f7dbf3213",
        "preimage": "d5ec346d850eb6919048b1205eeb45d9c2303546204078e84c8bb567e9798367",
        "timestamp": 1759543441,
        "type": "payment"
    },
    {
        "amount_msat": -194939000,
        "date": "2025-10-04 00:46",
        "direction": null,
        "fee_msat": null,
        "group_id": "247073cc7e2b193c4f2111912dc5bb39057039c18dc8624e82b4bc88c0d69c06",
        "label": "Close channel 4735630x17x2",
        "ln_value": "-0.00194939",
        "payment_hash": null,
        "preimage": null,
        "timestamp": 1759563962,
        "type": "channel_closing"
    }
]

Ultimately, as the exported CSV shows, the last 3 txs are now somewhat unaccountable without more meaningful information provided:

oc_transaction_hash,ln_payment_hash,label,confirmations,amount_chain_bc,amount_lightning_bc,fiat_value,network_fee_satoshi,fiat_fee,timestamp
83f0a0d8bec9e6e549c30b88f3dc50a6f11c9782361c9f394de540925b5b465c,,,933,-0.0000212,0.,,2450,,2025-10-04 00:46:02
,,Close channel 4735630x17x2,,0.,-0.00194939,,0,,2025-10-04 00:46:02
4bf6e24b9a6d8f82f7c320a88d667b46c01ccba7bd0bc425417221005c0a9c26,,,205,0.001906,0.,,1572,,2025-10-08 14:03:33
When using the following: - electrum 4.6.2 (linux desktop) - testnet3 - lightning (trampoline enabled) After having opened a channel and sent some sats, a cooperative close had lead to a forced close by remote; leaving me with local txs `sweep local_anchor` and `sweep our_ctx_to_local` for many confirmations (as expected). However, once fully confirmed: - None of the subsequent oc txs are accurately labeled - They also appear to not have a `group_id` - The final `Close channel` is without a ln hash **or** oc txid **and** has a lone `group_id` (without any other txs in that group) - Since the CSV export does not contain `group_id` or any identifying hash for this tx, it effectively becomes a "mystery" tx and relies on associating through label (which won't work here, as rules are processed linearly). --- ### onchain_history ```json [ { "amount_sat": 128436, "bc_balance": "0.00128436", "bc_value": "0.00128436", "confirmations": 1110, "date": "2025-10-02 19:18", "fee_sat": null, "group_id": null, "height": 4735488, "incoming": true, "label": "Testnet3 faucet (income)", "monotonic_timestamp": 1759457891, "timestamp": 1759457891, "txid": "a01c1a2deaa047ef3fd49c01360ddbab88e071a37e85d5446a2a713efa6e5500", "txpos_in_block": 128, "wanted_height": null }, { "amount_sat": 168871, "bc_balance": "0.00297307", "bc_value": "0.00168871", "confirmations": 1110, "date": "2025-10-02 19:18", "fee_sat": null, "group_id": null, "height": 4735488, "incoming": true, "label": "Testnet3 faucet (income)", "monotonic_timestamp": 1759457891, "timestamp": 1759457891, "txid": "1802953f7f1889fa8034a8170e5b709100f67dad2bae3a110bb80287b53b2811", "txpos_in_block": 129, "wanted_height": null }, { "amount_sat": 181488, "bc_balance": "0.00478795", "bc_value": "0.00181488", "confirmations": 1110, "date": "2025-10-02 19:18", "fee_sat": null, "group_id": null, "height": 4735488, "incoming": true, "label": "Testnet3 faucet (income)", "monotonic_timestamp": 1759457891, "timestamp": 1759457891, "txid": "db9a16c4661ef161f7bd099ab4c65391dbd6b220055365892ee6958b3d9b431f", "txpos_in_block": 130, "wanted_height": null }, { "amount_sat": -200634, "bc_balance": "0.00278161", "bc_value": "-0.00200634", "confirmations": 1096, "date": "2025-10-02 19:56", "fee_sat": 634, "group_id": "e522cf029812d0b9e7e38e66eb069314b14978d5473faeb7302fdd75366475eb", "height": 4735502, "incoming": false, "label": "Open channel 4735502x1x2", "monotonic_timestamp": 1759460195, "timestamp": 1759460195, "txid": "e522cf029812d0b9e7e38e66eb069314b14978d5473faeb7302fdd75366475eb", "txpos_in_block": 1, "wanted_height": null }, { "amount_sat": 198197, "bc_balance": "0.00476358", "bc_value": "0.00198197", "confirmations": 972, "date": "2025-10-03 15:52", "fee_sat": 1803, "group_id": "fb4c75494cabda8b066d13a5b7d2df4392cd67707ddbf7845ecfff6520a072c2", "height": 4735626, "incoming": true, "label": "Close channel 4735502x1x2", "monotonic_timestamp": 1759531975, "timestamp": 1759531975, "txid": "fb4c75494cabda8b066d13a5b7d2df4392cd67707ddbf7845ecfff6520a072c2", "txpos_in_block": 5, "wanted_height": null }, { "amount_sat": -102797, "bc_balance": "0.00373561", "bc_value": "-0.00102797", "confirmations": 971, "date": "2025-10-03 16:12", "fee_sat": 2797, "group_id": null, "height": 4735627, "incoming": false, "label": "Testnet3 faucet (donate)", "monotonic_timestamp": 1759533176, "timestamp": 1759533176, "txid": "f6f208349a6c5bac419bf2258b599526e3ad1b073204c4feee1c8fdd04567fea", "txpos_in_block": 8, "wanted_height": null }, { "amount_sat": -204941, "bc_balance": "0.0016862", "bc_value": "-0.00204941", "confirmations": 968, "date": "2025-10-03 17:18", "fee_sat": 4941, "group_id": "6333ecd263e5a2c8e20764ff47a1d95d13257da7593e61244a0a9eacad558af2", "height": 4735630, "incoming": false, "label": "Open channel 4735630x17x2", "monotonic_timestamp": 1759537091, "timestamp": 1759537091, "txid": "6333ecd263e5a2c8e20764ff47a1d95d13257da7593e61244a0a9eacad558af2", "txpos_in_block": 17, "wanted_height": null }, { "amount_sat": -2120, "bc_balance": "0.001665", "bc_value": "-0.0000212", "confirmations": 941, "date": "2025-10-04 00:46", "fee_sat": 2450, "group_id": null, "height": 4735657, "incoming": false, "label": "", "monotonic_timestamp": 1759563962, "timestamp": 1759563962, "txid": "83f0a0d8bec9e6e549c30b88f3dc50a6f11c9782361c9f394de540925b5b465c", "txpos_in_block": 27, "wanted_height": null }, { "amount_sat": 190600, "bc_balance": "0.003571", "bc_value": "0.001906", "confirmations": 213, "date": "2025-10-08 14:03", "fee_sat": 1572, "group_id": null, "height": 4736385, "incoming": true, "label": "", "monotonic_timestamp": 1759957413, "timestamp": 1759957413, "txid": "4bf6e24b9a6d8f82f7c320a88d667b46c01ccba7bd0bc425417221005c0a9c26", "txpos_in_block": 28, "wanted_height": null } ] ``` ### lightning_history ```json [ { "amount_msat": 200000000, "date": "2025-10-02 19:56", "direction": null, "fee_msat": null, "group_id": "e522cf029812d0b9e7e38e66eb069314b14978d5473faeb7302fdd75366475eb", "label": "Open channel 4735502x1x2", "ln_value": "0.002", "payment_hash": null, "preimage": null, "timestamp": 1759460195, "type": "channel_opening" }, { "amount_msat": -200000000, "date": "2025-10-03 15:52", "direction": null, "fee_msat": null, "group_id": "fb4c75494cabda8b066d13a5b7d2df4392cd67707ddbf7845ecfff6520a072c2", "label": "Close channel 4735502x1x2", "ln_value": "-0.002", "payment_hash": null, "preimage": null, "timestamp": 1759531975, "type": "channel_closing" }, { "amount_msat": 200000000, "date": "2025-10-03 17:18", "direction": null, "fee_msat": null, "group_id": "6333ecd263e5a2c8e20764ff47a1d95d13257da7593e61244a0a9eacad558af2", "label": "Open channel 4735630x17x2", "ln_value": "0.002", "payment_hash": null, "preimage": null, "timestamp": 1759537091, "type": "channel_opening" }, { "amount_msat": -11000, "date": "2025-10-03 19:02", "direction": 0, "fee_msat": 10000, "group_id": null, "label": "1 Blockaccino", "ln_value": "-0.00000011", "payment_hash": "e801e7b766542f5a2b7e38b0f4bcc585333bc66a0ca35e978157b45c2490f0b5", "preimage": "fa345d430101020ad622c9b626c6e242277b7ec7c8eaeb2eeb1324fb2620472c", "timestamp": 1759543370, "type": "payment" }, { "amount_msat": -5050000, "date": "2025-10-03 19:04", "direction": 0, "fee_msat": 50000, "group_id": null, "label": "1 Scala Chip Frappuccino", "ln_value": "-0.0000505", "payment_hash": "c77a7035ae00f96a6e054e98412f7dcdebae606dd7e536e249bea76f7dbf3213", "preimage": "d5ec346d850eb6919048b1205eeb45d9c2303546204078e84c8bb567e9798367", "timestamp": 1759543441, "type": "payment" }, { "amount_msat": -194939000, "date": "2025-10-04 00:46", "direction": null, "fee_msat": null, "group_id": "247073cc7e2b193c4f2111912dc5bb39057039c18dc8624e82b4bc88c0d69c06", "label": "Close channel 4735630x17x2", "ln_value": "-0.00194939", "payment_hash": null, "preimage": null, "timestamp": 1759563962, "type": "channel_closing" } ] ``` --- Ultimately, as the [exported CSV](https://gitea.com/EvergreenCrypto/docker-finance/pulls/227/files#diff-de57ccf64be23de2d467cd83db03f4444d20789f) shows, the last 3 txs are now somewhat unaccountable without more meaningful information provided: ```csv oc_transaction_hash,ln_payment_hash,label,confirmations,amount_chain_bc,amount_lightning_bc,fiat_value,network_fee_satoshi,fiat_fee,timestamp 83f0a0d8bec9e6e549c30b88f3dc50a6f11c9782361c9f394de540925b5b465c,,,933,-0.0000212,0.,,2450,,2025-10-04 00:46:02 ,,Close channel 4735630x17x2,,0.,-0.00194939,,0,,2025-10-04 00:46:02 4bf6e24b9a6d8f82f7c320a88d667b46c01ccba7bd0bc425417221005c0a9c26,,,205,0.001906,0.,,1572,,2025-10-08 14:03:33 ```
AaronFiore commented 2025-10-29 23:31:25 +00:00 (Migrated from gitea.com)

The electrum lightning history issue has been moved to #233

The electrum lightning history issue has been moved to #233
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Reference: EvergreenCrypto/docker-finance#227