Add query test

This commit is contained in:
nolash
2021-07-09 14:56:41 +02:00
parent 31d700efe3
commit e166a6737f
5 changed files with 250 additions and 7 deletions

View File

@@ -15,6 +15,8 @@ from cic_cache.db.list import (
logg = logging.getLogger()
DEFAULT_FILTER_SIZE = 8192 * 8
class Cache:
def __init__(self, session):
@@ -25,7 +27,7 @@ class BloomCache(Cache):
@staticmethod
def __get_filter_size(n):
n = 8192 * 8
n = DEFAULT_FILTER_SIZE
logg.warning('filter size hardcoded to {}'.format(n))
return n

View File

@@ -11,9 +11,10 @@ from cic_cache.cache import (
)
logg = logging.getLogger(__name__)
#logg = logging.getLogger()
re_transactions_all_bloom = r'/tx/(\d+)?/?(\d+)/?'
re_transactions_account_bloom = r'/tx/user/((0x)?[a-fA-F0-9]+)/?(\d+)?/?(\d+)/?'
re_transactions_account_bloom = r'/tx/user/((0x)?[a-fA-F0-9]+)(/(\d+)(/(\d+))?)?/?'
re_transactions_all_data = r'/txa/(\d+)/(\d+)/?'
DEFAULT_LIMIT = 100
@@ -27,12 +28,13 @@ def process_transactions_account_bloom(session, env):
address = r[1]
if r[2] == None:
address = '0x' + address
offset = DEFAULT_LIMIT
if r.lastindex > 2:
offset = r[3]
limit = 0
offset = 0
if r.lastindex > 3:
limit = r[4]
offset = r[4]
limit = DEFAULT_LIMIT
if r.lastindex > 5:
limit = r[6]
raise ValueError('>>>>>>< offset {} limit {} path {}'.format(offset, limit, env.get('PATH_INFO')))
c = BloomCache(session)
(lowest_block, highest_block, bloom_filter_block, bloom_filter_tx) = c.load_transactions_account(address, offset, limit)