lnwallet/btcwallet: update neutrino GetUtxo impl to use new API

This commit is contained in:
Olaoluwa Osuntokun 2018-07-17 19:21:09 -07:00
parent f9f9eefab4
commit 84c458cc9f
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -9,10 +9,10 @@ import (
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/lightninglabs/neutrino"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/btcsuite/btcwallet/chain"
"github.com/btcsuite/btcwallet/waddrmgr"
"github.com/lightninglabs/neutrino"
"github.com/lightningnetwork/lnd/lnwallet"
)
var (
@ -33,15 +33,21 @@ func (b *BtcWallet) GetBestBlock() (*chainhash.Hash, int32, error) {
return b.chain.GetBestBlock()
}
// GetUtxo returns the original output referenced by the passed outpoint.
// GetUtxo returns the original output referenced by the passed outpoint that
// creates the target pkScript.
//
// This method is a part of the lnwallet.BlockChainIO interface.
func (b *BtcWallet) GetUtxo(op *wire.OutPoint, heightHint uint32) (*wire.TxOut, error) {
func (b *BtcWallet) GetUtxo(op *wire.OutPoint, pkScript []byte,
heightHint uint32) (*wire.TxOut, error) {
switch backend := b.chain.(type) {
case *chain.NeutrinoClient:
spendReport, err := backend.CS.GetUtxo(
neutrino.WatchOutPoints(*op),
neutrino.WatchInputs(neutrino.InputWithScript{
OutPoint: *op,
PkScript: pkScript,
}),
neutrino.StartBlock(&waddrmgr.BlockStamp{
Height: int32(heightHint),
}),