diff --git a/lnwire/accept_channel.go b/lnwire/accept_channel.go index f738e3c0..7248494c 100644 --- a/lnwire/accept_channel.go +++ b/lnwire/accept_channel.go @@ -75,6 +75,12 @@ type AcceptChannel struct { // where they claim funds. DelayedPaymentPoint *btcec.PublicKey + // HtlcPoint is the base point used to derive the set of keys for this + // party that will be used within the HTLC public key scripts. This + // value is combined with the receiver's revocation base point in order + // to derive the keys that are used within HTLC scripts. + HtlcPoint *btcec.PublicKey + // FirstCommitmentPoint is the first commitment point for the sending // party. This value should be combined with the receiver's revocation // base point in order to derive the revocation keys that are placed @@ -105,6 +111,7 @@ func (a *AcceptChannel) Encode(w io.Writer, pver uint32) error { a.RevocationPoint, a.PaymentPoint, a.DelayedPaymentPoint, + a.HtlcPoint, a.FirstCommitmentPoint, ) } @@ -128,6 +135,7 @@ func (a *AcceptChannel) Decode(r io.Reader, pver uint32) error { &a.RevocationPoint, &a.PaymentPoint, &a.DelayedPaymentPoint, + &a.HtlcPoint, &a.FirstCommitmentPoint, ) } @@ -145,6 +153,6 @@ func (a *AcceptChannel) MsgType() MessageType { // // This is part of the lnwire.Message interface. func (a *AcceptChannel) MaxPayloadLength(uint32) uint32 { - // 32 + (8 * 4) + (4 * 1) + (2 * 2) + (33 * 5) - return 237 + // 32 + (8 * 4) + (4 * 1) + (2 * 2) + (33 * 6) + return 270 } diff --git a/lnwire/lnwire_test.go b/lnwire/lnwire_test.go index 191a6697..d6b7528a 100644 --- a/lnwire/lnwire_test.go +++ b/lnwire/lnwire_test.go @@ -188,6 +188,11 @@ func TestLightningWireProtocol(t *testing.T) { t.Fatalf("unable to generate key: %v", err) return } + req.HtlcPoint, err = randPubKey() + if err != nil { + t.Fatalf("unable to generate key: %v", err) + return + } req.FirstCommitmentPoint, err = randPubKey() if err != nil { t.Fatalf("unable to generate key: %v", err) @@ -233,6 +238,11 @@ func TestLightningWireProtocol(t *testing.T) { t.Fatalf("unable to generate key: %v", err) return } + req.HtlcPoint, err = randPubKey() + if err != nil { + t.Fatalf("unable to generate key: %v", err) + return + } req.FirstCommitmentPoint, err = randPubKey() if err != nil { t.Fatalf("unable to generate key: %v", err) diff --git a/lnwire/open_channel.go b/lnwire/open_channel.go index 9f7305e7..950752eb 100644 --- a/lnwire/open_channel.go +++ b/lnwire/open_channel.go @@ -102,6 +102,12 @@ type OpenChannel struct { // where they claim funds. DelayedPaymentPoint *btcec.PublicKey + // HtlcPoint is the base point used to derive the set of keys for this + // party that will be used within the HTLC public key scripts. This + // value is combined with the receiver's revocation base point in order + // to derive the keys that are used within HTLC scripts. + HtlcPoint *btcec.PublicKey + // FirstCommitmentPoint is the first commitment point for the sending // party. This value should be combined with the receiver's revocation // base point in order to derive the revocation keys that are placed @@ -141,6 +147,7 @@ func (o *OpenChannel) Encode(w io.Writer, pver uint32) error { o.RevocationPoint, o.PaymentPoint, o.DelayedPaymentPoint, + o.HtlcPoint, o.FirstCommitmentPoint, o.ChannelFlags, ) @@ -168,6 +175,7 @@ func (o *OpenChannel) Decode(r io.Reader, pver uint32) error { &o.RevocationPoint, &o.PaymentPoint, &o.DelayedPaymentPoint, + &o.HtlcPoint, &o.FirstCommitmentPoint, &o.ChannelFlags, ) @@ -186,6 +194,6 @@ func (o *OpenChannel) MsgType() MessageType { // // This is part of the lnwire.Message interface. func (o *OpenChannel) MaxPayloadLength(uint32) uint32 { - // (32 * 2) + (8 * 6) + (4 * 1) + (2 * 2) + (33 * 5) + 1 - return 286 + // (32 * 2) + (8 * 6) + (4 * 1) + (2 * 2) + (33 * 6) + 1 + return 319 }