Prevent null invoice to be added to InvoiceWatcher

This commit is contained in:
nicolas.dorier 2017-10-13 14:53:42 +09:00
parent 9806cab090
commit 62e3f2d8e1

View file

@ -46,6 +46,7 @@ namespace BTCPayServer.Servcices.Invoices
public async Task NotifyReceived(Script scriptPubKey)
{
var invoice = await _Wallet.GetInvoiceId(scriptPubKey);
if(invoice != null)
_WatchRequests.Add(invoice);
}
@ -240,6 +241,8 @@ namespace BTCPayServer.Servcices.Invoices
public async Task WatchAsync(string invoiceId, bool singleShot = false)
{
if(invoiceId == null)
throw new ArgumentNullException(nameof(invoiceId));
if(!singleShot)
await _InvoiceRepository.AddPendingInvoice(invoiceId).ConfigureAwait(false);
_WatchRequests.Add(invoiceId);