• 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

0.0
/chainntnfs/neutrinonotify/neutrino_dev.go
1
//go:build dev
2
// +build dev
3

4
package neutrinonotify
5

6
import (
7
        "fmt"
8
        "time"
9

10
        "github.com/btcsuite/btcd/chaincfg/chainhash"
11
        "github.com/btcsuite/btcd/rpcclient"
12
        "github.com/lightninglabs/neutrino"
13
        "github.com/lightningnetwork/lnd/chainntnfs"
14
)
15

16
// UnsafeStart starts the notifier with a specified best height and optional
17
// best hash. Its bestHeight, txNotifier and neutrino node are initialized with
18
// bestHeight. The parameter generateBlocks is necessary for the bitcoind
19
// notifier to ensure we drain all notifications up to syncHeight, since if they
20
// are generated ahead of UnsafeStart the chainConn may start up with an
21
// outdated best block and miss sending ntfns. Used for testing.
22
func (n *NeutrinoNotifier) UnsafeStart(bestHeight int32,
23
        bestHash *chainhash.Hash, syncHeight int32,
24
        generateBlocks func() error) error {
×
25

×
26
        // We'll obtain the latest block height of the p2p node. We'll
×
27
        // start the auto-rescan from this point. Once a caller actually wishes
×
28
        // to register a chain view, the rescan state will be rewound
×
29
        // accordingly.
×
30
        startingPoint, err := n.p2pNode.BestBlock()
×
31
        if err != nil {
×
32
                return err
×
33
        }
×
34

35
        // Next, we'll create our set of rescan options. Currently it's
36
        // required that a user MUST set an addr/outpoint/txid when creating a
37
        // rescan. To get around this, we'll add a "zero" outpoint, that won't
38
        // actually be matched.
39
        var zeroInput neutrino.InputWithScript
×
40
        rescanOptions := []neutrino.RescanOption{
×
41
                neutrino.StartBlock(startingPoint),
×
42
                neutrino.QuitChan(n.quit),
×
43
                neutrino.NotificationHandlers(
×
44
                        rpcclient.NotificationHandlers{
×
45
                                OnFilteredBlockConnected:    n.onFilteredBlockConnected,
×
46
                                OnFilteredBlockDisconnected: n.onFilteredBlockDisconnected,
×
47
                        },
×
48
                ),
×
49
                neutrino.WatchInputs(zeroInput),
×
50
        }
×
51

×
52
        n.txNotifier = chainntnfs.NewTxNotifier(
×
53
                uint32(bestHeight), chainntnfs.ReorgSafetyLimit,
×
54
                n.confirmHintCache, n.spendHintCache,
×
55
        )
×
56

×
57
        // Finally, we'll create our rescan struct, start it, and launch all
×
58
        // the goroutines we need to operate this ChainNotifier instance.
×
59
        n.chainView = neutrino.NewRescan(
×
60
                &neutrino.RescanChainSource{
×
61
                        ChainService: n.p2pNode,
×
62
                },
×
63
                rescanOptions...,
×
64
        )
×
65
        n.rescanErr = n.chainView.Start()
×
66

×
67
        n.txUpdates.Start()
×
68

×
69
        if generateBlocks != nil {
×
70
                // Ensure no block notifications are pending when we start the
×
71
                // notification dispatcher goroutine.
×
72

×
73
                // First generate the blocks, then drain the notifications
×
74
                // for the generated blocks.
×
75
                if err := generateBlocks(); err != nil {
×
76
                        return err
×
77
                }
×
78

79
                timeout := time.After(60 * time.Second)
×
80
        loop:
×
81
                for {
×
82
                        select {
×
83
                        case ntfn := <-n.chainUpdates:
×
84
                                lastReceivedNtfn := ntfn
×
85
                                if lastReceivedNtfn.height >= uint32(syncHeight) {
×
86
                                        break loop
×
87
                                }
88
                        case <-timeout:
×
89
                                return fmt.Errorf("unable to catch up to height %d",
×
90
                                        syncHeight)
×
91
                        }
92
                }
93
        }
94

95
        // Run notificationDispatcher after setting the notifier's best height
96
        // to avoid a race condition.
97
        n.bestBlock.Hash = bestHash
×
98
        n.bestBlock.Height = bestHeight
×
99

×
100
        n.wg.Add(1)
×
101
        go n.notificationDispatcher()
×
102

×
103
        return nil
×
104
}
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