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

lightningnetwork / lnd / 13035292482

29 Jan 2025 03:59PM UTC coverage: 49.3% (-9.5%) from 58.777%
13035292482

Pull #9456

github

mohamedawnallah
docs: update release-notes-0.19.0.md

In this commit, we warn users about the removal
of RPCs `SendToRoute`, `SendToRouteSync`, `SendPayment`,
and `SendPaymentSync` in the next release 0.20.
Pull Request #9456: lnrpc+docs: deprecate warning `SendToRoute`, `SendToRouteSync`, `SendPayment`, and `SendPaymentSync` in Release 0.19

100634 of 204126 relevant lines covered (49.3%)

1.54 hits per line

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

58.7
/watchtower/wtclient/sess_close_min_heap.go
1
package wtclient
2

3
import (
4
        "sync"
5

6
        "github.com/lightningnetwork/lnd/queue"
7
        "github.com/lightningnetwork/lnd/watchtower/wtdb"
8
)
9

10
// sessionCloseMinHeap is a thread-safe min-heap implementation that stores
11
// sessionCloseItem items and prioritises the item with the lowest block height.
12
type sessionCloseMinHeap struct {
13
        queue queue.PriorityQueue
14
        mu    sync.Mutex
15
}
16

17
// newSessionCloseMinHeap constructs a new sessionCloseMineHeap.
18
func newSessionCloseMinHeap() *sessionCloseMinHeap {
3✔
19
        return &sessionCloseMinHeap{}
3✔
20
}
3✔
21

22
// Len returns the length of the queue.
23
func (h *sessionCloseMinHeap) Len() int {
×
24
        h.mu.Lock()
×
25
        defer h.mu.Unlock()
×
26

×
27
        return h.queue.Len()
×
28
}
×
29

30
// Empty returns true if the queue is empty.
31
func (h *sessionCloseMinHeap) Empty() bool {
×
32
        h.mu.Lock()
×
33
        defer h.mu.Unlock()
×
34

×
35
        return h.queue.Empty()
×
36
}
×
37

38
// Push adds an item to the priority queue.
39
func (h *sessionCloseMinHeap) Push(item *sessionCloseItem) {
3✔
40
        h.mu.Lock()
3✔
41
        defer h.mu.Unlock()
3✔
42

3✔
43
        h.queue.Push(item)
3✔
44
}
3✔
45

46
// Pop removes the top most item from the queue.
47
func (h *sessionCloseMinHeap) Pop() *sessionCloseItem {
3✔
48
        h.mu.Lock()
3✔
49
        defer h.mu.Unlock()
3✔
50

3✔
51
        if h.queue.Empty() {
3✔
52
                return nil
×
53
        }
×
54

55
        item := h.queue.Pop()
3✔
56

3✔
57
        return item.(*sessionCloseItem) //nolint:forcetypeassert
3✔
58
}
59

60
// Top returns the top most item from the queue without removing it.
61
func (h *sessionCloseMinHeap) Top() *sessionCloseItem {
3✔
62
        h.mu.Lock()
3✔
63
        defer h.mu.Unlock()
3✔
64

3✔
65
        if h.queue.Empty() {
6✔
66
                return nil
3✔
67
        }
3✔
68

69
        item := h.queue.Top()
3✔
70

3✔
71
        return item.(*sessionCloseItem) //nolint:forcetypeassert
3✔
72
}
73

74
// sessionCloseItem represents a session that is ready to be deleted.
75
type sessionCloseItem struct {
76
        // sessionID is the ID of the session in question.
77
        sessionID wtdb.SessionID
78

79
        // deleteHeight is the block height after which we can delete the
80
        // session.
81
        deleteHeight uint32
82
}
83

84
// Less returns true if the current item's delete height is less than the
85
// other sessionCloseItem's delete height. This results in lower block heights
86
// being popped first from the heap.
87
//
88
// NOTE: this is part of the queue.PriorityQueueItem interface.
89
func (s *sessionCloseItem) Less(other queue.PriorityQueueItem) bool {
×
90
        o := other.(*sessionCloseItem).deleteHeight //nolint:forcetypeassert
×
91

×
92
        return s.deleteHeight < o
×
93
}
×
94

95
var _ queue.PriorityQueueItem = (*sessionCloseItem)(nil)
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