lnwire: swap order of MinAcceptDepth and HtlcMinimum

In this commit we reverse the ordering of the MinAcceptDepth and
HltcMinimum fields within the AcceptChannel message. Previously, the
order of these two fields were reversed, meaning the remote peer
would’ve attempted to parse the MinAcceptDepth (as we intended), as
part of the HtlcMinimum, leading to a garbage value.
This commit is contained in:
Olaoluwa Osuntokun 2017-09-14 13:12:47 +02:00
parent f01f83f938
commit a334025883
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

View File

@ -33,14 +33,14 @@ type AcceptChannel struct {
// channel's lifetime.
ChannelReserve btcutil.Amount
// MinAcceptDepth is the minimum depth that the initiator of the
// channel should wait before considering the channel open.
MinAcceptDepth uint32
// HtlcMinimum is the smallest HTLC that the sender of this message
// will accept.
HtlcMinimum MilliSatoshi
// MinAcceptDepth is the minimum depth that the initiator of the
// channel should wait before considering the channel open.
MinAcceptDepth uint32
// CsvDelay is the number of blocks to use for the relative time lock
// in the pay-to-self output of both commitment transactions.
CsvDelay uint16
@ -97,8 +97,8 @@ func (a *AcceptChannel) Encode(w io.Writer, pver uint32) error {
a.DustLimit,
a.MaxValueInFlight,
a.ChannelReserve,
a.MinAcceptDepth,
a.HtlcMinimum,
a.MinAcceptDepth,
a.CsvDelay,
a.MaxAcceptedHTLCs,
a.FundingKey,
@ -120,8 +120,8 @@ func (a *AcceptChannel) Decode(r io.Reader, pver uint32) error {
&a.DustLimit,
&a.MaxValueInFlight,
&a.ChannelReserve,
&a.MinAcceptDepth,
&a.HtlcMinimum,
&a.MinAcceptDepth,
&a.CsvDelay,
&a.MaxAcceptedHTLCs,
&a.FundingKey,