github.com/pure-x-eth/consensus_tm@v0.0.0-20230502163723-e3c2ff987250/p2p/mock/reactor.go (about)

     1  package mock
     2  
     3  import (
     4  	"github.com/pure-x-eth/consensus_tm/libs/log"
     5  	"github.com/pure-x-eth/consensus_tm/p2p"
     6  	"github.com/pure-x-eth/consensus_tm/p2p/conn"
     7  )
     8  
     9  type Reactor struct {
    10  	p2p.BaseReactor
    11  
    12  	Channels []*conn.ChannelDescriptor
    13  }
    14  
    15  func NewReactor() *Reactor {
    16  	r := &Reactor{}
    17  	r.BaseReactor = *p2p.NewBaseReactor("Mock-PEX", r)
    18  	r.SetLogger(log.TestingLogger())
    19  	return r
    20  }
    21  
    22  func (r *Reactor) GetChannels() []*conn.ChannelDescriptor            { return r.Channels }
    23  func (r *Reactor) AddPeer(peer p2p.Peer)                             {}
    24  func (r *Reactor) RemovePeer(peer p2p.Peer, reason interface{})      {}
    25  func (r *Reactor) ReceiveEnvelope(e p2p.Envelope)                    {}
    26  func (r *Reactor) Receive(chID byte, peer p2p.Peer, msgBytes []byte) {}