lnwire: update ChannelUpdate to latest spec change, min HTLC is 8-bytes
This commit is contained in:
parent
2452f2ed82
commit
319afb14f1
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user