1// Copyright (c) 2017 The btcsuite developers 2// Use of this source code is governed by an ISC 3// license that can be found in the LICENSE file. 4 5package netsync 6 7import ( 8 "github.com/btcsuite/btcd/blockchain" 9 "github.com/btcsuite/btcd/chaincfg" 10 "github.com/btcsuite/btcd/chaincfg/chainhash" 11 "github.com/btcsuite/btcd/mempool" 12 "github.com/btcsuite/btcd/peer" 13 "github.com/btcsuite/btcd/wire" 14 "github.com/btcsuite/btcutil" 15) 16 17// PeerNotifier exposes methods to notify peers of status changes to 18// transactions, blocks, etc. Currently server (in the main package) implements 19// this interface. 20type PeerNotifier interface { 21 AnnounceNewTransactions(newTxs []*mempool.TxDesc) 22 23 UpdatePeerHeights(latestBlkHash *chainhash.Hash, latestHeight int32, updateSource *peer.Peer) 24 25 RelayInventory(invVect *wire.InvVect, data interface{}) 26 27 TransactionConfirmed(tx *btcutil.Tx) 28} 29 30// Config is a configuration struct used to initialize a new SyncManager. 31type Config struct { 32 PeerNotifier PeerNotifier 33 Chain *blockchain.BlockChain 34 TxMemPool *mempool.TxPool 35 ChainParams *chaincfg.Params 36 37 DisableCheckpoints bool 38 MaxPeers int 39 40 FeeEstimator *mempool.FeeEstimator 41} 42