github.com/aergoio/aergo@v1.3.1/p2p/p2pcommon/others.go (about)

     1  package p2pcommon
     2  
     3  import (
     4  	"github.com/aergoio/aergo/types"
     5  )
     6  
     7  // PeerAccessor is an interface for a another actor module to get info of peers
     8  type PeerAccessor interface {
     9  	// SelfMeta returns peerid, ipaddress and port of server itself
    10  	SelfMeta() PeerMeta
    11  
    12  	GetPeerBlockInfos() []types.PeerBlockInfo
    13  	GetPeer(ID types.PeerID) (RemotePeer, bool)
    14  
    15  }
    16  
    17  type SyncManager interface {
    18  	// handle notice from bp
    19  	HandleBlockProducedNotice(peer RemotePeer, block *types.Block)
    20  	// handle notice from other node
    21  	HandleNewBlockNotice(peer RemotePeer, data *types.NewBlockNotice)
    22  	HandleGetBlockResponse(peer RemotePeer, msg Message, resp *types.GetBlockResponse)
    23  	HandleNewTxNotice(peer RemotePeer, hashes []types.TxID, data *types.NewTransactionsNotice)
    24  }
    25