8686 // defaultRFQExpiry is the default expiry time for RFQs.
8787 defaultRFQExpiry = 5 * time .Minute
8888
89- // defaultRFQMaxLimitMultiplier is the default maximum fee multiplier for
90- // RFQs.
89+ // defaultRFQMaxLimitMultiplier is the default maximum fee multiplier
90+ // for RFQs.
9191 defaultRFQMaxLimitMultiplier = 1.2
9292)
9393
@@ -179,8 +179,8 @@ type ClientConfig struct {
179179
180180// NewClient returns a new instance to initiate swaps with.
181181func NewClient (dbDir string , loopDB loopdb.SwapStore ,
182- sweeperDb sweepbatcher.BatcherStore , cfg * ClientConfig ) (
183- * Client , func (), error ) {
182+ sweeperDb sweepbatcher.BatcherStore , cfg * ClientConfig ) (* Client ,
183+ func (), error ) {
184184
185185 l402Store , err := l402 .NewFileStore (dbDir )
186186 if err != nil {
@@ -209,7 +209,9 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
209209 Lnd : cfg .Lnd ,
210210 }
211211
212- verifySchnorrSig := func (pubKey * btcec.PublicKey , hash , sig []byte ) error {
212+ verifySchnorrSig := func (pubKey * btcec.PublicKey , hash ,
213+ sig []byte ) error {
214+
213215 schnorrSig , err := schnorr .ParseSignature (sig )
214216 if err != nil {
215217 return err
@@ -226,8 +228,9 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
226228 loopDB , cfg .Lnd .ChainParams ,
227229 )
228230 if err != nil {
229- return nil , nil , fmt .Errorf ("sweepbatcher." +
230- "NewSweepFetcherFromSwapStore failed: %w" , err )
231+ return nil , nil , fmt .Errorf (
232+ "sweepbatcher.NewSweepFetcherFromSwapStore failed: %w" ,
233+ err )
231234 }
232235
233236 // There is circular dependency between executor and sweepbatcher, as
@@ -281,9 +284,11 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
281284 }
282285 skippedTxns [* txid ] = struct {}{}
283286 }
284- batcherOpts = append (batcherOpts , sweepbatcher .WithSkippedTxns (
285- skippedTxns ,
286- ))
287+ batcherOpts = append (
288+ batcherOpts , sweepbatcher .WithSkippedTxns (
289+ skippedTxns ,
290+ ),
291+ )
287292 }
288293
289294 batcher := sweepbatcher .NewBatcher (
@@ -533,15 +538,14 @@ func (s *Client) resumeSwaps(ctx context.Context,
533538// automatically after restarts.
534539//
535540// The return value is a hash that uniquely identifies the new swap.
536- func (s * Client ) LoopOut (globalCtx context.Context ,
537- request * OutRequest ) ( * LoopOutSwapInfo , error ) {
541+ func (s * Client ) LoopOut (globalCtx context.Context , request * OutRequest ) (
542+ * LoopOutSwapInfo , error ) {
538543
539544 if request .AssetId != nil {
540545 if request .AssetPrepayRfqId == nil ||
541546 request .AssetSwapRfqId == nil {
542-
543- return nil , errors .New ("asset prepay and swap rfq ids " +
544- "must be set when using an asset id" )
547+ return nil , errors .New ("asset prepay and swap rfq " +
548+ "ids must be set when using an asset id" )
545549 }
546550
547551 // Verify that if we have an asset id set, we have a valid asset
@@ -551,14 +555,11 @@ func (s *Client) LoopOut(globalCtx context.Context,
551555 "when using an asset id" )
552556 }
553557
554- log .Infof ("LoopOut %v sats to %v with asset %x" ,
555- request .Amount , request .DestAddr , request .AssetId ,
556- )
558+ log .Infof ("LoopOut %v sats to %v with asset %x" , request .Amount ,
559+ request .DestAddr , request .AssetId )
557560 } else {
558- log .Infof ("LoopOut %v to %v (channels: %v)" ,
559- request .Amount , request .DestAddr ,
560- request .OutgoingChanSet ,
561- )
561+ log .Infof ("LoopOut %v to %v (channels: %v)" , request .Amount ,
562+ request .DestAddr , request .OutgoingChanSet )
562563 }
563564
564565 if err := s .waitForInitialized (globalCtx ); err != nil {
@@ -750,13 +751,10 @@ func (s *Client) waitForInitialized(ctx context.Context) error {
750751}
751752
752753// LoopIn initiates a loop in swap.
753- func (s * Client ) LoopIn (globalCtx context.Context ,
754- request * LoopInRequest ) ( * LoopInSwapInfo , error ) {
754+ func (s * Client ) LoopIn (globalCtx context.Context , request * LoopInRequest ) (
755+ * LoopInSwapInfo , error ) {
755756
756- log .Infof ("Loop in %v (last hop: %v)" ,
757- request .Amount ,
758- request .LastHop ,
759- )
757+ log .Infof ("Loop in %v (last hop: %v)" , request .Amount , request .LastHop )
760758
761759 if err := s .waitForInitialized (globalCtx ); err != nil {
762760 return nil , err
@@ -802,8 +800,8 @@ func (s *Client) LoopIn(globalCtx context.Context,
802800// LoopInQuote takes an amount and returns a breakdown of estimated costs for
803801// the client. Both the swap server and the on-chain fee estimator are queried
804802// to get to build the quote response.
805- func (s * Client ) LoopInQuote (ctx context.Context ,
806- request * LoopInQuoteRequest ) ( * LoopInQuote , error ) {
803+ func (s * Client ) LoopInQuote (ctx context.Context , request * LoopInQuoteRequest ) (
804+ * LoopInQuote , error ) {
807805
808806 // Retrieve current server terms to calculate swap fee.
809807 terms , err := s .Server .GetLoopInTerms (ctx , request .Initiator )
@@ -945,8 +943,10 @@ func wrapGrpcError(message string, err error) error {
945943 grpcStatus , _ := status .FromError (err )
946944
947945 return status .Error (
948- grpcStatus .Code (), fmt .Sprintf ("%v: %v" , message ,
949- grpcStatus .Message ()),
946+ grpcStatus .Code (),
947+ fmt .Sprintf (
948+ "%v: %v" , message , grpcStatus .Message (),
949+ ),
950950 )
951951}
952952
@@ -988,8 +988,8 @@ func (s *Client) getAssetRfq(ctx context.Context, quote *LoopOutQuote,
988988 request * LoopOutQuoteRequest ) (* LoopOutRfq , error ) {
989989
990990 if s .AssetClient == nil {
991- return nil , errors .New ("asset client must be set " +
992- "when trying to loop out with an asset" )
991+ return nil , errors .New ("asset client must be set when trying " +
992+ "to loop out with an asset" )
993993 }
994994 rfqReq := request .AssetRFQRequest
995995 if rfqReq .Expiry == 0 {
@@ -1002,9 +1002,8 @@ func (s *Client) getAssetRfq(ctx context.Context, quote *LoopOutQuote,
10021002
10031003 // First we'll get the prepay rfq.
10041004 prepayRfq , err := s .AssetClient .GetRfqForAsset (
1005- ctx , quote .PrepayAmount , rfqReq .AssetId ,
1006- rfqReq .AssetEdgeNode , rfqReq .Expiry ,
1007- rfqReq .MaxLimitMultiplier ,
1005+ ctx , quote .PrepayAmount , rfqReq .AssetId , rfqReq .AssetEdgeNode ,
1006+ rfqReq .Expiry , rfqReq .MaxLimitMultiplier ,
10081007 )
10091008 if err != nil {
10101009 return nil , err
@@ -1023,9 +1022,8 @@ func (s *Client) getAssetRfq(ctx context.Context, quote *LoopOutQuote,
10231022 quote .PrepayAmount
10241023
10251024 swapRfq , err := s .AssetClient .GetRfqForAsset (
1026- ctx , invoiceAmt , rfqReq .AssetId ,
1027- rfqReq .AssetEdgeNode , rfqReq .Expiry ,
1028- rfqReq .MaxLimitMultiplier ,
1025+ ctx , invoiceAmt , rfqReq .AssetId , rfqReq .AssetEdgeNode ,
1026+ rfqReq .Expiry , rfqReq .MaxLimitMultiplier ,
10291027 )
10301028 if err != nil {
10311029 return nil , err
0 commit comments