lightningdevkit / rust-lightning

A highly modular Bitcoin Lightning library written in Rust. It's rust-lightning, not Rusty's Lightning!
Other
1.15k stars 364 forks source link

HTLC ID is the same across MPP parts #2398

Closed TonyGiorgio closed 1 year ago

TonyGiorgio commented 1 year ago

I'm testing LDK 116 now (0d1072b7c3fb5366742473c38069c421cdd60b87) and one thing I've seen with this one that I don't think I have seen with 115 is the HTLC ID of multiple parts of a MPP payment is the same. Maybe I have never seen it before because I've had MPP route finding issues with previous versions.

HTLC 4 is the ID for both the part with 146954000 and the part with 53046000. I would expect that it's a different ID. We use this for distinguishing parts for the Voltage LSP and without it being different, the only way to tell the HTLCs apart is the amount, but that doesn't work when the amount might be the same.

2023-07-07 04:31:13.536 INFO  [lightning::routing::router:2443] Got route: path 0:
 node_id: 0366abc8eb4da61e31a8d2c4520d31cabdf58cc5250f855657397f3dd62493938a, short_channel_id: 239761704576155648, fee_msat: 146954000, cltv_expiry_delta: 83
 blinded_tail: None
path 1:
 node_id: 0366abc8eb4da61e31a8d2c4520d31cabdf58cc5250f855657397f3dd62493938a, short_channel_id: 239777097738944512, fee_msat: 53046000, cltv_expiry_delta: 83
 blinded_tail: None

2023-07-07 04:31:13.536 TRACE [lightning::ln::channelmanager:3057] Attempting to send payment for path with next hop 239761704576155648
2023-07-07 04:31:13.542 DEBUG [lightning::ln::channel:5061] Pushing new outbound HTLC for 146954000 msat to peer
2023-07-07 04:31:13.542 TRACE [lightning::ln::channel:5108] Updating HTLC state for a newly-sent commitment_signed...
2023-07-07 04:31:13.548 TRACE [lightning::ln::channel:1176] Building commitment transaction number 281474976710644 (really 11 xor 125507865358709) for channel 8c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686 for remote, generated by us with fee 253...
2023-07-07 04:31:13.548 TRACE [lightning::ln::channel:1277]    ...including outbound LocalAnnounced HTLC 4 (hash 0e9f9fe59dea2c06ccffd8e5a0e2622f738335ceb1f7a01e5be371718ebde0f5) with value 146954000
2023-07-07 04:31:13.548 TRACE [lightning::ln::channel:1336]    ...including to_remote output with value 102274
2023-07-07 04:31:13.548 TRACE [lightning::ln::channel:1342]    ...including to_local output with value 546
2023-07-07 04:31:13.549 TRACE [lightning::chain::chainmonitor:706] Updating ChannelMonitor for channel 8c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686
2023-07-07 04:31:13.549 INFO  [lightning::chain::channelmonitor:2382] Applying update to monitor 8c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686, bringing update_id from 25 to 26 with 1 change(s).
2023-07-07 04:31:13.549 TRACE [lightning::chain::channelmonitor:2423] Updating ChannelMonitor with latest counterparty commitment transaction info
2023-07-07 04:31:13.549 TRACE [lightning::chain::channelmonitor:2186] Tracking new counterparty commitment transaction with txid 9b34eca447c9c837029f425edb905b29a179a12a4d2740a22ff36b4bb6d223af at commitment number 281474976710644 with 1 HTLC outputs
2023-07-07 04:31:13.561 DEBUG [lightning::chain::chainmonitor:726] Persistence of ChannelMonitorUpdate for channel 8c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686 completed
2023-07-07 04:31:13.562 TRACE [lightning::ln::channel:4825] Creating an announcement_signatures message for channel 8c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686
2023-07-07 04:31:13.562 TRACE [lightning::ln::channel:4829] Ignore : Channel is not available for public announcements
2023-07-07 04:31:13.562 TRACE [lightning::ln::channel:3713] Regenerated latest commitment update in channel 8c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686 with 1 update_adds, 0 update_fulfills, 0 update_fails, and 0 update_fail_malformeds
2023-07-07 04:31:13.568 TRACE [lightning::ln::channel:1176] Building commitment transaction number 281474976710644 (really 11 xor 125507865358709) for channel 8c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686 for remote, generated by us with fee 253...
2023-07-07 04:31:13.568 TRACE [lightning::ln::channel:1277]    ...including outbound LocalAnnounced HTLC 4 (hash 0e9f9fe59dea2c06ccffd8e5a0e2622f738335ceb1f7a01e5be371718ebde0f5) with value 146954000
2023-07-07 04:31:13.568 TRACE [lightning::ln::channel:1336]    ...including to_remote output with value 102274
2023-07-07 04:31:13.568 TRACE [lightning::ln::channel:1342]    ...including to_local output with value 546
2023-07-07 04:31:13.578 TRACE [lightning::ln::channel:5211] Signed remote commitment tx 02000000018c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686000000000013267280032202000000000000160014f6ce8dc4f55e00d53105dd94f97626c639d38e92828f010000000000220020c0eafe469587be23f464d5d1cf887b17e58302d2daf9610d4f0d6682656f329e0a3e020000000000220020206b1cc19f7df27555cd2e0a2cb18e7163198bc5d8245c104a4a11968542fba47e31bb20 (txid 9b34eca447c9c837029f425edb905b29a179a12a4d2740a22ff36b4bb6d223af) with redeemscript 4752210230f29e8491a730d60b0547827ffeddbb9c567fa2cb5d8fccf06f6e9dc7fde7d421033833b0ca3a06989f867b2153d5756fe6f9d0a14133988fc31fc4ab04b055670452ae -> 125611eeb741abd7b76d2cb443254610c832609c49e8adaa0d5eab9d32918ed83da45939312814e10f53271e4b6884ed107ceb6cc5723ee7aaac115cc72528d7 in channel 8c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686
2023-07-07 04:31:13.578 TRACE [lightning::ln::channel:5217] Signed remote HTLC tx 0200000001af23d2b64b6bf32fa240274d2aa179a1295b90db5e429f0237c8c947a4ec349b02000000000000000001593d020000000000220020c0eafe469587be23f464d5d1cf887b17e58302d2daf9610d4f0d6682656f329e00000000 with redeemscript 8b76a914bdcbf560b9d8bb2c0cf8c99b68f0c4946ff8bf288763ac6721022906ab76497b6192bcb92899f71259a207d23685366337f894c54b4456d682cd7c8201208763a9144f852ac1800c7998f5e77a4094a9f8c32ccfc9ca88527c21021e1d280f9714c04665bdb4692eac2c49f881c91053f49ad2fd0041b08c78a2e752ae677503855403b175ac6868 with pubkey 021e1d280f9714c04665bdb4692eac2c49f881c91053f49ad2fd0041b08c78a2e7 -> 2ebd70e57c857c7a9b3b84f9618096718b1a98fb9ad6eb636d3be93f4b7da0881782664e40a2227ac4209121726363355b328b0fb2e0aa04c3ab04ce4146bce3 in channel 8c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686
2023-07-07 04:31:13.578 DEBUG [lightning::ln::channel:3602] Restored monitor updating in channel 8c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686 resulting in a commitment update and no RAA, with RAA first
2023-07-07 04:31:13.578 TRACE [lightning::ln::channelmanager:4853] Handling channel resumption for channel 8c5841b75de45a6e042d11c3addb340238d08c9ac043dfe22e18612c7e83a686 with no RAA, a commitment update, 0 pending forwards, not broadcasting funding, without channel ready, without announcement
2023-07-07 04:31:13.578 TRACE [lightning::ln::channelmanager:3057] Attempting to send payment for path with next hop 239777097738944512
2023-07-07 04:31:13.584 DEBUG [lightning::ln::channel:5061] Pushing new outbound HTLC for 53046000 msat to peer
2023-07-07 04:31:13.584 TRACE [lightning::ln::channel:5108] Updating HTLC state for a newly-sent commitment_signed...
2023-07-07 04:31:13.590 TRACE [lightning::ln::channel:1176] Building commitment transaction number 281474976710644 (really 11 xor 185779180024110) for channel 40a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8 for remote, generated by us with fee 253...
2023-07-07 04:31:13.590 TRACE [lightning::ln::channel:1277]    ...including outbound LocalAnnounced HTLC 4 (hash 0e9f9fe59dea2c06ccffd8e5a0e2622f738335ceb1f7a01e5be371718ebde0f5) with value 53046000
2023-07-07 04:31:13.590 TRACE [lightning::ln::channel:1336]    ...including to_remote output with value 102274
2023-07-07 04:31:13.590 TRACE [lightning::ln::channel:1342]    ...including to_local output with value 94454
2023-07-07 04:31:13.591 TRACE [lightning::chain::chainmonitor:706] Updating ChannelMonitor for channel 40a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8
2023-07-07 04:31:13.591 INFO  [lightning::chain::channelmonitor:2382] Applying update to monitor 40a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8, bringing update_id from 25 to 26 with 1 change(s).
2023-07-07 04:31:13.591 TRACE [lightning::chain::channelmonitor:2423] Updating ChannelMonitor with latest counterparty commitment transaction info
2023-07-07 04:31:13.591 TRACE [lightning::chain::channelmonitor:2186] Tracking new counterparty commitment transaction with txid d908749d3c538f2f101a35779738e92b78de292fc84f11668037c09946dab752 at commitment number 281474976710644 with 1 HTLC outputs
2023-07-07 04:31:13.603 DEBUG [lightning::chain::chainmonitor:726] Persistence of ChannelMonitorUpdate for channel 40a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8 completed
2023-07-07 04:31:13.603 TRACE [lightning::ln::channel:4825] Creating an announcement_signatures message for channel 40a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8
2023-07-07 04:31:13.603 TRACE [lightning::ln::channel:4829] Ignore : Channel is not available for public announcements
2023-07-07 04:31:13.604 TRACE [lightning::ln::channel:3713] Regenerated latest commitment update in channel 40a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8 with 1 update_adds, 0 update_fulfills, 0 update_fails, and 0 update_fail_malformeds
2023-07-07 04:31:13.609 TRACE [lightning::ln::channel:1176] Building commitment transaction number 281474976710644 (really 11 xor 185779180024110) for channel 40a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8 for remote, generated by us with fee 253...
2023-07-07 04:31:13.609 TRACE [lightning::ln::channel:1277]    ...including outbound LocalAnnounced HTLC 4 (hash 0e9f9fe59dea2c06ccffd8e5a0e2622f738335ceb1f7a01e5be371718ebde0f5) with value 53046000
2023-07-07 04:31:13.609 TRACE [lightning::ln::channel:1336]    ...including to_remote output with value 102274
2023-07-07 04:31:13.609 TRACE [lightning::ln::channel:1342]    ...including to_local output with value 94454
2023-07-07 04:31:13.623 TRACE [lightning::ln::channel:5211] Signed remote commitment tx 020000000140a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8000000000016f7a8800336cf000000000000220020d83a131eda57e30f083a483f861809e116c6d260d863b212f4ba7e0871d6ee08f67001000000000016001414a6815fa137d8100f830a14d4146a17e80d1c85828f0100000000002200209ed5246ae36c55ed4b3617e5ba800348bdf94520a0cb84185d5c63d4461dc1ec25310820 (txid d908749d3c538f2f101a35779738e92b78de292fc84f11668037c09946dab752) with redeemscript 4752210368d25a1a51e0be2656edcc88c96f00d1b7720f57718a66f7733a70f7ed4853352103cbc94f7ddef7106ce7305bb72ee2b25a3cd3c3cb0888b46cd363cec926984b7952ae -> 715ba6429172637bb01fc3a7e9de6463b1b09a8d045f8f541903f04fd86af92f7b07c9a5e64010a9b0a01d700db64332092430d3d79dfbc460586bdd82b28245 in channel 40a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8
2023-07-07 04:31:13.624 TRACE [lightning::ln::channel:5217] Signed remote HTLC tx 020000000152b7da4699c0378066114fc82f29de782be9389777351a102f8f533c9d7408d90000000000000000000185ce0000000000002200209ed5246ae36c55ed4b3617e5ba800348bdf94520a0cb84185d5c63d4461dc1ec00000000 with redeemscript 8b76a9149769a37b277ecb9d83a6afe781c5ac1a9a21d6778763ac67210362905c4963b67f81fc1ce8da84673b17b0370211224bca4e63caff602afb1d6f7c8201208763a9144f852ac1800c7998f5e77a4094a9f8c32ccfc9ca88527c210279b3093ec1383495ab1cfb67d5bd8aa0a4a8896b678949202e9e4db766ca869852ae677503855403b175ac6868 with pubkey 0279b3093ec1383495ab1cfb67d5bd8aa0a4a8896b678949202e9e4db766ca8698 -> 13b0ab9633c9998ed7b523a5b8006350363ad4fcf82dc8f8759d1d2e2c96fbe10528f2e0b0c089b1fe8779a1bc41ed42274e45a8e991f4640c8efba71dbec49c in channel 40a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8
2023-07-07 04:31:13.624 DEBUG [lightning::ln::channel:3602] Restored monitor updating in channel 40a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8 resulting in a commitment update and no RAA, with RAA first
2023-07-07 04:31:13.624 TRACE [lightning::ln::channelmanager:4853] Handling channel resumption for channel 40a38c93c26ee7370cac79b4366375fee49635014e0f97bb7c5497b7bcd9b5c8 with no RAA, a commitment update, 0 pending forwards, not broadcasting funding, without channel ready, without announcement
2023-07-07 04:31:13.625 INFO  [lightning::ln::outbound_payment:683] Result sending payment with id 0e9f9fe59dea2c06ccffd8e5a0e2622f738335ceb1f7a01e5be371718ebde0f5: Ok(())
TonyGiorgio commented 1 year ago

Oh you know what, this is because the HTLC ID's were the same on both the channels it was going down. I should check incoming channel id combined with htlc id to distinguish the individual parts.