Swap leaves to ensure quoted leave amount does not change above limit#741
Swap leaves to ensure quoted leave amount does not change above limit#741danielgranhao wants to merge 6 commits intomainfrom
Conversation
|
Added a commit for improving the behavior when To fix this, I've changed the amount we use to get the quote. When fees are included, we use a worst case value: |
|
We've discussed with Lightspark and it seems they may soon remove the leaf count change quote validation, making this unnecessary. Closing. |
Replaces #730. Closes #697 (resolving the underlying issue using a different strategy from what was suggested in the issue)
When an on-chain withdrawal fee quote is fetched, the SSP bases fees on the current leaf count. If leaves change between quoting and sending (e.g., due to incoming payments splitting leaves), the leaf count may exceed the SSP's tolerance, causing the withdrawal to fail.
This PR:
ceil(q * (1.2 + 1.0 / q^0.6))max_amount_leaf_countconstraint through leaf selection, forcing a consolidation swap if needed