github.com/btcsuite/btcd@v0.24.0/netsync/interface.go (about)

     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  
     5  package netsync
     6  
     7  import (
     8  	"github.com/btcsuite/btcd/blockchain"
     9  	"github.com/btcsuite/btcd/btcutil"
    10  	"github.com/btcsuite/btcd/chaincfg"
    11  	"github.com/btcsuite/btcd/chaincfg/chainhash"
    12  	"github.com/btcsuite/btcd/mempool"
    13  	"github.com/btcsuite/btcd/peer"
    14  	"github.com/btcsuite/btcd/wire"
    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.
    20  type 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.
    31  type 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  }