func TestNewStream_Mixed(t *testing.T) {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()
	s1, overlay1 := newService(t, 1, libp2pServiceOpts{libp2pOpts: libp2p.Options{
		FullNode: true,
	}})
	s2, _ := newService(t, 1, libp2pServiceOpts{})
	if err := s1.AddProtocol(newTestProtocol(func(_ context.Context, p p2p.Peer, _ p2p.Stream) error {
		if p.FullNode {
			t.Error("expected light node")
		}
		return nil
	})); err != nil {
		t.Fatal(err)
	}
	addr := serviceUnderlayAddress(t, s1)
	if _, err := s2.Connect(ctx, addr); err != nil {
		t.Fatal(err)
	}
	stream, err := s2.NewStream(ctx, overlay1, nil, testProtocolName, testProtocolVersion, testStreamName)
	if err != nil {
		t.Fatal(err)
	}
	if err := stream.Close(); err != nil {
		t.Fatal(err)
	}
}
TestNewStream_Mixed tests that the handler gets the full
node information communicated correctly for light node
package libp2p_test
import (
	"context"
	"errors"
	"sync"
	"sync/atomic"
	"testing"
	"time"
	"github.com/ethsana/sana/pkg/p2p"
	"github.com/ethsana/sana/pkg/p2p/libp2p"
	"github.com/multiformats/go-multistream"
)
func TestNewStream(t *testing.T) {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()
	s1, overlay1 := newService(t, 1, libp2pServiceOpts{libp2pOpts: libp2p.Options{
		FullNode: true,
	}})
	s2, _ := newService(t, 1, libp2pServiceOpts{})
	if err := s1.AddProtocol(newTestProtocol(func(_ context.Context, p p2p.Peer, _ p2p.Stream) error {
		return nil
	})); err != nil {
		t.Fatal(err)
	}
	addr := serviceUnderlayAddress(t, s1)
	if _, err := s2.Connect(ctx, addr); err != nil {
		t.Fatal(err)
	}
	stream, err := s2.NewStream(ctx, overlay1, nil, testProtocolName, testProtocolVersion, testStreamName)
	if err != nil {
		t.Fatal(err)
	}
	if err := stream.Close(); err != nil {
		t.Fatal(err)
	}
}
func TestNewStream_OnlyFull(t *testing.T) {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()
	s1, overlay1 := newService(t, 1, libp2pServiceOpts{libp2pOpts: libp2p.Options{
		FullNode: true,
	}})
	s2, _ := newService(t, 1, libp2pServiceOpts{libp2pOpts: libp2p.Options{
		FullNode: true,
	}})
	if err := s1.AddProtocol(newTestProtocol(func(_ context.Context, p p2p.Peer, _ p2p.Stream) error {
		if !p.FullNode {
			t.Error("expected full node")
		}
		return nil
	})); err != nil {
		t.Fatal(err)
	}
	addr := serviceUnderlayAddress(t, s1)
	if _, err := s2.Connect(ctx, addr); err != nil {
		t.Fatal(err)
	}
	stream, err := s2.NewStream(ctx, overlay1, nil, testProtocolName, testProtocolVersion, testStreamName)
	if err != nil {
		t.Fatal(err)
	}
	if err := stream.Close(); err != nil {
		t.Fatal(err)
	}
}