multi: rebase to upstream, update API's

This commit is contained in:
Olaoluwa Osuntokun 2017-11-17 15:51:08 -08:00
parent 6f32a79fd6
commit 10432160d5
5 changed files with 15 additions and 15 deletions

View file

@ -299,6 +299,6 @@ func NewCfIndex(db database.DB, chainParams *chaincfg.Params) *CfIndex {
}
// DropCfIndex drops the CF index from the provided database if exists.
func DropCfIndex(db database.DB) error {
return dropIndex(db, cfIndexParentBucketKey, cfIndexName)
func DropCfIndex(db database.DB, interrupt <-chan struct{}) error {
return dropIndex(db, cfIndexParentBucketKey, cfIndexName, interrupt)
}

View file

@ -136,7 +136,7 @@ func btcdMain(serverChan chan<- *server) error {
return nil
}
if cfg.DropCfIndex {
if err := indexers.DropCfIndex(db); err != nil {
if err := indexers.DropCfIndex(db, interrupt); err != nil {
btcdLog.Errorf("%v", err)
return err
}

View file

@ -5,13 +5,13 @@
package netsync
import (
"github.com/btcsuite/btcd/blockchain"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/mempool"
"github.com/btcsuite/btcd/peer"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/roasbeef/btcd/blockchain"
"github.com/roasbeef/btcd/chaincfg"
"github.com/roasbeef/btcd/chaincfg/chainhash"
"github.com/roasbeef/btcd/mempool"
"github.com/roasbeef/btcd/peer"
"github.com/roasbeef/btcd/wire"
"github.com/roasbeef/btcutil"
)
// PeerNotifier exposes methods to notify peers of status changes to

View file

@ -7,10 +7,10 @@ package main
import (
"sync/atomic"
"github.com/Roasbeef/btcd/netsync"
"github.com/roasbeef/btcd/blockchain"
"github.com/roasbeef/btcd/chaincfg/chainhash"
"github.com/roasbeef/btcd/mempool"
"github.com/roasbeef/btcd/netsync"
"github.com/roasbeef/btcd/peer"
"github.com/roasbeef/btcd/wire"
"github.com/roasbeef/btcutil"

View file

@ -742,7 +742,7 @@ func (sp *serverPeer) OnGetHeaders(_ *peer.Peer, msg *wire.MsgGetHeaders) {
// OnGetCFilter is invoked when a peer receives a getcfilter bitcoin message.
func (sp *serverPeer) OnGetCFilter(_ *peer.Peer, msg *wire.MsgGetCFilter) {
// Ignore getcfilter requests if not in sync.
if !sp.server.blockManager.IsCurrent() {
if !sp.server.syncManager.IsCurrent() {
return
}
@ -764,12 +764,12 @@ func (sp *serverPeer) OnGetCFilter(_ *peer.Peer, msg *wire.MsgGetCFilter) {
// OnGetCFHeaders is invoked when a peer receives a getcfheader bitcoin message.
func (sp *serverPeer) OnGetCFHeaders(_ *peer.Peer, msg *wire.MsgGetCFHeaders) {
// Ignore getcfilterheader requests if not in sync.
if !sp.server.blockManager.IsCurrent() {
if !sp.server.syncManager.IsCurrent() {
return
}
// Attempt to look up the height of the provided stop hash.
chain := sp.server.blockManager.chain
chain := sp.server.chain
endIdx := int32(math.MaxInt32)
height, err := chain.BlockHeightByHash(&msg.HashStop)
if err == nil {
@ -877,7 +877,7 @@ func (sp *serverPeer) OnGetCFHeaders(_ *peer.Peer, msg *wire.MsgGetCFHeaders) {
func (sp *serverPeer) OnGetCFTypes(_ *peer.Peer, msg *wire.MsgGetCFTypes) {
// Ignore getcftypes requests if cfg.NoCFilters is set or we're not in
// sync.
if cfg.NoCFilters || !sp.server.blockManager.IsCurrent() {
if cfg.NoCFilters || !sp.server.syncManager.IsCurrent() {
return
}