lnwire: add *OpaqueAddrs case in WriteElements

And then expand the chanbackup unit tests to cover such a case.
This commit is contained in:
Elle Mouton committed 2025-05-23 16:14:47 +02:00
1 parent a15489159a
commit 412e05f85f
4 files changed
+20 -3

No files matched your search

+11 -2
View File
@@ -41,6 +41,11 @@ var (
OnionService: "3g2upl4pq6kufc4m.onion",
Port: 9735,
}
addr4 = &lnwire.OpaqueAddrs{
// The first byte must be an address type we are not yet aware
// of for it to be a valid OpaqueAddrs.
Payload: []byte{math.MaxUint8, 1, 2, 3, 4},
}
)
func assertSingleEqual(t *testing.T, a, b Single) {
@@ -314,7 +319,9 @@ func TestSinglePackUnpack(t *testing.T) {
channel, err := genRandomOpenChannelShell()
require.NoError(t, err, "unable to gen open channel")
singleChanBackup := NewSingle(channel, []net.Addr{addr1, addr2, addr3})
singleChanBackup := NewSingle(
channel, []net.Addr{addr1, addr2, addr3, addr4},
)
keyRing := &lnencrypt.MockKeyRing{}
@@ -639,7 +646,9 @@ func TestSingleUnconfirmedChannel(t *testing.T) {
channel.ShortChannelID.BlockHeight = 0
channel.FundingBroadcastHeight = fundingBroadcastHeight
singleChanBackup := NewSingle(channel, []net.Addr{addr1, addr2, addr3})
singleChanBackup := NewSingle(
channel, []net.Addr{addr1, addr2, addr3, addr4},
)
keyRing := &lnencrypt.MockKeyRing{}
// Pack it and then unpack it again to make sure everything is written