mock: make it possible to set list of returned utxos
This commit is contained in:
1 file changed
+8
@@ -231,6 +231,7 @@ type mockWalletController struct {
|
|||||||
prevAddres btcutil.Address
|
prevAddres btcutil.Address
|
||||||
publishedTransactions chan *wire.MsgTx
|
publishedTransactions chan *wire.MsgTx
|
||||||
index uint32
|
index uint32
|
||||||
|
utxos []*lnwallet.Utxo
|
||||||
}
|
}
|
||||||
|
|
||||||
// BackEnd returns "mock" to signify a mock wallet controller.
|
// BackEnd returns "mock" to signify a mock wallet controller.
|
||||||
@@ -284,6 +285,13 @@ func (*mockWalletController) CreateSimpleTx(outputs []*wire.TxOut,
|
|||||||
// need one unspent for the funding transaction.
|
// need one unspent for the funding transaction.
|
||||||
func (m *mockWalletController) ListUnspentWitness(minconfirms,
|
func (m *mockWalletController) ListUnspentWitness(minconfirms,
|
||||||
maxconfirms int32) ([]*lnwallet.Utxo, error) {
|
maxconfirms int32) ([]*lnwallet.Utxo, error) {
|
||||||
|
|
||||||
|
// If the mock already has a list of utxos, return it.
|
||||||
|
if m.utxos != nil {
|
||||||
|
return m.utxos, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise create one to return.
|
||||||
utxo := &lnwallet.Utxo{
|
utxo := &lnwallet.Utxo{
|
||||||
AddressType: lnwallet.WitnessPubKey,
|
AddressType: lnwallet.WitnessPubKey,
|
||||||
Value: btcutil.Amount(10 * btcutil.SatoshiPerBitcoin),
|
Value: btcutil.Amount(10 * btcutil.SatoshiPerBitcoin),
|
||||||
|
|||||||
Reference in new issue
Block a user