From f40530e4f4c3dd6aec5d483e0a95c43f9a1c6c5f Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Tue, 15 Oct 2024 19:55:11 -0600 Subject: [PATCH] lnwire: remove FundingKey from DynPropose and DynCommit --- lnwire/dyn_commit.go | 20 +------------------- lnwire/dyn_propose.go | 36 +----------------------------------- lnwire/test_message.go | 5 ----- 3 files changed, 2 insertions(+), 59 deletions(-) diff --git a/lnwire/dyn_commit.go b/lnwire/dyn_commit.go index 1b9038c5d..bc0eb2fee 100644 --- a/lnwire/dyn_commit.go +++ b/lnwire/dyn_commit.go @@ -4,7 +4,6 @@ import ( "bytes" "io" - "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/fn/v2" "github.com/lightningnetwork/lnd/tlv" @@ -83,14 +82,6 @@ func (dc *DynCommit) Encode(w *bytes.Buffer, _ uint32) error { ), ) }) - dc.FundingKey.WhenSome(func(key btcec.PublicKey) { - keyScratch := &key - tlvRecords = append( - tlvRecords, tlv.MakePrimitiveRecord( - DPFundingPubkey, &keyScratch, - ), - ) - }) dc.ChannelType.WhenSome(func(ty ChannelType) { tlvRecords = append( tlvRecords, tlv.MakeDynamicRecord( @@ -159,11 +150,6 @@ func (dc *DynCommit) Decode(r io.Reader, _ uint32) error { DPMaxAcceptedHtlcs, &maxHtlcsScratch, ) - var fundingKeyScratch *btcec.PublicKey - fundingKey := tlv.MakePrimitiveRecord( - DPFundingPubkey, &fundingKeyScratch, - ) - var chanTypeScratch ChannelType chanType := tlv.MakeDynamicRecord( DPChannelType, &chanTypeScratch, chanTypeScratch.featureBitLen, @@ -172,8 +158,7 @@ func (dc *DynCommit) Decode(r io.Reader, _ uint32) error { // Create set of Records to read TLV bytestream into. records := []tlv.Record{ - dustLimit, maxValue, reserve, csvDelay, maxHtlcs, fundingKey, - chanType, + dustLimit, maxValue, reserve, csvDelay, maxHtlcs, chanType, } tlv.SortRecords(records) @@ -205,9 +190,6 @@ func (dc *DynCommit) Decode(r io.Reader, _ uint32) error { if val, ok := typeMap[DPMaxAcceptedHtlcs]; ok && val == nil { dc.MaxAcceptedHTLCs = fn.Some(maxHtlcsScratch) } - if val, ok := typeMap[DPFundingPubkey]; ok && val == nil { - dc.FundingKey = fn.Some(*fundingKeyScratch) - } if val, ok := typeMap[DPChannelType]; ok && val == nil { dc.ChannelType = fn.Some(chanTypeScratch) } diff --git a/lnwire/dyn_propose.go b/lnwire/dyn_propose.go index a1f127318..5b200b492 100644 --- a/lnwire/dyn_propose.go +++ b/lnwire/dyn_propose.go @@ -4,7 +4,6 @@ import ( "bytes" "io" - "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcutil" "github.com/lightningnetwork/lnd/fn/v2" "github.com/lightningnetwork/lnd/tlv" @@ -31,10 +30,6 @@ const ( // for DynPropose.MaxAcceptedHTLCs. DPMaxAcceptedHtlcs tlv.Type = 4 - // DPFundingPubkey is the TLV type number that identifies the record for - // DynPropose.FundingKey. - DPFundingPubkey tlv.Type = 5 - // DPChannelType is the TLV type number that identifies the record for // DynPropose.ChannelType. DPChannelType tlv.Type = 6 @@ -67,10 +62,6 @@ type DynPropose struct { // max_accepted_htlcs limit of the sender. MaxAcceptedHTLCs fn.Option[uint16] - // FundingKey, if not nil, proposes a change to the funding_pubkey - // parameter of the sender. - FundingKey fn.Option[btcec.PublicKey] - // ChannelType, if not nil, proposes a change to the channel_type // parameter. ChannelType fn.Option[ChannelType] @@ -137,14 +128,6 @@ func (dp *DynPropose) Encode(w *bytes.Buffer, _ uint32) error { ), ) }) - dp.FundingKey.WhenSome(func(key btcec.PublicKey) { - keyScratch := &key - tlvRecords = append( - tlvRecords, tlv.MakePrimitiveRecord( - DPFundingPubkey, &keyScratch, - ), - ) - }) dp.ChannelType.WhenSome(func(ty ChannelType) { tlvRecords = append( tlvRecords, tlv.MakeDynamicRecord( @@ -215,11 +198,6 @@ func (dp *DynPropose) Decode(r io.Reader, _ uint32) error { DPMaxAcceptedHtlcs, &maxHtlcsScratch, ) - var fundingKeyScratch *btcec.PublicKey - fundingKey := tlv.MakePrimitiveRecord( - DPFundingPubkey, &fundingKeyScratch, - ) - var chanTypeScratch ChannelType chanType := tlv.MakeDynamicRecord( DPChannelType, &chanTypeScratch, chanTypeScratch.featureBitLen, @@ -228,8 +206,7 @@ func (dp *DynPropose) Decode(r io.Reader, _ uint32) error { // Create set of Records to read TLV bytestream into. records := []tlv.Record{ - dustLimit, maxValue, reserve, csvDelay, maxHtlcs, fundingKey, - chanType, + dustLimit, maxValue, reserve, csvDelay, maxHtlcs, chanType, } tlv.SortRecords(records) @@ -262,9 +239,6 @@ func (dp *DynPropose) Decode(r io.Reader, _ uint32) error { if val, ok := typeMap[DPMaxAcceptedHtlcs]; ok && val == nil { dp.MaxAcceptedHTLCs = fn.Some(maxHtlcsScratch) } - if val, ok := typeMap[DPFundingPubkey]; ok && val == nil { - dp.FundingKey = fn.Some(*fundingKeyScratch) - } if val, ok := typeMap[DPChannelType]; ok && val == nil { dp.ChannelType = fn.Some(chanTypeScratch) } @@ -334,14 +308,6 @@ func (dp *DynPropose) SerializeTlvData() ([]byte, error) { ), ) }) - dp.FundingKey.WhenSome(func(key btcec.PublicKey) { - keyScratch := &key - tlvRecords = append( - tlvRecords, tlv.MakePrimitiveRecord( - DPFundingPubkey, &keyScratch, - ), - ) - }) dp.ChannelType.WhenSome(func(ty ChannelType) { tlvRecords = append( tlvRecords, tlv.MakeDynamicRecord( diff --git a/lnwire/test_message.go b/lnwire/test_message.go index 3df32c295..4cf9bb0cd 100644 --- a/lnwire/test_message.go +++ b/lnwire/test_message.go @@ -829,7 +829,6 @@ func (dp *DynPropose) RandTestMessage(t *rapid.T) Message { includeMaxAcceptedHTLCs := rapid.Bool().Draw( t, "includeMaxAcceptedHTLCs", ) - includeFundingKey := rapid.Bool().Draw(t, "includeFundingKey") includeChannelType := rapid.Bool().Draw(t, "includeChannelType") // Generate random values for each included field @@ -858,10 +857,6 @@ func (dp *DynPropose) RandTestMessage(t *rapid.T) Message { msg.MaxAcceptedHTLCs = fn.Some(mah) } - if includeFundingKey { - msg.FundingKey = fn.Some(*RandPubKey(t)) - } - if includeChannelType { msg.ChannelType = fn.Some(*RandChannelType(t)) }