From 29acb9f1f88fb9f7ed19e84544a7d3d622c37af9 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Mon, 10 Sep 2018 12:47:05 +0200 Subject: [PATCH] routing/chainview: new neutrino API --- routing/chainview/neutrino.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/routing/chainview/neutrino.go b/routing/chainview/neutrino.go index 61d4601c..c681d0f8 100644 --- a/routing/chainview/neutrino.go +++ b/routing/chainview/neutrino.go @@ -10,7 +10,6 @@ import ( "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil/gcs/builder" - "github.com/btcsuite/btcwallet/waddrmgr" "github.com/lightninglabs/neutrino" "github.com/lightningnetwork/lnd/channeldb" ) @@ -84,14 +83,10 @@ func (c *CfFilteredChainView) Start() error { // start the auto-rescan from this point. Once a caller actually wishes // to register a chain view, the rescan state will be rewound // accordingly. - bestHeader, bestHeight, err := c.p2pNode.BlockHeaders.ChainTip() + startingPoint, err := c.p2pNode.BestBlock() if err != nil { return err } - startingPoint := &waddrmgr.BlockStamp{ - Height: int32(bestHeight), - Hash: bestHeader.BlockHash(), - } // Next, we'll create our set of rescan options. Currently it's // required that an user MUST set a addr/outpoint/txid when creating a @@ -215,14 +210,14 @@ func (c *CfFilteredChainView) chainFilterer() { func (c *CfFilteredChainView) FilterBlock(blockHash *chainhash.Hash) (*FilteredBlock, error) { // First, we'll fetch the block header itself so we can obtain the // height which is part of our return value. - _, blockHeight, err := c.p2pNode.BlockHeaders.FetchHeader(blockHash) + blockHeight, err := c.p2pNode.GetBlockHeight(blockHash) if err != nil { return nil, err } filteredBlock := &FilteredBlock{ Hash: *blockHash, - Height: blockHeight, + Height: uint32(blockHeight), } // If we don't have any items within our current chain filter, then we