Merge pull request #1635 from halseth/funding-broadcast-fail

Move funding tx broadcasting to Fundingmanager
This commit is contained in:
Olaoluwa Osuntokun
2018-08-09 20:04:30 -07:00
committed by GitHub
6 changed files with 307 additions and 100 deletions

View File

@ -4,6 +4,7 @@ import (
"crypto/sha256"
"fmt"
"sync"
"sync/atomic"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
@ -191,6 +192,7 @@ type mockWalletController struct {
rootKey *btcec.PrivateKey
prevAddres btcutil.Address
publishedTransactions chan *wire.MsgTx
index uint32
}
// BackEnd returns "mock" to signify a mock wallet controller.
@ -231,16 +233,17 @@ func (*mockWalletController) SendOutputs(outputs []*wire.TxOut,
// ListUnspentWitness is called by the wallet when doing coin selection. We just
// need one unspent for the funding transaction.
func (*mockWalletController) ListUnspentWitness(confirms int32) ([]*lnwallet.Utxo, error) {
func (m *mockWalletController) ListUnspentWitness(confirms int32) ([]*lnwallet.Utxo, error) {
utxo := &lnwallet.Utxo{
AddressType: lnwallet.WitnessPubKey,
Value: btcutil.Amount(10 * btcutil.SatoshiPerBitcoin),
PkScript: make([]byte, 22),
OutPoint: wire.OutPoint{
Hash: chainhash.Hash{},
Index: 0,
Index: m.index,
},
}
atomic.AddUint32(&m.index, 1)
var ret []*lnwallet.Utxo
ret = append(ret, utxo)
return ret, nil