Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Batch claim much more aggressively even on pinnable outputs
When we first added batch claiming, we only did so for claims which we thought were not pinnable, i.e. those for which only we can claim the output. This was the conservative choice - any outputs which we think are potentially pinnable might be pinned, leaving our entire batch unable to confirm on chain. However, if we assume that pinnable outputs are, indeed pinnable, and attempts to pin a transaction and keep it from confirming have highly correlated success rates, there's no reason we shouldn't also batch claims of pinnable outputs separately. Sadly, aggregating other types of inputs is rather nontrivial, as evidenced by the size of this commit - HTLC-Timeout claims have locktimes fixed by our counterparty's signature and thus can only be aggregated with other HTLCs of the same CLTV, which we have to check for. Further, our concept of "pinnable" is deliberately somewhat fuzzy - outputs which we believe are not pinnable will eventually become pinnable at the height where our counterparty can spend them. Thus, we treat outputs as pinnable if they're over that height, and if they're within `COUNTERPARTY_CLAIMABLE_WITHIN_BLOCKS_PINNABLE` of that height we treat them as neither pinnable nor not-pinnable, aggregating such claims only with other claims which will become pinnable at the same height. However, the complexity required is worth it - aggregation can save our users a lot of money in the case of a force-close, and directly impacts the amount of UTXOs they need as reserve for anchors, so we want to aggregate as much as possible. Fixes lightningdevkit#3064
- Loading branch information