Merge pull request #7415 from bitromortac/2302-max-htlc

routing+discovery: fail non-maxHTLC channel updates in validation
This commit is contained in:
Oliver Gugger authored and GitHub committed 2023-02-22 08:45:56 +01:00
commit b3e27f9ba7
17 files changed
+118 -54

No files matched your search

+1 -1
View File
@@ -2924,7 +2924,7 @@ func TestEdgePolicyMissingMaxHtcl(t *testing.T) {
// Set the max_htlc field. The extra bytes added to the serialization
// will be the opaque data containing the serialized field.
edge1.MessageFlags = lnwire.ChanUpdateOptionMaxHtlc
edge1.MessageFlags = lnwire.ChanUpdateRequiredMaxHtlc
edge1.MaxHTLC = 13928598
var b2 bytes.Buffer
err = serializeChanEdgePolicy(&b2, edge1, to)
@@ -14,9 +14,9 @@ import (
type ChanUpdateMsgFlags uint8
const (
// ChanUpdateOptionMaxHtlc is a bit that indicates whether the
// ChanUpdateRequiredMaxHtlc is a bit that indicates whether the
// optional htlc_maximum_msat field is present in this ChannelUpdate.
ChanUpdateOptionMaxHtlc ChanUpdateMsgFlags = 1 << iota
ChanUpdateRequiredMaxHtlc ChanUpdateMsgFlags = 1 << iota
)
// String returns the bitfield flags as a string.
@@ -27,7 +27,7 @@ func (c ChanUpdateMsgFlags) String() string {
// HasMaxHtlc returns true if the htlc_maximum_msat option bit is set in the
// message flags.
func (c ChanUpdateMsgFlags) HasMaxHtlc() bool {
return c&ChanUpdateOptionMaxHtlc != 0
return c&ChanUpdateRequiredMaxHtlc != 0
}
// ChanUpdateChanFlags is a bitfield that signals various options concerning a