Fix duplicate HTLC fail-back on stale force-close
This PR addresses the duplicate HTLC fail-back on stale force-close that fail-back one of them and waits till timeout to fail-back everything. This change adds proper tracking of HTLCs by payment hash to ensure all identical HTLCs are failed back immediately when detected, rather than waiting for timeout.
Also introduces a functional test that demonstrates the scenario by creating two identical HTLCs, performing a stale force-close, and verifying both HTLCs are failed back correctly.
Fixes #3570
👋 I see @tnull was un-assigned. If you'd like another reviewer assignment, please click here.
This PR is still work in progress. Need some help with the test, I'm able to simulate the scenario described in the issue but the change introduced is triggered when the node restarts and I'm not sure how to simulate that (did a network disconnection and reconnection, but that doesn't seem to do the job).
🔔 1st Reminder
Hey @tnull! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
🔔 2nd Reminder
Hey @tnull! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.
Pushed new changes to address latest feedback.
EDIT: Working on fixing CI.
🔔 1st Reminder
Hey @tnull! This PR has been waiting for your review. Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.