connector
This commit is contained in:
parent
29cf94ce1c
commit
e97e1d3e26
@ -15,6 +15,7 @@ import asyncio
|
|||||||
import time
|
import time
|
||||||
import io
|
import io
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
import pylru
|
||||||
|
|
||||||
class Connector:
|
class Connector:
|
||||||
def __init__(self, node_rpc_url, node_zerromq_url, logger,
|
def __init__(self, node_rpc_url, node_zerromq_url, logger,
|
||||||
@ -77,6 +78,7 @@ class Connector:
|
|||||||
self.non_cached_blocks = 0
|
self.non_cached_blocks = 0
|
||||||
self.total_received_tx_time = 0
|
self.total_received_tx_time = 0
|
||||||
self.start_time = time.time()
|
self.start_time = time.time()
|
||||||
|
self.tmp = pylru.lrucache(1000000)
|
||||||
|
|
||||||
# cache and system
|
# cache and system
|
||||||
self.block_preload_cache_limit = block_preload_cache_limit
|
self.block_preload_cache_limit = block_preload_cache_limit
|
||||||
@ -629,7 +631,8 @@ class Connector:
|
|||||||
else:
|
else:
|
||||||
address = b"".join((bytes([out["nType"]]), out["addressHash"]))
|
address = b"".join((bytes([out["nType"]]), out["addressHash"]))
|
||||||
outpoint = b"".join((tx["txId"], int_to_bytes(i)))
|
outpoint = b"".join((tx["txId"], int_to_bytes(i)))
|
||||||
self.utxo.set(outpoint, pointer, out["value"], address)
|
self.tmp[outpoint] = (pointer, out["value"], address)
|
||||||
|
# self.utxo.set(outpoint, pointer, out["value"], address)
|
||||||
|
|
||||||
async def get_stxo(self, tx, block_height, block_index):
|
async def get_stxo(self, tx, block_height, block_index):
|
||||||
stxo, missed = set(), set()
|
stxo, missed = set(), set()
|
||||||
|
|||||||
1
setup.py
1
setup.py
@ -140,6 +140,7 @@ setup(name='pybtc',
|
|||||||
package_data={
|
package_data={
|
||||||
'pybtc': ['bip39_word_list/*.txt', 'test/*.txt'],
|
'pybtc': ['bip39_word_list/*.txt', 'test/*.txt'],
|
||||||
},
|
},
|
||||||
|
install_requires=['pylru'],
|
||||||
cmdclass={
|
cmdclass={
|
||||||
'build_clib': build_clib,
|
'build_clib': build_clib,
|
||||||
'build_ext': build_ext,
|
'build_ext': build_ext,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user