|
62 | 62 | // probeTimeout is the maximum time until a probe is allowed to take. |
63 | 63 | probeTimeout = 3 * time.Minute |
64 | 64 |
|
| 65 | + // repushDelay is the delay of (re)adding a sweep to sweepbatcher after |
| 66 | + // a block is mined. |
65 | 67 | repushDelay = 1 * time.Second |
66 | 68 |
|
| 69 | + // additionalDelay is the delay added on top of repushDelay inside the |
| 70 | + // sweepbatcher to publish a sweep transaction. |
| 71 | + additionalDelay = 1 * time.Second |
| 72 | + |
67 | 73 | // MinerFeeEstimationFailed is a magic number that is returned in a |
68 | 74 | // quote call as the miner fee if the fee estimation in lnd's wallet |
69 | 75 | // failed because of insufficient funds. |
@@ -217,6 +223,17 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore, |
217 | 223 | sweepbatcher.WithCustomFeeRate( |
218 | 224 | loopOutSweepFeerateProvider.GetMinFeeRate, |
219 | 225 | ), |
| 226 | + |
| 227 | + // Upon new block arrival, republishing is triggered in both |
| 228 | + // loopout.go code (waitForHtlcSpendConfirmedV2/ <-timerChan) |
| 229 | + // and in sweepbatcher code (batch.Run/case <-timerChan). The |
| 230 | + // former updates the fee rate which is used by the later by |
| 231 | + // calling AddSweep. Make sure they are ordered, add additional |
| 232 | + // delay time to sweepbatcher's handling. The delay used in |
| 233 | + // loopout.go is repushDelay. |
| 234 | + sweepbatcher.WithPublishDelay( |
| 235 | + repushDelay+additionalDelay, |
| 236 | + ), |
220 | 237 | ) |
221 | 238 |
|
222 | 239 | executor = newExecutor(&executorConfig{ |
|
0 commit comments