lnwire: update ChannelUpdate to latest spec change, min HTLC is 8-bytes

This commit is contained in:
Olaoluwa Osuntokun 2017-06-16 22:46:31 +02:00
parent 2452f2ed82
commit 319afb14f1
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
2 changed files with 24 additions and 21 deletions

View File

@ -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

View File

@ -390,9 +390,9 @@ func TestLightningWireProtocol(t *testing.T) {
Timestamp: uint32(r.Int31()),
Flags: uint16(r.Int31()),
TimeLockDelta: uint16(r.Int31()),
HtlcMinimumMsat: uint32(r.Int31()),
FeeBaseMsat: uint32(r.Int31()),
FeeProportionalMillionths: uint32(r.Int31()),
HtlcMinimumMsat: uint64(r.Int63()),
BaseFee: uint32(r.Int31()),
FeeRate: uint32(r.Int31()),
}
v[0] = reflect.ValueOf(req)