-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
The channelArbitrator
, amongst may other things is responsible for deciding when we should go to chain in order to sweep outputs on-chain from expired contracts. We use the shouldGoOnChain
function currently to decide exactly when we should go on chain. Atm, the function is very basic, and will determine that we need to go on chain if the HTLC is about to expire. However, this doesn't capture the cost of going on chain. For example, if we have a 1000 satoshi HTLC that's about to expire, and it would take 20k satoshis to actually fully sweep the output, then the cost simply isn't worth it. The shouldGoOnChain
function should be modified to capture such opportunity cost heuristics.
Steps To Completion
-
Extend the
shouldGoOnChain
method to take into account (all or some of): the on chain fees to sweep an HTLC, the duration that an HTLC has been active, the fee revenue related to the channel we're examining (as if the channel is popular we shouldn't close it to sweep a single HTLC), the CSV value. -
A series of tests should be written to ensure that each of the heuristics are properly implemented and are adhered to by the
channelArbitrator
.