@@ -114,6 +114,17 @@ func FuzzAnnounceSignatures(f *testing.F) {
114114 })
115115}
116116
117+ func FuzzAnnounceSignatures2 (f * testing.F ) {
118+ f .Fuzz (func (t * testing.T , data []byte ) {
119+ // Prefix with MsgAnnounceSignatures2.
120+ data = prefixWithMsgType (data , MsgAnnounceSignatures2 )
121+
122+ // Pass the message into our general fuzz harness for wire
123+ // messages!
124+ harness (t , data )
125+ })
126+ }
127+
117128func FuzzChannelAnnouncement (f * testing.F ) {
118129 f .Fuzz (func (t * testing.T , data []byte ) {
119130 // Prefix with MsgChannelAnnouncement.
@@ -125,6 +136,51 @@ func FuzzChannelAnnouncement(f *testing.F) {
125136 })
126137}
127138
139+ func FuzzChannelAnnouncement2 (f * testing.F ) {
140+ f .Fuzz (func (t * testing.T , data []byte ) {
141+ // Prefix with MsgChannelAnnouncement2.
142+ data = prefixWithMsgType (data , MsgChannelAnnouncement2 )
143+
144+ // Because require.Equal considers nil maps and empty maps
145+ // to be non-equal, we must manually compare Features field
146+ // rather than using the harness.
147+
148+ if len (data ) > MaxSliceLength {
149+ return
150+ }
151+
152+ r := bytes .NewReader (data )
153+ msg , err := ReadMessage (r , 0 )
154+ if err != nil {
155+ return
156+ }
157+
158+ // We will serialize the message into a new bytes buffer.
159+ var b bytes.Buffer
160+ _ , err = WriteMessage (& b , msg , 0 )
161+ require .NoError (t , err )
162+
163+ // Deserialize the message from the serialized bytes buffer, and
164+ // then assert that the original message is equal to the newly
165+ // deserialized message.
166+ newMsg , err := ReadMessage (& b , 0 )
167+ require .NoError (t , err )
168+
169+ require .IsType (t , & ChannelAnnouncement2 {}, msg )
170+ first , _ := msg .(* ChannelAnnouncement2 )
171+ require .IsType (t , & ChannelAnnouncement2 {}, newMsg )
172+ second , _ := newMsg .(* ChannelAnnouncement2 )
173+
174+ // We can't use require.Equal for Features, since we consider
175+ // the empty map and nil to be equivalent.
176+ require .True (t , first .Features .Val .Equals (& second .Features .Val ))
177+ first .Features .Val = * NewRawFeatureVector ()
178+ second .Features .Val = * NewRawFeatureVector ()
179+
180+ require .Equal (t , first , second )
181+ })
182+ }
183+
128184func FuzzChannelReestablish (f * testing.F ) {
129185 f .Fuzz (func (t * testing.T , data []byte ) {
130186 // Prefix with MsgChannelReestablish.
@@ -147,6 +203,17 @@ func FuzzChannelUpdate(f *testing.F) {
147203 })
148204}
149205
206+ func FuzzChannelUpdate2 (f * testing.F ) {
207+ f .Fuzz (func (t * testing.T , data []byte ) {
208+ // Prefix with MsgChannelUpdate2.
209+ data = prefixWithMsgType (data , MsgChannelUpdate2 )
210+
211+ // Pass the message into our general fuzz harness for wire
212+ // messages!
213+ harness (t , data )
214+ })
215+ }
216+
150217func FuzzClosingSigned (f * testing.F ) {
151218 f .Fuzz (func (t * testing.T , data []byte ) {
152219 // Prefix with MsgClosingSigned.
0 commit comments