lnwire+multi: define HasMaxHtlc helper on msgFlags

This commit is contained in:
Johan T. Halseth
2019-01-16 12:43:46 +01:00
parent 4fb1536f54
commit 7d34ce9d08
4 changed files with 14 additions and 8 deletions

View File

@ -156,7 +156,7 @@ func ValidateChannelUpdateAnn(pubKey *btcec.PublicKey, capacity btcutil.Amount,
func validateOptionalFields(capacity btcutil.Amount,
msg *lnwire.ChannelUpdate) error {
if msg.MessageFlags&lnwire.ChanUpdateOptionMaxHtlc != 0 {
if msg.MessageFlags.HasMaxHtlc() {
maxHtlc := msg.HtlcMaximumMsat
if maxHtlc == 0 || maxHtlc < msg.HtlcMinimumMsat {
return errors.Errorf("invalid max htlc for channel "+