alexbosworth / balanceofsatoshis

Tool for working with the balance of your satoshis on LND
MIT License
566 stars 79 forks source link

[accounting] bos accounting chain-sends lists refund from force close channels #128

Open Deekee62 opened 3 years ago

Deekee62 commented 3 years ago

I'm not a developer and try to report as good as I can, please be considered :-)

I recently had two peers which messed up their LND nodes while restoring some old backups, hence my node force closed on them.

Out of curiosity I investigated the issues further and came across the following anomaly:

When running: bos accounting chain-sends the generated report lists the two refunds of the remaining outbound capacity of the channels which have been force closed as a negative integer and with as type transfer:withdraw

I think this is wrong and should be show in the report when doing bos accounting chain-receives where refunds from normal channel closures are listed too, as positive integers as type transfer:deposit

Futhermore the integer values reported a wrong as well, because the difference of the onchain tx output and the fees are shown, instead of the output only.

Using lncli the correct output is reported, but showing zero fees.

alexbosworth commented 3 years ago

Can you show the related transaction details that is in the output of LND?

you can find this with bos call getchaintransactions

also, do you see anything related in bos call getsweeptransactions

Deekee62 commented 3 years ago

getchaintransaction:

transactions:

  - 
    block_id:            00000000000000000007cc05fde39935fb657bd64a443854c527e1de055762e6
    confirmation_count:  3311
    confirmation_height: 695878
    created_at:          2021-08-15T11:30:04.000Z
    description:         0:openchannel:shortchanid-765125952617578496
    fee:                 223
    id:                  19b7f0bac3c6ad19a9dc6bd2ce8301f67d97f29d0e2b0f68a41dea22c79345a3
    is_confirmed:        true
    is_outgoing:         true
    output_addresses: 
      - bc1qrduy6vvefsp5amh4v8vwt45ukrye70gcr46tdtcwgjx33z9ktagsqxlpn0
      - bc1qu8gvknh8wg7sqj87zznazhtjfvaer5x9dvckpu
    tokens:              4000223
    transaction:         0200000000010208066f8d2323907dfcf5e4f558823976f4a24e9db0744a83efa61c0c3cf4a75f010000000000000000690947b6060ec94efa7164e5ed81506ca5e3fc3d2a720932ffd60205878770840000000000000000000200093d00000000002200201b784d31994c034eeef561d8e5d69cb0c99f3d181d74b6af0e448d1888b65f51aa876e0100000000160014e1d0cb4ee7723d0048fe10a7d15d724b3b91d0c5024830450221009579894eb733f3ef3e5665aa432b741cdbf3c275d3787f6ef15ceeafaf2e8db1022048e6b9b78e6cca165db103a8818bcb31377e0f6da25a1f97dc642fc49f59d44b0121023ad5ed3d971a77a61e89ec36bdb710150da9dd59af037df6de878c8b0ee64365024730440220714a7931b153f4b20cf9f5b085d77101619f3b91d6f37c0de096197a16f4ecfb02201adb8d1454d4cd2ba057bc14f49d094a007c8fb27e149da9a5320ec5dd2fb933012102c131b7f77e64a493af91d06fd8bc4b66cb471eb0ba9f40e9334b00304806e6c900000000                
    block_id:            00000000000000000011c2e92fc07125d554290d00dd66e173698dea7beeec0e
    confirmation_count:  3492
    confirmation_height: 695697
    created_at:          2021-08-14T10:41:12.000Z
    id:                  847087870502d6ff3209722a3dfce3a56c5081ede56471fa4ec90e06b6470969
    is_confirmed:        true
    is_outgoing:         false
    output_addresses: 
      - bc1qjadzdrf622lu6fvpwnzhrwgdfugsd2vyukdjtm
    tokens:              21271
    transaction:         020000000001013578508455d77d4d47904fd374227e74518b80cb37ee1ec905cef55946e15d3c0000000000f0000000011753000000000000160014975a268d3a52bfcd258174c571b90d4f1106a98403483045022100d5d8d968da46184becb015ca6ca703a28dfc4c6244f81d7c9a818b2374ed48b102200798aca69d2fbcb5f3bae786a7f71a5e377e31b5e6485ad6ef111f36befdd54201004d63210393f096e7401da2bc8cc16545f223978e47f6ab86f96f64e8b4c77397c403590d6702f000b27521028e661c647450e52f938a3d5bc6b6e3ac2315536f9c3264427f15bb9b6abe1a6a68ac909d0a00
    block_id:            000000000000000000069e3f94504e03cb22360341ee6ac9dee50fa672c35f4a
    confirmation_count:  4055
    confirmation_height: 695134
    created_at:          2021-08-10T15:32:28.000Z
    description:         external
    fee:                 142
    id:                  5fa7f43c0c1ca6ef834a74b09d4ea2f476398258f5e4f5fc7d9023238d6f0608
    is_confirmed:        true
    is_outgoing:         true
    output_addresses: 
      - bc1q6slxzu7e7hc4ne3478gm4w34846nq2tjnvy5uf
      - bc1qkeq2c8rjcdx4plrynvj2nqxrfu77xwda26jfp3
    tokens:              2000142
    transaction:         010000000001017b5a73a2da5bbb8c5249b691e617c19f3c93958da6f4642ebbc6828623a0eb170000000000ffffffff0280841e0000000000160014d43e6173d9f5f159e635f1d1baba353d75302972723eab0100000000160014b640ac1c72c34d50fc649b24a980c34f3de339bd0247304402200857e89fc75c7d373541b637b43df79b3aed89f018f9200b5d635eca6872de530220462e19f5feb68189f0c7067d3f4626ffa71ccc1305688979561416aa4b3a94db0121021667d20ce966b7e1c6033a60e3a59ec89f7e976d1d7460545d6aad241ffaf27400000000

getsweeptransactions:

    block_id:            00000000000000000011c2e92fc07125d554290d00dd66e173698dea7beeec0e
    confirmation_count:  3492
    confirmation_height: 695697
    created_at:          2021-08-14T10:41:12.000Z
    id:                  847087870502d6ff3209722a3dfce3a56c5081ede56471fa4ec90e06b6470969
    is_confirmed:        true
    is_outgoing:         false
    output_addresses: 
      - bc1qjadzdrf622lu6fvpwnzhrwgdfugsd2vyukdjtm
    spends: 
      - 
        transaction_id:   3c5de14659f5ce05c91eee37cb808b51747e2274d34f90474d7dd75584507835
        transaction_vout: 0
    tokens:              21271
    transaction:         020000000001013578508455d77d4d47904fd374227e74518b80cb37ee1ec905cef55946e15d3c0000000000f0000000011753000000000000160014975a268d3a52bfcd258174c571b90d4f1106a98403483045022100d5d8d968da46184becb015ca6ca703a28dfc4c6244f81d7c9a818b2374ed48b102200798aca69d2fbcb5f3bae786a7f71a5e377e31b5e6485ad6ef111f36befdd54201004d63210393f096e7401da2bc8cc16545f223978e47f6ab86f96f64e8b4c77397c403590d6702f000b27521028e661c647450e52f938a3d5bc6b6e3ac2315536f9c3264427f15bb9b6abe1a6a68ac909d0a00
alexbosworth commented 3 years ago

also what is the erroneous row you see in the chain-sends? according to lnd this 19b7f0bac3c6ad19a9dc6bd2ce8301f67d97f29d0e2b0f68a41dea22c79345a3 is a negative amount, meaning you spent it, but you are saying it is actually a receive right?

Deekee62 commented 3 years ago
Screenshot 2021-09-05
alexbosworth commented 3 years ago

Can you get the row using --csv option to show the full output?

alexbosworth commented 3 years ago

OK thanks

Deekee62 commented 3 years ago

-20783,"BTC","2021-08-14T10:41:12.000Z",,"","","Outputs to bc1qjadzdrf622lu6fvpwnzhrwgdfugsd2vyukdjtm","","847087870502d6ff3209722a3dfce3a56c5081ede56471fa4ec90e06b6470969","transfer:withdraw"

alexbosworth commented 3 years ago

can you see if 10.11.0 addresses this issue?

Deekee62 commented 3 years ago

Partiallly, they show up in the bos accounting chain-sendsbut with amount 0

alexbosworth commented 3 years ago

OK thanks for checking on that

In a future iteration there could be more context given, the missing feature on the LND side is an API to give clarity on which addresses are owned by the chain wallet