interface.go raw

   1  package netsync
   2  
   3  import (
   4  	"github.com/p9c/p9/pkg/blockchain"
   5  	"github.com/p9c/p9/pkg/chaincfg"
   6  	"github.com/p9c/p9/pkg/chainhash"
   7  	"github.com/p9c/p9/pkg/mempool"
   8  	"github.com/p9c/p9/pkg/peer"
   9  	"github.com/p9c/p9/pkg/util"
  10  	"github.com/p9c/p9/pkg/wire"
  11  )
  12  
  13  // PeerNotifier exposes methods to notify peers of status changes to transactions, blocks, etc. Currently server (in the
  14  // main package) implements this interface.
  15  type PeerNotifier interface {
  16  	AnnounceNewTransactions(newTxs []*mempool.TxDesc)
  17  	UpdatePeerHeights(latestBlkHash *chainhash.Hash, latestHeight int32, updateSource *peer.Peer)
  18  	RelayInventory(invVect *wire.InvVect, data interface{})
  19  	TransactionConfirmed(tx *util.Tx)
  20  }
  21  
  22  // Config is a configuration struct used to initialize a new SyncManager.
  23  type Config struct {
  24  	PeerNotifier       PeerNotifier
  25  	Chain              *blockchain.BlockChain
  26  	TxMemPool          *mempool.TxPool
  27  	ChainParams        *chaincfg.Params
  28  	DisableCheckpoints bool
  29  	MaxPeers           int
  30  	FeeEstimator       *mempool.FeeEstimator
  31  }
  32