Skip to content

Commit 481839b

Browse files
committed
liquidity: add initiator to swap requests
1 parent 8758d00 commit 481839b

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

liquidity/autoloop_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ func TestAutoLoopEnabled(t *testing.T) {
146146
SweepConfTarget: params.SweepConfTarget,
147147
OutgoingChanSet: loopdb.ChannelSet{chanID1.ToUint64()},
148148
Label: labels.AutoOutLabel(),
149+
Initiator: autoloopSwapInitiator,
149150
}
150151

151152
chan2Swap = &loop.OutRequest{
@@ -161,6 +162,7 @@ func TestAutoLoopEnabled(t *testing.T) {
161162
SweepConfTarget: params.SweepConfTarget,
162163
OutgoingChanSet: loopdb.ChannelSet{chanID2.ToUint64()},
163164
Label: labels.AutoOutLabel(),
165+
Initiator: autoloopSwapInitiator,
164166
}
165167

166168
loopOuts = []loopOutRequestResp{

liquidity/liquidity.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ const (
9999
// DefaultAutoOutTicker is the default amount of time between automated
100100
// loop out checks.
101101
DefaultAutoOutTicker = time.Minute * 10
102+
103+
// autoloopSwapInitiator is the value we send in the initiator field of
104+
// a swap request when issuing an automatic swap.
105+
autoloopSwapInitiator = "autoloop"
102106
)
103107

104108
var (
@@ -704,6 +708,7 @@ func (m *Manager) makeLoopOutRequest(ctx context.Context,
704708
MaxSwapFee: quote.SwapFee,
705709
MaxPrepayAmount: quote.PrepayAmount,
706710
SweepConfTarget: m.params.SweepConfTarget,
711+
Initiator: autoloopSwapInitiator,
707712
}
708713

709714
if autoOut {

liquidity/liquidity_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ var (
6868
MaxSwapFee: testQuote.SwapFee,
6969
MaxPrepayAmount: testQuote.PrepayAmount,
7070
SweepConfTarget: loop.DefaultSweepConfTarget,
71+
Initiator: autoloopSwapInitiator,
7172
}
7273

7374
// chan2Rec is the suggested swap for channel 2 when we use chanRule.
@@ -80,6 +81,7 @@ var (
8081
MaxPrepayAmount: testQuote.PrepayAmount,
8182
MaxSwapFee: testQuote.SwapFee,
8283
SweepConfTarget: loop.DefaultSweepConfTarget,
84+
Initiator: autoloopSwapInitiator,
8385
}
8486

8587
// chan1Out is a contract that uses channel 1, used to represent on

0 commit comments

Comments
 (0)