rpcserver: disallow zero valued invoices

This commit is contained in:
Olaoluwa Osuntokun 2017-01-02 15:35:22 -08:00
parent fce366894d
commit 5d655ea332
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -945,6 +945,11 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
"(maxsize=%v)", len(invoice.Receipt), channeldb.MaxReceiptSize)
}
// Finally, the value of an invoice MUST NOT be zero.
if invoice.Value == 0 {
return nil, fmt.Errorf("zero value invoices are disallowed")
}
i := &channeldb.Invoice{
CreationDate: time.Now(),
Memo: []byte(invoice.Memo),