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

lightningnetwork / lnd / 13157733617

05 Feb 2025 12:49PM UTC coverage: 57.712% (-1.1%) from 58.82%
13157733617

Pull #9447

github

yyforyongyu
sweep: rename methods for clarity

We now rename "third party" to "unknown" as the inputs can be spent via
an older sweeping tx, a third party (anchor), or a remote party (pin).
In fee bumper we don't have the info to distinguish the above cases, and
leave them to be further handled by the sweeper as it has more context.
Pull Request #9447: sweep: start tracking input spending status in the fee bumper

83 of 87 new or added lines in 2 files covered. (95.4%)

19472 existing lines in 252 files now uncovered.

103634 of 179570 relevant lines covered (57.71%)

24840.31 hits per line

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

50.0
/batch/interface.go
1
package batch
2

3
import "github.com/lightningnetwork/lnd/kvdb"
4

5
// Request defines an operation that can be batched into a single bbolt
6
// transaction.
7
type Request struct {
8
        // Reset is called before each invocation of Update and is used to clear
9
        // any possible modifications to local state as a result of previous
10
        // calls to Update that were not committed due to a concurrent batch
11
        // failure.
12
        //
13
        // NOTE: This field is optional.
14
        Reset func()
15

16
        // Update is applied alongside other operations in the batch.
17
        //
18
        // NOTE: This method MUST NOT acquire any mutexes.
19
        Update func(tx kvdb.RwTx) error
20

21
        // OnCommit is called if the batch or a subset of the batch including
22
        // this request all succeeded without failure. The passed error should
23
        // contain the result of the transaction commit, as that can still fail
24
        // even if none of the closures returned an error.
25
        //
26
        // NOTE: This field is optional.
27
        OnCommit func(commitErr error) error
28

29
        // lazy should be true if we don't have to immediately execute this
30
        // request when it comes in. This means that it can be scheduled later,
31
        // allowing larger batches.
32
        lazy bool
33
}
34

35
// SchedulerOption is a type that can be used to supply options to a scheduled
36
// request.
37
type SchedulerOption func(r *Request)
38

39
// LazyAdd will make the request be executed lazily, added to the next batch to
40
// reduce db contention.
41
func LazyAdd() SchedulerOption {
283✔
42
        return func(r *Request) {
283✔
UNCOV
43
                r.lazy = true
×
UNCOV
44
        }
×
45
}
46

47
// Scheduler abstracts a generic batching engine that accumulates an incoming
48
// set of Requests, executes them, and returns the error from the operation.
49
type Scheduler interface {
50
        // Execute schedules a Request for execution with the next available
51
        // batch. This method blocks until the underlying closure has been
52
        // run against the database. The resulting error is returned to the
53
        // caller.
54
        Execute(req *Request) error
55
}
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