Issue a warning when filtering by height but also asking for mempool transactions, fix #37

This commit is contained in:
Michał Sałaban 2018-11-30 00:38:38 +00:00
parent e3dcc96a60
commit 000a1d5cff
4 changed files with 60 additions and 41 deletions

View file

@ -1,4 +1,5 @@
import sys
import warnings
from .address import address
from .numbers import PaymentID
@ -160,7 +161,12 @@ class PaymentFilter(object):
_payment_id = filterparams.pop('payment_id', None)
if len(filterparams) > 0:
raise ValueError("Excessive arguments for payment query: {}".format(filterparams))
if self.unconfirmed and (self.min_height is not None or self.max_height is not None):
warnings.warn("Height filtering (min_height/max_height) has been requested while "
"also asking for unconfirmed transactions. These are mutually exclusive. "
"As mempool transactions have no height at all, they will be excluded "
"from the result.",
RuntimeWarning)
if _local_address is None:
self.local_addresses = []
else: