routing: abandon ChainNotifier for FilteredChainView

This commit modifies the routing package to no longer use the
ChainNotifier for pruning the channel graph. Instead, we now use the
FilteredChainView interface to more (from the ChannelRouter’s PoV)
efficiently maintain the channel graph.

Rather than scanning the _entire_ block manually, we now rely on the
FilteredChainView to provide us with FilteredBlocks which include
_only_ the relevant transactions that we care about.
This commit is contained in:
Olaoluwa Osuntokun
2017-05-10 17:22:26 -07:00
parent 2ec0f5788e
commit 828d28581a
4 changed files with 150 additions and 113 deletions

View File

@@ -24,7 +24,7 @@ type testCtx struct {
chain *mockChain
notifier *mockNotifier
chainView *mockChainView
}
func createTestCtx(startingHeight uint32, testGraph ...string) (*testCtx, func(), error) {
@@ -74,11 +74,11 @@ func createTestCtx(startingHeight uint32, testGraph ...string) (*testCtx, func()
// any p2p functionality, the peer send and switch send messages won't
// be populated.
chain := newMockChain(startingHeight)
notifier := newMockNotifier()
chainView := newMockChainView()
router, err := New(Config{
Graph: graph,
Chain: chain,
Notifier: notifier,
Graph: graph,
Chain: chain,
ChainView: chainView,
SendToSwitch: func(_ *btcec.PublicKey,
_ *lnwire.UpdateAddHTLC) ([32]byte, error) {
return [32]byte{}, nil
@@ -97,11 +97,11 @@ func createTestCtx(startingHeight uint32, testGraph ...string) (*testCtx, func()
}
return &testCtx{
router: router,
graph: graph,
aliases: aliasMap,
chain: chain,
notifier: notifier,
router: router,
graph: graph,
aliases: aliasMap,
chain: chain,
chainView: chainView,
}, cleanUp, nil
}