From 84c458cc9ff107e9483972a18591018d01ad56a6 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 17 Jul 2018 19:21:09 -0700 Subject: [PATCH] lnwallet/btcwallet: update neutrino GetUtxo impl to use new API --- lnwallet/btcwallet/blockchain.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lnwallet/btcwallet/blockchain.go b/lnwallet/btcwallet/blockchain.go index 22dee5dd1..62a726505 100644 --- a/lnwallet/btcwallet/blockchain.go +++ b/lnwallet/btcwallet/blockchain.go @@ -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), }),