lnwallet: update dual funder verification code to use pkscript in GetUtxo

This commit is contained in:
Olaoluwa Osuntokun 2018-07-17 19:20:05 -07:00
parent 8c0a151cec
commit 21451bf251
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -8,20 +8,20 @@ import (
"sync"
"sync/atomic"
"github.com/btcsuite/btcd/blockchain"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcutil/hdkeychain"
"github.com/davecgh/go-spew/spew"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/btcsuite/btcd/blockchain"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcutil/hdkeychain"
"github.com/lightningnetwork/lnd/shachain"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcutil/txsort"
"github.com/lightningnetwork/lnd/shachain"
)
const (
@ -262,15 +262,15 @@ type LightningWallet struct {
// is removed from limbo. Each reservation is tracked by a unique
// monotonically integer. All requests concerning the channel MUST
// carry a valid, active funding ID.
fundingLimbo map[uint64]*ChannelReservation
limboMtx sync.RWMutex
fundingLimbo map[uint64]*ChannelReservation
limboMtx sync.RWMutex
// lockedOutPoints is a set of the currently locked outpoint. This
// information is kept in order to provide an easy way to unlock all
// the currently locked outpoints.
lockedOutPoints map[wire.OutPoint]struct{}
quit chan struct{}
quit chan struct{}
wg sync.WaitGroup
@ -971,8 +971,18 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs
// Fetch the alleged previous output along with the
// pkscript referenced by this input.
// TODO(roasbeef): when dual funder pass actual height-hint
output, err := l.Cfg.ChainIO.GetUtxo(&txin.PreviousOutPoint, 0)
//
// TODO(roasbeef): when dual funder pass actual
// height-hint
pkScript, err := WitnessScriptHash(
txin.Witness[len(txin.Witness)-1],
)
if err != nil {
}
output, err := l.Cfg.ChainIO.GetUtxo(
&txin.PreviousOutPoint,
pkScript, 0,
)
if output == nil {
msg.err <- fmt.Errorf("input to funding tx "+
"does not exist: %v", err)