netann: update ChanAnn2 validation to work for P2WSH channels

This commit expands the ChannelAnnouncement2 validation for the case
where it is announcing a P2WSH channel.
This commit is contained in:
Elle Mouton committed 2025-09-01 12:10:31 +02:00
1 parent 06bf0c28b6
commit d68d1fb355
5 files changed
+308 -58

No files matched your search

+7 -2
View File
@@ -18,6 +18,7 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/davecgh/go-spew/spew"
@@ -620,6 +621,7 @@ func createUpdateAnnouncement(blockHeight uint32,
htlcMinMsat := lnwire.MilliSatoshi(100)
a := &lnwire.ChannelUpdate1{
ChainHash: *chaincfg.MainNetParams.GenesisHash,
ShortChannelID: lnwire.ShortChannelID{
BlockHeight: blockHeight,
},
@@ -772,6 +774,7 @@ func (ctx *testCtx) createAnnouncementWithoutProof(blockHeight uint32,
}
a := &lnwire.ChannelAnnouncement1{
ChainHash: *chaincfg.MainNetParams.GenesisHash,
ShortChannelID: lnwire.ShortChannelID{
BlockHeight: blockHeight,
TxIndex: 0,
@@ -938,8 +941,9 @@ func createTestCtx(t *testing.T, startHeight uint32, isChanPeer bool) (
}
gossiper := New(Config{
ChainIO: chain,
Notifier: notifier,
ChainIO: chain,
ChainParams: &chaincfg.MainNetParams,
Notifier: notifier,
Broadcast: func(senders map[route.Vertex]struct{},
msgs ...lnwire.Message) error {
@@ -1669,6 +1673,7 @@ func TestSignatureAnnouncementRetryAtStartup(t *testing.T) {
//nolint:ll
gossiper := New(Config{
ChainParams: &chaincfg.MainNetParams,
Notifier: tCtx.gossiper.cfg.Notifier,
Broadcast: tCtx.gossiper.cfg.Broadcast,
NotifyWhenOnline: tCtx.gossiper.reliableSender.cfg.NotifyWhenOnline,