Browse Source

liquidity: add initiator to swap requests

pull/316/head
Oliver Gugger 2 months ago
parent
commit
481839b0fb
No known key found for this signature in database GPG Key ID: 8E4256593F177720
3 changed files with 9 additions and 0 deletions
  1. +2
    -0
      liquidity/autoloop_test.go
  2. +5
    -0
      liquidity/liquidity.go
  3. +2
    -0
      liquidity/liquidity_test.go

+ 2
- 0
liquidity/autoloop_test.go View File

@ -146,6 +146,7 @@ func TestAutoLoopEnabled(t *testing.T) {
SweepConfTarget: params.SweepConfTarget,
OutgoingChanSet: loopdb.ChannelSet{chanID1.ToUint64()},
Label: labels.AutoOutLabel(),
Initiator: autoloopSwapInitiator,
}
chan2Swap = &loop.OutRequest{
@ -161,6 +162,7 @@ func TestAutoLoopEnabled(t *testing.T) {
SweepConfTarget: params.SweepConfTarget,
OutgoingChanSet: loopdb.ChannelSet{chanID2.ToUint64()},
Label: labels.AutoOutLabel(),
Initiator: autoloopSwapInitiator,
}
loopOuts = []loopOutRequestResp{

+ 5
- 0
liquidity/liquidity.go View File

@ -99,6 +99,10 @@ const (
// DefaultAutoOutTicker is the default amount of time between automated
// loop out checks.
DefaultAutoOutTicker = time.Minute * 10
// autoloopSwapInitiator is the value we send in the initiator field of
// a swap request when issuing an automatic swap.
autoloopSwapInitiator = "autoloop"
)
var (
@ -704,6 +708,7 @@ func (m *Manager) makeLoopOutRequest(ctx context.Context,
MaxSwapFee: quote.SwapFee,
MaxPrepayAmount: quote.PrepayAmount,
SweepConfTarget: m.params.SweepConfTarget,
Initiator: autoloopSwapInitiator,
}
if autoOut {

+ 2
- 0
liquidity/liquidity_test.go View File

@ -68,6 +68,7 @@ var (
MaxSwapFee: testQuote.SwapFee,
MaxPrepayAmount: testQuote.PrepayAmount,
SweepConfTarget: loop.DefaultSweepConfTarget,
Initiator: autoloopSwapInitiator,
}
// chan2Rec is the suggested swap for channel 2 when we use chanRule.
@ -80,6 +81,7 @@ var (
MaxPrepayAmount: testQuote.PrepayAmount,
MaxSwapFee: testQuote.SwapFee,
SweepConfTarget: loop.DefaultSweepConfTarget,
Initiator: autoloopSwapInitiator,
}
// chan1Out is a contract that uses channel 1, used to represent on

Loading…
Cancel
Save