routing/chainview: new neutrino API

This commit is contained in:
Johan T. Halseth 2018-09-10 12:47:05 +02:00
parent 6db0bc4b05
commit 29acb9f1f8
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -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