public IPv4Node(NodeID nodeId, IPv4PeerContact contact) { ID = nodeId; Contact = contact; CompactNodeInfo = new byte[CompactInfoSize]; Array.Copy(ID.Bytes, 0, CompactNodeInfo, 0, NodeID.Size); Contact.Encode(((Span <byte>)CompactNodeInfo).Slice(NodeID.Size)); }
public static void Encode(Span <byte> bytes, NodeID nodeId, IPAddress ipAddress, int port) { nodeId.CopyTo(bytes); IPv4PeerContact.Encode(bytes.Slice(NodeID.Size), ipAddress, port); }