lnwire: add CustomRecords to shutdown message

This commit is contained in:
Olaoluwa Osuntokun
2024-05-29 19:57:37 +02:00
committed by Oliver Gugger
parent 9a972e1b0c
commit 099f5566bc
3 changed files with 179 additions and 23 deletions

View File

@@ -435,7 +435,7 @@ func randCustomRecords(t *testing.T, r *rand.Rand) CustomRecords {
key := MinCustomRecordsTlvType + keyOffset
// Values are byte slices of any length.
value := make([]byte, r.Intn(100))
value := make([]byte, r.Intn(10))
_, err := r.Read(value)
require.NoError(t, err)
@@ -791,7 +791,6 @@ func TestLightningWireProtocol(t *testing.T) {
req := Shutdown{
ChannelID: ChannelID(c),
Address: shutdownAddr,
ExtraData: make([]byte, 0),
}
if r.Int31()%2 == 0 {
@@ -953,12 +952,14 @@ func TestLightningWireProtocol(t *testing.T) {
// Only create the slice if there will be any signatures
// in it to prevent false positive test failures due to
// an empty slice versus a nil slice.
numSigs := uint16(r.Int31n(1019))
numSigs := uint16(r.Int31n(500))
if numSigs > 0 {
req.HtlcSigs = make([]Sig, numSigs)
}
for i := 0; i < int(numSigs); i++ {
req.HtlcSigs[i], err = NewSigFromSignature(testSig)
req.HtlcSigs[i], err = NewSigFromSignature(
testSig,
)
if err != nil {
t.Fatalf("unable to parse sig: %v", err)
return