Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions routing/chainview/btcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,12 @@ func (b *BtcdFilteredChainView) chainFilterer() {
continue
}

// If no block was returned from the rescan,
// it means no maching transactions were found.
// If no block was returned from the rescan, it
// means no matching transactions were found.
if len(rescanned) != 1 {
log.Debugf("no matching block found "+
"for rescan of hash %v",
blockHash)
log.Tracef("rescan of block %v at "+
"height=%d yielded no "+
"transactions", blockHash, i)
continue
}
decoded, err := decodeJSONBlock(
Expand Down
16 changes: 15 additions & 1 deletion routing/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,18 @@ func (r *ChannelRouter) Start() error {
r.newBlocks = r.cfg.ChainView.FilteredBlocks()
r.staleBlocks = r.cfg.ChainView.DisconnectedBlocks()

_, pruneHeight, err := r.cfg.Graph.PruneTip()
if err != nil {
switch {
// If the graph has never been pruned, or hasn't fully been
// created yet, then we don't treat this as an explicit error.
case err == channeldb.ErrGraphNeverPruned:
case err == channeldb.ErrGraphNotFound:
default:
return err
}
}

// Before we perform our manual block pruning, we'll construct and
// apply a fresh chain filter to the active FilteredChainView instance.
// We do this before, as otherwise we may miss on-chain events as the
Expand All @@ -281,8 +293,9 @@ func (r *ChannelRouter) Start() error {
if err != nil && err != channeldb.ErrGraphNoEdgesFound {
return err
}

log.Infof("Filtering chain using %v channels active", len(channelView))
err = r.cfg.ChainView.UpdateFilter(channelView, r.bestHeight)
err = r.cfg.ChainView.UpdateFilter(channelView, pruneHeight)
if err != nil {
return err
}
Expand Down Expand Up @@ -331,6 +344,7 @@ func (r *ChannelRouter) syncGraphWithChain() error {
return err
}
r.bestHeight = uint32(bestHeight)

pruneHash, pruneHeight, err := r.cfg.Graph.PruneTip()
if err != nil {
switch {
Expand Down