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

lightningnetwork / lnd / 15838907453

24 Jun 2025 01:26AM UTC coverage: 57.079% (-11.1%) from 68.172%
15838907453

Pull #9982

github

web-flow
Merge e42780be2 into 45c15646c
Pull Request #9982: lnwire+lnwallet: add LocalNonces field for splice nonce coordination w/ taproot channels

103 of 167 new or added lines in 5 files covered. (61.68%)

30191 existing lines in 463 files now uncovered.

96331 of 168768 relevant lines covered (57.08%)

0.6 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] {
1✔
18
        return &BoltBatcher[Q]{db: db}
1✔
19
}
1✔
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 {
1✔
27

1✔
28
        if opts.ReadOnly() {
1✔
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 {
2✔
42
                q, ok := any(tx).(Q)
1✔
43
                if !ok {
1✔
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)
1✔
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