diff --git a/Makefile b/Makefile index c649f6f544b..573d88c6bb9 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ test-unit-race: @go test -race -count=1 `go list ./...` .PHONY: test-unit-race -### test-all: Run tests with and without data race +## test-all: Run tests with and without data race test-all: @$(MAKE) test-unit @$(MAKE) test-unit-race diff --git a/node/light.go b/node/light.go index 95fe1a6df0d..a05e9148aaa 100644 --- a/node/light.go +++ b/node/light.go @@ -94,7 +94,6 @@ func newLightNode( } node.P2P.SetTxValidator(node.falseValidator()) - node.P2P.SetHeaderValidator(node.falseValidator()) node.BaseService = *service.NewBaseService(logger, "LightNode", node) diff --git a/p2p/client.go b/p2p/client.go index 5a7b44c91ca..437322d2823 100644 --- a/p2p/client.go +++ b/p2p/client.go @@ -38,9 +38,6 @@ const ( // txTopicSuffix is added after namespace to create pubsub topic for TX gossiping. txTopicSuffix = "-tx" - - // headerTopicSuffix is added after namespace to create pubsub topic for block header gossiping. - headerTopicSuffix = "-header" ) // Client is a P2P client, implemented with libp2p. @@ -62,9 +59,6 @@ type Client struct { txGossiper *Gossiper txValidator GossipValidator - headerGossiper *Gossiper - headerValidator GossipValidator - // cancel is used to cancel context passed to libp2p functions // it's required because of discovery.Advertise call cancel context.CancelFunc @@ -156,7 +150,6 @@ func (c *Client) Close() error { return multierr.Combine( c.txGossiper.Close(), - c.headerGossiper.Close(), c.dht.Close(), c.host.Close(), ) @@ -173,17 +166,6 @@ func (c *Client) SetTxValidator(val GossipValidator) { c.txValidator = val } -// GossipSignedHeader sends the block header to the P2P network. -func (c *Client) GossipSignedHeader(ctx context.Context, headerBytes []byte) error { - c.logger.Debug("Gossiping block header", "len", len(headerBytes)) - return c.headerGossiper.Publish(ctx, headerBytes) -} - -// SetHeaderValidator sets the callback function, that will be invoked after block header is received from P2P network. -func (c *Client) SetHeaderValidator(validator GossipValidator) { - c.headerValidator = validator -} - // Addrs returns listen addresses of Client. func (c *Client) Addrs() []multiaddr.Multiaddr { return c.host.Addrs() @@ -372,12 +354,6 @@ func (c *Client) setupGossiping(ctx context.Context) error { } go c.txGossiper.ProcessMessages(ctx) - c.headerGossiper, err = NewGossiper(c.host, c.ps, c.getHeaderTopic(), c.logger, WithValidator(c.headerValidator)) - if err != nil { - return err - } - go c.headerGossiper.ProcessMessages(ctx) - return nil } @@ -415,7 +391,3 @@ func (c *Client) getNamespace() string { func (c *Client) getTxTopic() string { return c.getNamespace() + txTopicSuffix } - -func (c *Client) getHeaderTopic() string { - return c.getNamespace() + headerTopicSuffix -}