diff --git a/lnwallet/btcwallet/blockchain.go b/lnwallet/btcwallet/blockchain.go index f506a551..051b8fe6 100644 --- a/lnwallet/btcwallet/blockchain.go +++ b/lnwallet/btcwallet/blockchain.go @@ -26,8 +26,8 @@ func (b *BtcWallet) GetBestBlock() (*chainhash.Hash, int32, error) { // GetUtxo returns the original output referenced by the passed outpoint. // // This method is a part of the lnwallet.BlockChainIO interface. -func (b *BtcWallet) GetUtxo(txid *chainhash.Hash, index uint32) (*wire.TxOut, error) { - txout, err := b.rpc.GetTxOut(txid, index, false) +func (b *BtcWallet) GetUtxo(op *wire.OutPoint, _ uint32) (*wire.TxOut, error) { + txout, err := b.rpc.GetTxOut(&op.Hash, op.Index, false) if err != nil { return nil, err } else if txout == nil { diff --git a/lnwallet/interface.go b/lnwallet/interface.go index 38abac62..3579cbad 100644 --- a/lnwallet/interface.go +++ b/lnwallet/interface.go @@ -209,9 +209,12 @@ type BlockChainIO interface { // most-work chain the implementation is aware of. GetBestBlock() (*chainhash.Hash, int32, error) - // GetTxOut returns the original output referenced by the passed - // outpoint. - GetUtxo(txid *chainhash.Hash, index uint32) (*wire.TxOut, error) + // GetUtxo attempts to return the passed outpoint if it's still a + // member of the utxo set. The passed height hint should be the "birth + // height" of the passed outpoint. In the case that the output is in + // the UTXO set, then the output corresponding to that output is + // returned. Otherwise, a non-nil error will be returned. + GetUtxo(op *wire.OutPoint, heightHint uint32) (*wire.TxOut, error) // GetTransaction returns the full transaction identified by the passed // transaction ID. diff --git a/lnwallet/wallet.go b/lnwallet/wallet.go index fab81cf9..603697c4 100644 --- a/lnwallet/wallet.go +++ b/lnwallet/wallet.go @@ -978,8 +978,8 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs // Fetch the alleged previous output along with the // pkscript referenced by this input. - prevOut := txin.PreviousOutPoint - output, err := l.ChainIO.GetUtxo(&prevOut.Hash, prevOut.Index) + // TODO(roasbeef): when dual funder pass actual height-hint + output, err := l.ChainIO.GetUtxo(&txin.PreviousOutPoint, 0) if output == nil { msg.err <- fmt.Errorf("input to funding tx "+ "does not exist: %v", err)