lnwire: define NodeAnnouncement2

In this commit, the lnwire.NodeAnnouncement2 type is defined. This will
be used to represent the `node_announcement_2` message used in the
Gossip 2 (1.75) protocol.
This commit is contained in:
Elle Mouton
2024-12-02 12:47:56 +02:00
parent e24dd2f9e0
commit b8ff9fbef3
6 changed files with 873 additions and 0 deletions

View File

@@ -244,6 +244,30 @@ func FuzzNodeAnnouncement(f *testing.F) {
})
}
func FuzzNodeAnnouncement2(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
// We can't use require.Equal for Features, since we consider
// the empty map and nil to be equivalent.
assertEq := func(t *testing.T, x, y any) {
require.IsType(t, &NodeAnnouncement2{}, x)
first, _ := x.(*NodeAnnouncement2)
require.IsType(t, &NodeAnnouncement2{}, y)
second, _ := y.(*NodeAnnouncement2)
require.True(
t,
first.Features.Val.Equals(&second.Features.Val),
)
first.Features.Val = *NewRawFeatureVector()
second.Features.Val = *NewRawFeatureVector()
require.Equal(t, first, second)
}
wireMsgHarnessCustom(t, data, MsgNodeAnnouncement2, assertEq)
})
}
func FuzzOpenChannel(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
// We can't use require.Equal for UpfrontShutdownScript, since