keep-network / keep-core

The smart contracts and reference client behind the Keep network
https://keep.network
MIT License
119 stars 74 forks source link

Adjustments to the moving funds proposal generator #3810

Closed lukasz-zimnoch closed 5 months ago

lukasz-zimnoch commented 5 months ago

Here we introduce two adjustments to the moving funds proposal generator.

First, we introduce a moving funds safety margin of 24 hours. Wallets that just entered the MovingFunds state may have received some last minute deposits just before. Even though deposit sweep task typically occurs before the moving funds task, such deposits may not be mature enough or have enough confirmations to be swept. We know that MovingFunds wallets cannot receive new deposits so, it makes sense to preserve a safety margin before moving funds to give the last minute deposits a chance to become eligible for sweeping by the deposit sweep task.

Second, we slightly optimize the unswept deposit check at the beginning of the moving funds task. It's enough to find one unswept deposit to abort the moving funds task.