connector

This commit is contained in:
4tochka 2019-05-16 17:52:50 +03:00
parent 8cc5b24ee9
commit ebb1e24e27
7 changed files with 457 additions and 448 deletions

View File

@ -7,8 +7,8 @@ from .block import *
from .address import *
from .wallet import *
from .crypto import *
# from cache_strategies import LRU
from _lru import LRU
from cache_strategies import LRU
from cache_strategies import MRU
from pybtc.connector import Connector

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ import traceback
from pybtc.connector.utils import decode_block_tx
import _pickle as pickle
from pybtc import LRU as MRU
from pybtc import MRU
class BlockLoader:
@ -241,18 +241,16 @@ class Worker:
if y["result"] is not None:
block = decode_block_tx(y["result"])
for z in block["rawTx"]:
if not block["rawTx"][z]["coinbase"]:
for i in block["rawTx"][z]["vIn"]:
inp = block["rawTx"][z]["vIn"][i]
outpoint = b"".join((inp["txId"], int_to_bytes(inp["vOut"])))
try:
r = self.coins.delete(outpoint)
self.log.critical(str(r))
block["rawTx"][z]["vIn"][i]["_c_"] = r
t += 1
self.destroyed_coins[r[0]] = True
except:
pass
for i in block["rawTx"][z]["vIn"]:
inp = block["rawTx"][z]["vIn"][i]
outpoint = b"".join((inp["txId"], int_to_bytes(inp["vOut"])))
try:
r = self.coins.delete(outpoint)
block["rawTx"][z]["vIn"][i]["_c_"] = r
t += 1
self.destroyed_coins[r[0]] = True
except:
pass
for i in block["rawTx"][z]["vOut"]:
o = b"".join((block["rawTx"][z]["txId"], int_to_bytes(i)))
pointer = (x << 42) + (z << 21) + i
@ -262,7 +260,6 @@ class Worker:
address = b"".join((bytes([block["rawTx"][z]["vOut"][i]["nType"]]),
block["rawTx"][z]["vOut"][i]["addressHash"]))
self.coins[o] = (pointer, block["rawTx"][z]["vOut"][i]["value"], address)
self.log.critical(str(o))
blocks[x] = block
if blocks:
blocks[x]["checkpoint"] = x
@ -272,7 +269,6 @@ class Worker:
try:
pointer = (x << 42) + (y << 21) + i
r = self.destroyed_coins.delete(pointer)
self.log.critical(str(r))
blocks[x]["rawTx"][y]["vOut"][i]["_s_"] = r
except: pass

View File

@ -1,7 +1,7 @@
from pybtc import int_to_c_int, c_int_to_int, c_int_len
import asyncio
from collections import OrderedDict
from pybtc import LRU as MRU
from pybtc import MRU
class UTXO():
def __init__(self, db_pool, loop, log, cache_size):

View File

@ -148,7 +148,7 @@ setup(name='pybtc',
'bdist_wheel': bdist_wheel
},
distclass=Distribution,
ext_modules=[Extension("_lru", ["pybtc/_lru/lru.c"]),
ext_modules=[Extension("cache_strategies", ["pybtc/cache_strategies/cache.c"]),
Extension("_secp256k1", ["pybtc/_secp256k1/module_secp256k1.c"],
include_dirs=["libsecp256k1/include/", "libsecp256k1/src/"]),
Extension("_crypto",