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
// test quotes.
params := Parameters{
AutoOut: true,
Autoloop: true,
AutoFeeBudget: 40066,
AutoFeeStartDate: testTime,
MaxAutoInFlight: 2,

@ -220,8 +220,8 @@ type Config struct {
// Parameters is a set of parameters provided by the user which guide
// how we assess liquidity.
type Parameters struct {
// AutoOut enables automatic dispatch of loop out swaps.
AutoOut bool
// Autoloop enables automatic dispatch of swaps.
Autoloop bool
// AutoFeeBudget is the total amount we allow to be spent on
// 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
// 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
// to determine the information we add to our swap suggestion and whether we
// return any suggestions.
func (m *Manager) SuggestSwaps(ctx context.Context, autoOut bool) (
func (m *Manager) SuggestSwaps(ctx context.Context, autoloop bool) (
[]loop.OutRequest, error) {
m.paramsLock.Lock()
@ -681,7 +681,7 @@ func (m *Manager) SuggestSwaps(ctx context.Context, autoOut bool) (
}
outRequest, err := m.makeLoopOutRequest(
ctx, suggestion, quote, autoOut,
ctx, suggestion, quote, autoloop,
)
if err != nil {
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,
// and they are not enabled in our parameters, we just log the swap
// suggestions and return an empty set of suggestions.
if autoOut && !m.params.AutoOut {
if autoloop && !m.params.Autoloop {
for _, swap := range inBudget {
log.Debugf("recommended autoloop: %v sats over "+
"%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).
func (m *Manager) makeLoopOutRequest(ctx context.Context,
suggestion *LoopOutRecommendation, quote *loop.LoopOutQuote,
autoOut bool) (loop.OutRequest, error) {
autoloop bool) (loop.OutRequest, error) {
prepayMaxFee := ppmToSat(
quote.PrepayAmount, m.params.MaximumPrepayRoutingFeePPM,
@ -815,7 +815,7 @@ func (m *Manager) makeLoopOutRequest(ctx context.Context,
Initiator: autoloopSwapInitiator,
}
if autoOut {
if autoloop {
request.Label = labels.AutoOutLabel()
addr, err := m.cfg.Lnd.WalletKit.NextAddr(ctx)

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

Loading…
Cancel
Save