• 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

25.93
/graph/db/models/channel_edge_policy.go
1
package models
2

3
import (
4
        "time"
5

6
        "github.com/btcsuite/btcd/btcec/v2/ecdsa"
7
        "github.com/lightningnetwork/lnd/lnwire"
8
)
9

10
// ChannelEdgePolicy represents a *directed* edge within the channel graph. For
11
// each channel in the database, there are two distinct edges: one for each
12
// possible direction of travel along the channel. The edges themselves hold
13
// information concerning fees, and minimum time-lock information which is
14
// utilized during path finding.
15
type ChannelEdgePolicy struct {
16
        // SigBytes is the raw bytes of the signature of the channel edge
17
        // policy. We'll only parse these if the caller needs to access the
18
        // signature for validation purposes. Do not set SigBytes directly, but
19
        // use SetSigBytes instead to make sure that the cache is invalidated.
20
        SigBytes []byte
21

22
        // sig is a cached fully parsed signature.
23
        sig *ecdsa.Signature
24

25
        // ChannelID is the unique channel ID for the channel. The first 3
26
        // bytes are the block height, the next 3 the index within the block,
27
        // and the last 2 bytes are the output index for the channel.
28
        ChannelID uint64
29

30
        // LastUpdate is the last time an authenticated edge for this channel
31
        // was received.
32
        LastUpdate time.Time
33

34
        // MessageFlags is a bitfield which indicates the presence of optional
35
        // fields (like max_htlc) in the policy.
36
        MessageFlags lnwire.ChanUpdateMsgFlags
37

38
        // ChannelFlags is a bitfield which signals the capabilities of the
39
        // channel as well as the directed edge this update applies to.
40
        ChannelFlags lnwire.ChanUpdateChanFlags
41

42
        // TimeLockDelta is the number of blocks this node will subtract from
43
        // the expiry of an incoming HTLC. This value expresses the time buffer
44
        // the node would like to HTLC exchanges.
45
        TimeLockDelta uint16
46

47
        // MinHTLC is the smallest value HTLC this node will forward, expressed
48
        // in millisatoshi.
49
        MinHTLC lnwire.MilliSatoshi
50

51
        // MaxHTLC is the largest value HTLC this node will forward, expressed
52
        // in millisatoshi.
53
        MaxHTLC lnwire.MilliSatoshi
54

55
        // FeeBaseMSat is the base HTLC fee that will be charged for forwarding
56
        // ANY HTLC, expressed in mSAT's.
57
        FeeBaseMSat lnwire.MilliSatoshi
58

59
        // FeeProportionalMillionths is the rate that the node will charge for
60
        // HTLCs for each millionth of a satoshi forwarded.
61
        FeeProportionalMillionths lnwire.MilliSatoshi
62

63
        // ToNode is the public key of the node that this directed edge leads
64
        // to. Using this pub key, the channel graph can further be traversed.
65
        ToNode [33]byte
66

67
        // ExtraOpaqueData is the set of data that was appended to this
68
        // message, some of which we may not actually know how to iterate or
69
        // parse. By holding onto this data, we ensure that we're able to
70
        // properly validate the set of signatures that cover these new fields,
71
        // and ensure we're able to make upgrades to the network in a forwards
72
        // compatible manner.
73
        ExtraOpaqueData lnwire.ExtraOpaqueData
74
}
75

76
// Signature is a channel announcement signature, which is needed for proper
77
// edge policy announcement.
78
//
79
// NOTE: By having this method to access an attribute, we ensure we only need
80
// to fully deserialize the signature if absolutely necessary.
81
func (c *ChannelEdgePolicy) Signature() (*ecdsa.Signature, error) {
82
        if c.sig != nil {
×
83
                return c.sig, nil
×
84
        }
×
85

×
86
        sig, err := ecdsa.ParseSignature(c.SigBytes)
87
        if err != nil {
×
88
                return nil, err
×
89
        }
×
90

×
91
        c.sig = sig
92

×
93
        return sig, nil
×
94
}
×
95

96
// SetSigBytes updates the signature and invalidates the cached parsed
97
// signature.
98
func (c *ChannelEdgePolicy) SetSigBytes(sig []byte) {
99
        c.SigBytes = sig
3✔
100
        c.sig = nil
3✔
101
}
3✔
102

3✔
103
// IsDisabled determines whether the edge has the disabled bit set.
104
func (c *ChannelEdgePolicy) IsDisabled() bool {
105
        return c.ChannelFlags.IsDisabled()
3✔
106
}
3✔
107

3✔
108
// ComputeFee computes the fee to forward an HTLC of `amt` milli-satoshis over
109
// the passed active payment channel. This value is currently computed as
110
// specified in BOLT07, but will likely change in the near future.
111
func (c *ChannelEdgePolicy) ComputeFee(
112
        amt lnwire.MilliSatoshi) lnwire.MilliSatoshi {
113

×
114
        return c.FeeBaseMSat + (amt*c.FeeProportionalMillionths)/feeRateParts
×
115
}
×
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