mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
liquidity: parse old auto budget to new parameters
This commit is contained in:
parent
72f284ecb4
commit
55c769ef9d
1 changed files with 14 additions and 0 deletions
|
|
@ -34,6 +34,8 @@ var (
|
|||
}
|
||||
)
|
||||
|
||||
const InfiniteDuration = (24 * 31 * 12 * 100) * time.Hour
|
||||
|
||||
// Parameters is a set of parameters provided by the user which guide
|
||||
// how we assess liquidity.
|
||||
type Parameters struct {
|
||||
|
|
@ -404,6 +406,18 @@ func RpcToParameters(req *clientrpc.LiquidityParameters) (*Parameters,
|
|||
time.Second
|
||||
}
|
||||
|
||||
// If an old-style budget was written to storage then express it by
|
||||
// using the new auto budget parameters. If the newly added parameters
|
||||
// have the 0 default value, but a budget was defined that means the
|
||||
// client is using the old style budget parameters.
|
||||
if req.AutoloopBudgetRefreshPeriodSec == 0 &&
|
||||
req.AutoloopBudgetSat != 0 {
|
||||
|
||||
params.AutoFeeRefreshPeriod = InfiniteDuration
|
||||
params.AutoloopBudgetLastRefresh = time.Unix(
|
||||
int64(req.AutoloopBudgetStartSec), 0)
|
||||
}
|
||||
|
||||
for _, rule := range req.Rules {
|
||||
peerRule := rule.Pubkey != nil
|
||||
chanRule := rule.ChannelId != 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue