• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 15736109134

18 Jun 2025 02:46PM UTC coverage: 58.197% (-10.1%) from 68.248%
15736109134

Pull #9752

github

web-flow
Merge d2634a68c into 31c74f20f
Pull Request #9752: routerrpc: reject payment to invoice that don't have payment secret or blinded paths

6 of 13 new or added lines in 2 files covered. (46.15%)

28331 existing lines in 455 files now uncovered.

97860 of 168153 relevant lines covered (58.2%)

1.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

47.62
/batch/kvdb.go
1
package batch
2

3
import (
4
        "context"
5
        "fmt"
6

7
        "github.com/lightningnetwork/lnd/kvdb"
8
        "github.com/lightningnetwork/lnd/sqldb"
9
)
10

11
// BoltBatcher is a bbolt implementation of the sqldb.BatchedTx interface.
12
type BoltBatcher[Q any] struct {
13
        db kvdb.Backend
14
}
15

16
// NewBoltBackend creates a new BoltBackend instance.
17
func NewBoltBackend[Q any](db kvdb.Backend) *BoltBatcher[Q] {
3✔
18
        return &BoltBatcher[Q]{db: db}
3✔
19
}
3✔
20

21
// ExecTx will execute the passed txBody, operating upon generic
22
// parameter Q (usually a storage interface) in a single transaction.
23
//
24
// NOTE: This is part of the sqldb.BatchedTx interface.
25
func (t *BoltBatcher[Q]) ExecTx(_ context.Context, opts sqldb.TxOptions,
26
        txBody func(Q) error, reset func()) error {
3✔
27

3✔
28
        if opts.ReadOnly() {
3✔
UNCOV
29
                return kvdb.View(t.db, func(tx kvdb.RTx) error {
×
UNCOV
30
                        q, ok := any(tx).(Q)
×
UNCOV
31
                        if !ok {
×
32
                                return fmt.Errorf("unable to cast tx(%T) "+
×
33
                                        "into the type expected by the "+
×
34
                                        "BoltBatcher(%T)", tx, t)
×
35
                        }
×
36

UNCOV
37
                        return txBody(q)
×
38
                }, reset)
39
        }
40

41
        return kvdb.Update(t.db, func(tx kvdb.RwTx) error {
6✔
42
                q, ok := any(tx).(Q)
3✔
43
                if !ok {
3✔
44
                        return fmt.Errorf("unable to cast tx(%T) into the "+
×
45
                                "type expected by the BoltBatcher(%T)", tx, t)
×
46
                }
×
47

48
                return txBody(q)
3✔
49
        }, reset)
50
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc