mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
multi: use context in loopdb call
This commit adds a context to our loopdb interface, which we should use in the sqlite migration.
This commit is contained in:
parent
319a519309
commit
becc8a38d8
15 changed files with 161 additions and 120 deletions
|
|
@ -450,7 +450,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
|
|||
}
|
||||
|
||||
// Retrieve all currently existing swaps from the database.
|
||||
swapsList, err := d.impl.FetchSwaps()
|
||||
swapsList, err := d.impl.FetchSwaps(d.mainCtx)
|
||||
if err != nil {
|
||||
if d.macaroonService == nil {
|
||||
cleanupMacaroonStore()
|
||||
|
|
|
|||
|
|
@ -741,11 +741,11 @@ func (s *swapClientServer) GetLsatTokens(ctx context.Context,
|
|||
|
||||
// GetInfo returns basic information about the loop daemon and details to swaps
|
||||
// from the swap store.
|
||||
func (s *swapClientServer) GetInfo(_ context.Context,
|
||||
func (s *swapClientServer) GetInfo(ctx context.Context,
|
||||
_ *clientrpc.GetInfoRequest) (*clientrpc.GetInfoResponse, error) {
|
||||
|
||||
// Fetch loop-outs from the loop db.
|
||||
outSwaps, err := s.impl.Store.FetchLoopOutSwaps()
|
||||
outSwaps, err := s.impl.Store.FetchLoopOutSwaps(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -772,7 +772,7 @@ func (s *swapClientServer) GetInfo(_ context.Context,
|
|||
}
|
||||
|
||||
// Fetch loop-ins from the loop db.
|
||||
inSwaps, err := s.impl.Store.FetchLoopInSwaps()
|
||||
inSwaps, err := s.impl.Store.FetchLoopInSwaps(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package loopd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
|
|
@ -42,7 +43,7 @@ func view(config *Config, lisCfg *ListenerCfg) error {
|
|||
}
|
||||
|
||||
func viewOut(swapClient *loop.Client, chainParams *chaincfg.Params) error {
|
||||
swaps, err := swapClient.Store.FetchLoopOutSwaps()
|
||||
swaps, err := swapClient.Store.FetchLoopOutSwaps(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -91,7 +92,7 @@ func viewOut(swapClient *loop.Client, chainParams *chaincfg.Params) error {
|
|||
}
|
||||
|
||||
func viewIn(swapClient *loop.Client, chainParams *chaincfg.Params) error {
|
||||
swaps, err := swapClient.Store.FetchLoopInSwaps()
|
||||
swaps, err := swapClient.Store.FetchLoopInSwaps(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue