connector

This commit is contained in:
4tochka 2019-04-26 12:10:08 +04:00
parent 96048d9c63
commit 4df814e7cf
6 changed files with 30 additions and 21 deletions

View File

@ -108,7 +108,7 @@ class Connector:
self.log.warning("Blockchain is synchronized")
else:
d = self.node_last_block - self.last_block_height
self.log.warning("%s blocks before synchronization synchronized")
self.log.warning("%s blocks before synchronization synchronized" % d)
if d > self.deep_sync_limit:
self.log.warning("Deep synchronization mode")
self.deep_synchronization = True

View File

@ -1,13 +1,13 @@
from .hash_functions import *
from .integer import *
from .address_functions import *
from .script_functions import *
from .ecdsa import *
from .mnemonic import *
from .sighash import *
from .address_class import *
from .transaction_deserialize import *
from .transaction_constructor import *
# from .hash_functions import *
# from .integer import *
# from .address_functions import *
# from .script_functions import *
# from .ecdsa import *
# from .mnemonic import *
# from .sighash import *
# from .address_class import *
# from .transaction_deserialize import *
# from .transaction_constructor import *
from .block import *
# from .script_deserialize import *

View File

@ -600,19 +600,27 @@ class BlockDeserializeTests(unittest.TestCase):
f = open('./pybtc/test/raw_block.txt')
fc = f.readline()
qt = time.time()
bt = Block(fc[:-1], format="decoded")
bt = (
Block(fc[:-1], format="raw"),
)
print("decoded block", time.time() - qt )
import pickle
qt = time.time()
k = pickle.dumps(bt)
print("decoded block dump", time.time() - qt)
qt = time.time()
p = pickle.loads(k)
print("decoded block load", time.time() - qt)
import cProfile
cProfile.run("import pybtc;"
"f = open('./pybtc/test/raw_block.txt');"
"fc = f.readline();"
"pybtc.Block(fc[:-1], format='decoded')")
cProfile.run("import pybtc;"
"f = open('./pybtc/test/raw_block.txt');"
"fc = f.readline();"
"pybtc.Block(fc[:-1], format='raw')")
# cProfile.run("import pybtc;"
# "f = open('./pybtc/test/raw_block.txt');"
# "fc = f.readline();"
# "pybtc.Block(fc[:-1], format='decoded')")
# cProfile.run("import pybtc;"
# "f = open('./pybtc/test/raw_block.txt');"
# "fc = f.readline();"
# "pybtc.Block(fc[:-1], format='raw')")
# print(">>>",block.bits)
# print(">>>",block.hash)
# print(">>>",block.timestamp)

View File

@ -13,6 +13,7 @@ RUN pip3 install colorlog
RUN pip3 install aiohttp
RUN pip3 install pyzmq
RUN pip3 install uvloop
RUN pip3 install pybtc
COPY ./ /
WORKDIR /

0
pybtc/test/connector/build.sh Normal file → Executable file
View File

0
pybtc/test/connector/run.sh Normal file → Executable file
View File