lnwire: remove FundingKey from DynPropose and DynCommit

This commit is contained in:
Keagan McClelland
2024-10-15 19:55:11 -06:00
committed by yyforyongyu
parent cbca5b1152
commit f40530e4f4
3 changed files with 2 additions and 59 deletions

View File

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