Skip to content

Commit 0ec63a6

Browse files
authored
Merge pull request #778 from starius/sweepbatcher-sql-test
sweepbatcher: unit tests with SQL loopdb as well
2 parents a4e0102 + 029d087 commit 0ec63a6

File tree

2 files changed

+457
-91
lines changed

2 files changed

+457
-91
lines changed

sweepbatcher/sweep_batcher.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ func (b *Batcher) convertSweep(ctx context.Context, dbSweep *dbSweep) (
701701

702702
s, err := b.sweepStore.FetchSweep(ctx, dbSweep.SwapHash)
703703
if err != nil {
704-
return nil, fmt.Errorf("failed to fetch sweep data for %x: %v",
704+
return nil, fmt.Errorf("failed to fetch sweep data for %x: %w",
705705
dbSweep.SwapHash[:6], err)
706706
}
707707

@@ -748,22 +748,22 @@ func (f *SwapStoreWrapper) FetchSweep(ctx context.Context,
748748

749749
swap, err := f.swapStore.FetchLoopOutSwap(ctx, swapHash)
750750
if err != nil {
751-
return nil, fmt.Errorf("failed to fetch loop out for %x: %v",
751+
return nil, fmt.Errorf("failed to fetch loop out for %x: %w",
752752
swapHash[:6], err)
753753
}
754754

755755
htlc, err := utils.GetHtlc(
756756
swapHash, &swap.Contract.SwapContract, f.chainParams,
757757
)
758758
if err != nil {
759-
return nil, fmt.Errorf("failed to get htlc: %v", err)
759+
return nil, fmt.Errorf("failed to get htlc: %w", err)
760760
}
761761

762762
swapPaymentAddr, err := utils.ObtainSwapPaymentAddr(
763763
swap.Contract.SwapInvoice, f.chainParams,
764764
)
765765
if err != nil {
766-
return nil, fmt.Errorf("failed to get payment addr: %v", err)
766+
return nil, fmt.Errorf("failed to get payment addr: %w", err)
767767
}
768768

769769
return &SweepInfo{
@@ -798,7 +798,7 @@ func (b *Batcher) fetchSweep(ctx context.Context,
798798

799799
s, err := b.sweepStore.FetchSweep(ctx, sweepReq.SwapHash)
800800
if err != nil {
801-
return nil, fmt.Errorf("failed to fetch sweep data for %x: %v",
801+
return nil, fmt.Errorf("failed to fetch sweep data for %x: %w",
802802
sweepReq.SwapHash[:6], err)
803803
}
804804

0 commit comments

Comments
 (0)