mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-05 02:11:10 +01:00
multi: rename due to required maxHTLC bit
We rename `ChanUpdateOptionMaxHtlc` to `ChanUpdateRequiredMaxHtlc` as with the latest changes it is now required. Similarly, rename `validateOptionalFields` to `ValidateChannelUpdateFields`, export it to use it in a later commit.
This commit is contained in:
@@ -129,7 +129,7 @@ func ValidateNodeAnn(a *lnwire.NodeAnnouncement) error {
|
||||
func ValidateChannelUpdateAnn(pubKey *btcec.PublicKey, capacity btcutil.Amount,
|
||||
a *lnwire.ChannelUpdate) error {
|
||||
|
||||
if err := validateOptionalFields(capacity, a); err != nil {
|
||||
if err := ValidateChannelUpdateFields(capacity, a); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -160,9 +160,9 @@ func VerifyChannelUpdateSignature(msg *lnwire.ChannelUpdate,
|
||||
return nil
|
||||
}
|
||||
|
||||
// validateOptionalFields validates a channel update's message flags and
|
||||
// ValidateChannelUpdateFields validates a channel update's message flags and
|
||||
// corresponding update fields.
|
||||
func validateOptionalFields(capacity btcutil.Amount,
|
||||
func ValidateChannelUpdateFields(capacity btcutil.Amount,
|
||||
msg *lnwire.ChannelUpdate) error {
|
||||
|
||||
if msg.MessageFlags.HasMaxHtlc() {
|
||||
|
||||
@@ -213,7 +213,7 @@ func (r *Manager) updateEdge(tx kvdb.RTx, chanPoint wire.OutPoint,
|
||||
}
|
||||
|
||||
// If the MaxHtlc flag wasn't already set, we can set it now.
|
||||
edge.MessageFlags |= lnwire.ChanUpdateOptionMaxHtlc
|
||||
edge.MessageFlags |= lnwire.ChanUpdateRequiredMaxHtlc
|
||||
|
||||
// Validate htlc amount constraints.
|
||||
switch {
|
||||
|
||||
@@ -46,7 +46,7 @@ func TestManager(t *testing.T) {
|
||||
|
||||
currentPolicy := channeldb.ChannelEdgePolicy{
|
||||
MinHTLC: minHTLC,
|
||||
MessageFlags: lnwire.ChanUpdateOptionMaxHtlc,
|
||||
MessageFlags: lnwire.ChanUpdateRequiredMaxHtlc,
|
||||
}
|
||||
|
||||
updateForwardingPolicies := func(
|
||||
|
||||
@@ -676,7 +676,7 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
|
||||
if node1.testChannelPolicy != nil {
|
||||
var msgFlags lnwire.ChanUpdateMsgFlags
|
||||
if node1.MaxHTLC != 0 {
|
||||
msgFlags |= lnwire.ChanUpdateOptionMaxHtlc
|
||||
msgFlags |= lnwire.ChanUpdateRequiredMaxHtlc
|
||||
}
|
||||
var channelFlags lnwire.ChanUpdateChanFlags
|
||||
if node1.Disabled {
|
||||
@@ -713,7 +713,7 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
|
||||
if node2.testChannelPolicy != nil {
|
||||
var msgFlags lnwire.ChanUpdateMsgFlags
|
||||
if node2.MaxHTLC != 0 {
|
||||
msgFlags |= lnwire.ChanUpdateOptionMaxHtlc
|
||||
msgFlags |= lnwire.ChanUpdateRequiredMaxHtlc
|
||||
}
|
||||
var channelFlags lnwire.ChanUpdateChanFlags
|
||||
if node2.Disabled {
|
||||
|
||||
@@ -25,7 +25,7 @@ func TestNodeEdgeUnifier(t *testing.T) {
|
||||
FeeProportionalMillionths: 100000,
|
||||
FeeBaseMSat: 30,
|
||||
TimeLockDelta: 60,
|
||||
MessageFlags: lnwire.ChanUpdateOptionMaxHtlc,
|
||||
MessageFlags: lnwire.ChanUpdateRequiredMaxHtlc,
|
||||
MaxHTLC: 5000,
|
||||
MinHTLC: 100,
|
||||
}
|
||||
@@ -33,7 +33,7 @@ func TestNodeEdgeUnifier(t *testing.T) {
|
||||
FeeProportionalMillionths: 190000,
|
||||
FeeBaseMSat: 10,
|
||||
TimeLockDelta: 40,
|
||||
MessageFlags: lnwire.ChanUpdateOptionMaxHtlc,
|
||||
MessageFlags: lnwire.ChanUpdateRequiredMaxHtlc,
|
||||
MaxHTLC: 4000,
|
||||
MinHTLC: 100,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user