routing/chainview: modify the UpdateFilter method to take a channeldb.EdgePoint

In this commit, we update the existing UpdateFilter method to take the
new channeldb.EdgePoint struct in place of the prior wire.OutPoint. We
must do this as the caller now typically has this type due to the
preparation to enable lnd to be able to be compatible with the new
neutrino protocol.
This commit is contained in:
Olaoluwa Osuntokun 2018-07-17 19:12:28 -07:00
parent d129e7c890
commit ec0fb9c537
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
2 changed files with 15 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package chainview
import (
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/channeldb"
)
// FilteredChainView represents a subscription to a certain subset of the
@ -42,7 +43,7 @@ type FilteredChainView interface {
// relevant notifications are dispatched, meaning blocks with a height
// lower than the best known height might be sent over the
// FilteredBlocks() channel.
UpdateFilter(ops []wire.OutPoint, updateHeight uint32) error
UpdateFilter(ops []channeldb.EdgePoint, updateHeight uint32) error
// FilterBlock takes a block hash, and returns a FilteredBlocks which
// is the result of applying the current registered UTXO sub-set on the

View File

@ -21,6 +21,7 @@ import (
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/lightninglabs/neutrino"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/ltcsuite/ltcd/btcjson"
"github.com/btcsuite/btcwallet/walletdb"
@ -238,8 +239,11 @@ func testFilterBlockNotifications(node *rpctest.Harness,
t.Fatalf("unable to get current height: %v", err)
}
// Now we'll add both output to the current filter.
filter := []wire.OutPoint{*outPoint1, *outPoint2}
// Now we'll add both outpoints to the current filter.
filter := []channeldb.EdgePoint{
{targetScript, *outPoint1},
{targetScript, *outPoint2},
}
err = chainView.UpdateFilter(filter, uint32(currentHeight))
if err != nil {
t.Fatalf("unable to update filter: %v", err)
@ -382,8 +386,9 @@ func testUpdateFilterBackTrack(node *rpctest.Harness,
// After the block has been mined+notified we'll update the filter with
// a _prior_ height so a "rewind" occurs.
filter := []wire.OutPoint{*outPoint}
filter := []channeldb.EdgePoint{
{testScript, *outPoint},
}
err = chainView.UpdateFilter(filter, uint32(currentHeight))
if err != nil {
t.Fatalf("unable to update filter: %v", err)
@ -496,7 +501,10 @@ func testFilterSingleBlock(node *rpctest.Harness, chainView FilteredChainView,
// Now we'll manually trigger filtering the block generated above.
// First, we'll add the two outpoints to our filter.
filter := []wire.OutPoint{*outPoint1, *outPoint2}
filter := []channeldb.EdgePoint{
{testScript, *outPoint1},
{testScript, *outPoint2},
}
err = chainView.UpdateFilter(filter, uint32(currentHeight))
if err != nil {
t.Fatalf("unable to update filter: %v", err)