liquidity: rename auto out boolean to autoloop

pull/331/head
carla 3 years ago
parent d85cc010b0
commit a168ba3400
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91

@ -75,7 +75,7 @@ func TestAutoLoopEnabled(t *testing.T) {
// is set to allow exactly 2 swaps at the prices that we set in our // is set to allow exactly 2 swaps at the prices that we set in our
// test quotes. // test quotes.
params := Parameters{ params := Parameters{
AutoOut: true, Autoloop: true,
AutoFeeBudget: 40066, AutoFeeBudget: 40066,
AutoFeeStartDate: testTime, AutoFeeStartDate: testTime,
MaxAutoInFlight: 2, MaxAutoInFlight: 2,

@ -220,8 +220,8 @@ type Config struct {
// Parameters is a set of parameters provided by the user which guide // Parameters is a set of parameters provided by the user which guide
// how we assess liquidity. // how we assess liquidity.
type Parameters struct { type Parameters struct {
// AutoOut enables automatic dispatch of loop out swaps. // Autoloop enables automatic dispatch of swaps.
AutoOut bool Autoloop bool
// AutoFeeBudget is the total amount we allow to be spent on // AutoFeeBudget is the total amount we allow to be spent on
// automatically dispatched swaps. Once this budget has been used, we // automatically dispatched swaps. Once this budget has been used, we
@ -538,11 +538,11 @@ func (m *Manager) ForceAutoLoop(ctx context.Context) error {
// SuggestSwaps returns a set of swap suggestions based on our current liquidity // SuggestSwaps returns a set of swap suggestions based on our current liquidity
// balance for the set of rules configured for the manager, failing if there are // balance for the set of rules configured for the manager, failing if there are
// no rules set. It takes an autoOut boolean that indicates whether the // no rules set. It takes an autoloop boolean that indicates whether the
// suggestions are being used for our internal autolooper. This boolean is used // suggestions are being used for our internal autolooper. This boolean is used
// to determine the information we add to our swap suggestion and whether we // to determine the information we add to our swap suggestion and whether we
// return any suggestions. // return any suggestions.
func (m *Manager) SuggestSwaps(ctx context.Context, autoOut bool) ( func (m *Manager) SuggestSwaps(ctx context.Context, autoloop bool) (
[]loop.OutRequest, error) { []loop.OutRequest, error) {
m.paramsLock.Lock() m.paramsLock.Lock()
@ -681,7 +681,7 @@ func (m *Manager) SuggestSwaps(ctx context.Context, autoOut bool) (
} }
outRequest, err := m.makeLoopOutRequest( outRequest, err := m.makeLoopOutRequest(
ctx, suggestion, quote, autoOut, ctx, suggestion, quote, autoloop,
) )
if err != nil { if err != nil {
return nil, err return nil, err
@ -731,7 +731,7 @@ func (m *Manager) SuggestSwaps(ctx context.Context, autoOut bool) (
// If we are getting suggestions for automatically dispatched swaps, // If we are getting suggestions for automatically dispatched swaps,
// and they are not enabled in our parameters, we just log the swap // and they are not enabled in our parameters, we just log the swap
// suggestions and return an empty set of suggestions. // suggestions and return an empty set of suggestions.
if autoOut && !m.params.AutoOut { if autoloop && !m.params.Autoloop {
for _, swap := range inBudget { for _, swap := range inBudget {
log.Debugf("recommended autoloop: %v sats over "+ log.Debugf("recommended autoloop: %v sats over "+
"%v", swap.Amount, swap.OutgoingChanSet) "%v", swap.Amount, swap.OutgoingChanSet)
@ -791,7 +791,7 @@ func (m *Manager) getLoopOutRestrictions(ctx context.Context) (*Restrictions,
// non-auto requests, because the client api will set it anyway). // non-auto requests, because the client api will set it anyway).
func (m *Manager) makeLoopOutRequest(ctx context.Context, func (m *Manager) makeLoopOutRequest(ctx context.Context,
suggestion *LoopOutRecommendation, quote *loop.LoopOutQuote, suggestion *LoopOutRecommendation, quote *loop.LoopOutQuote,
autoOut bool) (loop.OutRequest, error) { autoloop bool) (loop.OutRequest, error) {
prepayMaxFee := ppmToSat( prepayMaxFee := ppmToSat(
quote.PrepayAmount, m.params.MaximumPrepayRoutingFeePPM, quote.PrepayAmount, m.params.MaximumPrepayRoutingFeePPM,
@ -815,7 +815,7 @@ func (m *Manager) makeLoopOutRequest(ctx context.Context,
Initiator: autoloopSwapInitiator, Initiator: autoloopSwapInitiator,
} }
if autoOut { if autoloop {
request.Label = labels.AutoOutLabel() request.Label = labels.AutoOutLabel()
addr, err := m.cfg.Lnd.WalletKit.NextAddr(ctx) addr, err := m.cfg.Lnd.WalletKit.NextAddr(ctx)

@ -581,7 +581,7 @@ func (s *swapClientServer) GetLiquidityParams(_ context.Context,
SweepFeeRateSatPerVbyte: uint64(satPerByte), SweepFeeRateSatPerVbyte: uint64(satPerByte),
SweepConfTarget: cfg.SweepConfTarget, SweepConfTarget: cfg.SweepConfTarget,
FailureBackoffSec: uint64(cfg.FailureBackOff.Seconds()), FailureBackoffSec: uint64(cfg.FailureBackOff.Seconds()),
AutoLoopOut: cfg.AutoOut, AutoLoopOut: cfg.Autoloop,
AutoOutBudgetSat: uint64(cfg.AutoFeeBudget), AutoOutBudgetSat: uint64(cfg.AutoFeeBudget),
AutoMaxInFlight: uint64(cfg.MaxAutoInFlight), AutoMaxInFlight: uint64(cfg.MaxAutoInFlight),
Rules: make( Rules: make(
@ -633,7 +633,7 @@ func (s *swapClientServer) SetLiquidityParams(ctx context.Context,
SweepConfTarget: in.Parameters.SweepConfTarget, SweepConfTarget: in.Parameters.SweepConfTarget,
FailureBackOff: time.Duration(in.Parameters.FailureBackoffSec) * FailureBackOff: time.Duration(in.Parameters.FailureBackoffSec) *
time.Second, time.Second,
AutoOut: in.Parameters.AutoLoopOut, Autoloop: in.Parameters.AutoLoopOut,
AutoFeeBudget: btcutil.Amount(in.Parameters.AutoOutBudgetSat), AutoFeeBudget: btcutil.Amount(in.Parameters.AutoOutBudgetSat),
MaxAutoInFlight: int(in.Parameters.AutoMaxInFlight), MaxAutoInFlight: int(in.Parameters.AutoMaxInFlight),
ChannelRules: make( ChannelRules: make(

Loading…
Cancel
Save