diff --git a/lnwire/channel_update.go b/lnwire/channel_update.go index 18605235..e62339d9 100644 --- a/lnwire/channel_update.go +++ b/lnwire/channel_update.go @@ -37,13 +37,16 @@ type ChannelUpdate struct { TimeLockDelta uint16 // HtlcMinimumMsat is the minimum HTLC value which will be accepted. - HtlcMinimumMsat uint32 + HtlcMinimumMsat uint64 - // FeeBaseMstat... - FeeBaseMsat uint32 + // BaseFee is the base fee that must be used for incoming HTLC's to + // this particular channel. This value will be tacked onto the required + // for a payment independent of the size of the payment. + BaseFee uint32 - // FeeProportionalMillionths... - FeeProportionalMillionths uint32 + // FeeRate is the fee rate that will be charged per millionth of a + // satoshi. + FeeRate uint32 } // A compile time check to ensure ChannelUpdate implements the lnwire.Message @@ -62,8 +65,8 @@ func (a *ChannelUpdate) Decode(r io.Reader, pver uint32) error { &a.Flags, &a.TimeLockDelta, &a.HtlcMinimumMsat, - &a.FeeBaseMsat, - &a.FeeProportionalMillionths, + &a.BaseFee, + &a.FeeRate, ) } @@ -79,8 +82,8 @@ func (a *ChannelUpdate) Encode(w io.Writer, pver uint32) error { a.Flags, a.TimeLockDelta, a.HtlcMinimumMsat, - a.FeeBaseMsat, - a.FeeProportionalMillionths, + a.BaseFee, + a.FeeRate, ) } @@ -114,8 +117,8 @@ func (a *ChannelUpdate) MaxPayloadLength(pver uint32) uint32 { // Expiry - 2 bytes length += 2 - // HtlcMinimumMstat - 4 bytes - length += 4 + // HtlcMinimumMstat - 8 bytes + length += 8 // FeeBaseMstat - 4 bytes length += 4 @@ -138,8 +141,8 @@ func (a *ChannelUpdate) DataToSign() ([]byte, error) { a.Flags, a.TimeLockDelta, a.HtlcMinimumMsat, - a.FeeBaseMsat, - a.FeeProportionalMillionths, + a.BaseFee, + a.FeeRate, ) if err != nil { return nil, err diff --git a/lnwire/lnwire_test.go b/lnwire/lnwire_test.go index 5e958324..094db79e 100644 --- a/lnwire/lnwire_test.go +++ b/lnwire/lnwire_test.go @@ -385,14 +385,14 @@ func TestLightningWireProtocol(t *testing.T) { }, MsgChannelUpdate: func(v []reflect.Value, r *rand.Rand) { req := ChannelUpdate{ - Signature: testSig, - ShortChannelID: NewShortChanIDFromInt(uint64(r.Int63())), - Timestamp: uint32(r.Int31()), - Flags: uint16(r.Int31()), - TimeLockDelta: uint16(r.Int31()), - HtlcMinimumMsat: uint32(r.Int31()), - FeeBaseMsat: uint32(r.Int31()), - FeeProportionalMillionths: uint32(r.Int31()), + Signature: testSig, + ShortChannelID: NewShortChanIDFromInt(uint64(r.Int63())), + Timestamp: uint32(r.Int31()), + Flags: uint16(r.Int31()), + TimeLockDelta: uint16(r.Int31()), + HtlcMinimumMsat: uint64(r.Int63()), + BaseFee: uint32(r.Int31()), + FeeRate: uint32(r.Int31()), } v[0] = reflect.ValueOf(req)