lnwallet: return ErrNoOutputs in case no outputs are sent to
This commit is contained in:
parent
a5becc2063
commit
306c0c8aab
@ -299,6 +299,10 @@ func (b *BtcWallet) SendOutputs(outputs []*wire.TxOut,
|
||||
// SendOutputs.
|
||||
feeSatPerKB := btcutil.Amount(feeRate.FeePerKVByte())
|
||||
|
||||
// Sanity check outputs.
|
||||
if len(outputs) < 1 {
|
||||
return nil, lnwallet.ErrNoOutputs
|
||||
}
|
||||
return b.wallet.SendOutputs(outputs, defaultAccount, 1, feeSatPerKB)
|
||||
}
|
||||
|
||||
@ -321,6 +325,9 @@ func (b *BtcWallet) CreateSimpleTx(outputs []*wire.TxOut,
|
||||
feeSatPerKB := btcutil.Amount(feeRate.FeePerKVByte())
|
||||
|
||||
// Sanity check outputs.
|
||||
if len(outputs) < 1 {
|
||||
return nil, lnwallet.ErrNoOutputs
|
||||
}
|
||||
for _, output := range outputs {
|
||||
err := txrules.CheckOutput(output, feeSatPerKB)
|
||||
if err != nil {
|
||||
|
@ -49,6 +49,10 @@ var (
|
||||
ErrNotMine = errors.New("the passed output doesn't belong to the wallet")
|
||||
)
|
||||
|
||||
// ErrNoOutputs is returned if we try to create a transaction with no outputs
|
||||
// or send coins to a set of outputs that is empty.
|
||||
var ErrNoOutputs = errors.New("no outputs")
|
||||
|
||||
// Utxo is an unspent output denoted by its outpoint, and output value of the
|
||||
// original output.
|
||||
type Utxo struct {
|
||||
|
Loading…
Reference in New Issue
Block a user