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 committed 2025-10-02 12:15:16 +02:00
1 parent e24dd2f9e0
commit b8ff9fbef3
6 files changed
+873

No files matched your search

+13
View File
@@ -152,6 +152,19 @@ func RandNodeAlias(t *rapid.T) NodeAlias {
return alias
}
// RandNodeAlias2 generates a random node alias that is compatible with
// NodeAlias2 validation (non-empty, max 32 bytes, valid UTF-8).
func RandNodeAlias2(t *rapid.T) NodeAlias2 {
// Ensure length is at least 1 to satisfy NodeAlias2 validation
aliasLength := rapid.IntRange(1, 32).Draw(t, "aliasLength")
aliasBytes := rapid.SliceOfN(
rapid.SampledFrom([]rune(charset)), aliasLength, aliasLength,
).Draw(t, "alias")
return []byte(string(aliasBytes))
}
// RandNetAddrs generates random network addresses.
func RandNetAddrs(t *rapid.T) []net.Addr {
numAddresses := rapid.IntRange(0, 5).Draw(t, "numAddresses")