diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c4b71f --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.idea/ +build +*.egg +*.xml +.idea/workspace.xml diff --git a/configure b/configure index a439ae1..57d93e4 100644 --- a/configure +++ b/configure @@ -93,16 +93,16 @@ fi chown $user $logfile -unetd_user=$(read_config "unetd_user") -if ! [ "$unetd_user" ]; then - read -p "rpcuser (from your unet.conf file): " -r - write_config "unetd_user" $REPLY +unetd_user=$(read_config "ulordd_user") +if ! [ "$ulordd_user" ]; then + read -p "rpcuser (from your ulord.conf file): " -r + write_config "ulordd_user" $REPLY fi -unetd_password=$(read_config "unetd_password") -if ! [ "$unetd_password" ]; then - read -p "rpcpassword (from your unet.conf file): " -r - write_config "unetd_password" $REPLY +unetd_password=$(read_config "ulordd_password") +if ! [ "$ulordd_password" ]; then + read -p "rpcpassword (from your ulord.conf file): " -r + write_config "ulordd_password" $REPLY fi @@ -110,5 +110,4 @@ fi echo "Configuration written to $uwallet_config." echo "Please edit this file to finish the configuration." echo "If you have not done so, please run 'python setup.py install'" ->>>>>>> 217104beed8b7501cc1455fe18da345c0f7b25a7 -echo "Then, run 'uwallet-server' to start the daemon" \ No newline at end of file +echo "Then, run 'uwallet-server' to start the daemon" diff --git a/setup.py b/setup.py index d40735f..e6641a1 100644 --- a/setup.py +++ b/setup.py @@ -5,14 +5,14 @@ import shutil import platform -current_place = get_python_lib() +#current_place = get_python_lib() -if platform.system().startswith('Win'): - shutil.copyfile(os.path.join('uwalletserver', 'cryptohello_hash.pyd'), - os.path.join(current_place, 'cryptohello_hash.pyd')) -else: - shutil.copyfile(os.path.join('uwalletserver', 'cryptohello_hash.so'), - os.path.join(current_place, 'cryptohello_hash.so')) +#if platform.system().startswith('Win'): +# shutil.copyfile(os.path.join('uwalletserver', 'cryptohello_hash.pyd'), +# os.path.join(current_place, 'cryptohello_hash.pyd')) +#else: +# shutil.copyfile(os.path.join('uwalletserver', 'cryptohello_hash.so'), +# os.path.join(current_place, 'cryptohello_hash.so')) requires = [ @@ -43,4 +43,4 @@ license="GNU Affero GPLv3", long_description="""Server for the Electrum Lightweight UC Wallet""" ) - \ No newline at end of file + diff --git a/tests/test_http.py b/tests/test_http.py index ccc4238..0e916a5 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -2,12 +2,6 @@ #-*- coding:utf-8 -*- from urllib.request import urlretrieve -def firstNonBlank(lines): - for eachLine in lines: - if not eachLine.strip(): - continue - else: - return eachLine def firstLast(webpage): f=open(webpage,encoding='utf-8') @@ -26,4 +20,4 @@ def download(url='http://www.baidu.com',process=firstLast): process(retval) if __name__=="__main__": - download() \ No newline at end of file + download() diff --git a/uwallet.conf.sample b/uwallet.conf.sample index 5dc8fe8..f3b60ae 100644 --- a/uwallet.conf.sample +++ b/uwallet.conf.sample @@ -29,9 +29,9 @@ pruning_limit = 100 #utxo_cache = 134217728 #addr_cache = 16777216 -[unetd] -unetd_host = localhost -unetd_port = 9457 -# user and password from unet.conf -unetd_user = lqp123456 -unetd_password = +[ulordd] +ulordd_host = localhost +ulordd_port = +# user and password from ulord.conf +ulordd_user = +ulordd_password = diff --git a/uwalletserver/__init__.pyc b/uwalletserver/__init__.pyc new file mode 100644 index 0000000..ed30c34 Binary files /dev/null and b/uwalletserver/__init__.pyc differ diff --git a/uwalletserver/blockchain_processor.py b/uwalletserver/blockchain_processor.py index 27530b3..a4425e8 100644 --- a/uwalletserver/blockchain_processor.py +++ b/uwalletserver/blockchain_processor.py @@ -20,7 +20,7 @@ from unetschema.error import URIParseError, DecodeError from unetschema.decode import smart_decode -HEADER_SIZE = 112 #1484 +HEADER_SIZE = 140 #1484 BLOCKS_PER_CHUNK = 96 #576 # This determines the max uris that can be requested @@ -40,7 +40,7 @@ def _wrapper(fn): return _wrapper -def unet_proof_has_winning_claim(proof): +def ulord_proof_has_winning_claim(proof): return 'txhash' in proof and 'nOut' in proof @@ -84,11 +84,11 @@ def __init__(self, config, shared): self.test_reorgs = False self.storage = ClaimsStorage(config, shared, self.test_reorgs) - self.unetd_url = 'http://%s:%s@%s:%s/' % ( - config.get('unetd', 'unetd_user'), - config.get('unetd', 'unetd_password'), - config.get('unetd', 'unetd_host'), - config.get('unetd', 'unetd_port')) + self.ulordd_url = 'http://%s:%s@%s:%s/' % ( + config.get('ulordd', 'ulordd_user'), + config.get('ulordd', 'ulordd_password'), + config.get('ulordd', 'ulordd_host'), + config.get('ulordd', 'ulordd_port')) self.sent_height = 0 self.sent_header = None @@ -105,7 +105,7 @@ def __init__(self, config, shared): self.blockchain_thread.start() def do_catch_up(self): - self.header = self.block2header(self.unetd('getblock', (self.storage.last_hash,))) + self.header = self.block2header(self.ulordd('getblock', (self.storage.last_hash,))) self.header['utxo_root'] = self.storage.get_root_hash().encode('hex') self.catch_up(sync=False) if not self.shared.stopped(): @@ -116,7 +116,7 @@ def do_catch_up(self): while not self.shared.stopped(): self.main_iteration() if self.shared.paused(): - print_log("unetd is responding") + print_log("ulordd is responding") self.shared.unpause() time.sleep(10) @@ -139,7 +139,7 @@ def print_time(self, num_tx): self.storage.height, num_tx, delta, self.storage.get_root_hash().encode('hex')) msg += " (%.2ftx/s, %.2fs/block)" % (tx_per_second, seconds_per_block) run_blocks = self.storage.height - self.start_catchup_height - remaining_blocks = self.unetd_height - self.storage.height + remaining_blocks = self.ulordd_height - self.storage.height if run_blocks > 0 and remaining_blocks > 0: remaining_minutes = remaining_blocks * seconds_per_block / 60 new_blocks = int(remaining_minutes / 10) # number of new blocks expected during catchup @@ -149,24 +149,24 @@ def print_time(self, num_tx): msg += " (eta %s, %d blocks)" % (rt, remaining_blocks) print_log(msg) - def wait_on_unetd(self): + def wait_on_ulordd(self): self.shared.pause() time.sleep(10) if self.shared.stopped(): # this will end the thread raise BaseException() - def unetd(self, method, args=()): + def ulordd(self, method, args=()): while True: try: - r = AuthServiceProxy(self.unetd_url, method).__call__(*args) + r = AuthServiceProxy(self.ulordd_url, method).__call__(*args) return r except JSONRPCException as j: r = "no response" print_log("Failed: %s%s" % (method, args)) if j.error['code'] == -28: - print_log("unetd still warming up...") - self.wait_on_unetd() + print_log("ulordd still warming up...") + self.wait_on_ulordd() continue elif j.error['code'] == -343: print_log("missing JSON-RPC result") @@ -199,9 +199,9 @@ def block2header(b): def get_header(self, height): #print 'heightttt',height - block_hash = self.unetd('getblockhash', (height,)) + block_hash = self.ulordd('getblockhash', (height,)) #print 'blockhashhhh',block_hash - b = self.unetd('getblock', (block_hash,)) + b = self.ulordd('getblock', (block_hash,)) #print 'getblockkk',b return self.block2header(b) @@ -227,6 +227,7 @@ def init_headers(self, db_height): while height < db_height: height += 1 header = self.get_header(height) # headleght 140 + print header if height > 1: if prev_hash != header.get('prev_block_hash'): # The prev_hash block is orphaned, go back @@ -310,7 +311,7 @@ def get_chunk(self, i): def get_mempool_transaction(self, txid): try: - raw_tx = self.unetd('getrawtransaction', (txid, 0)) + raw_tx = self.ulordd('getrawtransaction', (txid, 0)) except: print_log("Error looking up txid: %s" % txid) return None @@ -379,8 +380,8 @@ def get_merkle(self, tx_hash, height, cache_only): if cache_only: return -1 - block_hash = self.unetd('getblockhash', (height,)) - b = self.unetd('getblock', (block_hash,)) + block_hash = self.ulordd('getblockhash', (height,)) + b = self.ulordd('getblock', (block_hash,)) tx_list = b.get('tx') tx_pos = tx_list.index(tx_hash) @@ -526,36 +527,36 @@ def get_claim_info(self, claim_id): "txid": claim_txid, "nout": claim_nout, "amount":claim_amount, - "depth": self.unetd_height - claim_height, + "depth": self.ulordd_height - claim_height, "height": claim_height, "value": claim_value, "claim_sequence": claim_sequence, "address": claim_address } - unetd_results = self.unetd("getclaimsforname", (claim_name, )) - unetd_claim = None - if unetd_results: - for claim in unetd_results['claims']: + ulordd_results = self.ulordd("getclaimsforname", (claim_name, )) + ulordd_claim = None + if ulordd_results: + for claim in ulordd_results['claims']: if claim['claimId'] == claim_id and claim['txid'] == claim_txid and claim['n'] == claim_nout: - unetd_claim = claim + ulordd_claim = claim break - if unetd_claim: + if ulordd_claim: result['supports'] = [[support['txid'], support['n'], support['nAmount']] for - support in unetd_claim['supports']] - result['effective_amount'] = unetd_claim['nEffectiveAmount'] - result['valid_at_height'] = unetd_claim['nValidAtHeight'] + support in ulordd_claim['supports']] + result['effective_amount'] = ulordd_claim['nEffectiveAmount'] + result['valid_at_height'] = ulordd_claim['nValidAtHeight'] return result def get_block(self, block_hash): - block = self.unetd('getblock', (block_hash,)) + block = self.ulordd('getblock', (block_hash,)) while True: try: - response = [self.unetd("getrawtransaction", (txid,)) for txid in block['tx']] + response = [self.ulordd("getrawtransaction", (txid,)) for txid in block['tx']] except: - logger.error("unetd error (getfullblock)") - self.wait_on_unetd() + logger.error("ulordd error (getfullblock)") + self.wait_on_ulordd() continue block['tx'] = response @@ -568,12 +569,12 @@ def catch_up(self, sync=True): while not self.shared.stopped(): # are we done yet? - info = self.unetd('getinfo') + info = self.ulordd('getinfo') #print info self.relayfee = info.get('relayfee') - self.unetd_height = info.get('blocks') - unetd_block_hash = self.unetd('getblockhash', (self.unetd_height,)) - if self.storage.last_hash == unetd_block_hash: + self.ulordd_height = info.get('blocks') + ulordd_block_hash = self.ulordd('getblockhash', (self.ulordd_height,)) + if self.storage.last_hash == ulordd_block_hash: self.up_to_date = True break @@ -584,7 +585,7 @@ def catch_up(self, sync=True): # not done.. self.up_to_date = False try: - next_block_hash = self.unetd('getblockhash', (self.storage.height + 1,)) + next_block_hash = self.ulordd('getblockhash', (self.storage.height + 1,)) except BaseException, e: revert = True @@ -622,7 +623,7 @@ def catch_up(self, sync=True): # print time self.print_time(n) - self.header = self.block2header(self.unetd('getblock', (self.storage.last_hash,))) + self.header = self.block2header(self.ulordd('getblock', (self.storage.last_hash,))) self.header['utxo_root'] = self.storage.get_root_hash().encode('hex') if self.shared.stopped(): @@ -631,7 +632,7 @@ def catch_up(self, sync=True): def memorypool_update(self): t0 = time.time() - mempool_hashes = set(self.unetd('getrawmempool')) + mempool_hashes = set(self.ulordd('getrawmempool')) touched_addresses = set() # get new transactions @@ -917,7 +918,7 @@ def cmd_block_get_chunk(self, index, cache_only=False): def cmd_transaction_broadcast(self, raw_transaction): raw_transaction = str(raw_transaction) try: - txo = self.unetd('sendrawtransaction', (raw_transaction,)) + txo = self.ulordd('sendrawtransaction', (raw_transaction,)) print_log("sent tx:", txo) result = txo except BaseException, e: @@ -943,12 +944,12 @@ def cmd_transaction_get_merkle(self, tx_hash, height, cache_only=False): def cmd_transaction_get(self, tx_hash, height=None): # height argument does nothing here but is used in uwallet synchronizer tx_hash = str(tx_hash) - return self.unetd('getrawtransaction', (tx_hash, 0)) + return self.ulordd('getrawtransaction', (tx_hash, 0)) @command('blockchain.estimatefee') def cmd_estimate_fee(self, num): num = int(num) - return self.unetd('estimatefee', (num,)) + return self.ulordd('estimatefee', (num,)) @command('blockchain.relayfee') def cmd_relay_fee(self): @@ -958,21 +959,21 @@ def cmd_relay_fee(self): def cmd_claimtrie_getvalue(self, name, block_hash=None): name = str(name) if block_hash: - proof = self.unetd('getnameproof', (name, block_hash)) + proof = self.ulordd('getnameproof', (name, block_hash)) else: - proof = self.unetd('getnameproof', (name,)) + proof = self.ulordd('getnameproof', (name,)) result = {'proof': proof} - if unet_proof_has_winning_claim(proof): + if ulord_proof_has_winning_claim(proof): txid, nout = str(proof['txhash']), int(proof['nOut']) - transaction_info = self.unetd('getrawtransaction', (proof['txhash'], 1)) + transaction_info = self.ulordd('getrawtransaction', (proof['txhash'], 1)) transaction = transaction_info['hex'] - transaction_height = self.unetd_height - transaction_info['confirmations'] + transaction_height = self.ulordd_height - transaction_info['confirmations'] result['transaction'] = transaction claim_id = self.storage.get_claim_id_from_outpoint(txid, nout) result['height'] = transaction_height + 1 - claim_info = self.unetd('getclaimsforname', (name,)) + claim_info = self.ulordd('getclaimsforname', (name,)) supports = [] if len(claim_info['claims']) > 0: for claim in claim_info['claims']: @@ -990,7 +991,7 @@ def cmd_claimtrie_getvalue(self, name, block_hash=None): @command('blockchain.claimtrie.getclaimsintx') def cmd_claimtrie_getclaimsintx(self, txid): txid = str(txid) - result = self.unetd('getclaimsfortx', (txid,)) + result = self.ulordd('getclaimsfortx', (txid,)) if result: results_for_return = [] for claim in result: @@ -1002,7 +1003,7 @@ def cmd_claimtrie_getclaimsintx(self, txid): @command('blockchain.claimtrie.getclaimsforname') def cmd_claimtrie_getclaimsforname(self, name): name = str(name) - result = self.unetd('getclaimsforname', (name,)) + result = self.ulordd('getclaimsforname', (name,)) if result: claims = [] for claim in result['claims']: @@ -1020,11 +1021,11 @@ def cmd_claimtrie_getclaimsforname(self, name): @command('blockchain.block.get_block') def cmd_get_block(self, block_hash): block_hash = str(block_hash) - return self.unetd('getblock', (block_hash,)) + return self.ulordd('getblock', (block_hash,)) @command('blockchain.claimtrie.get') def cmd_claimtrie_get(self): - return self.unetd('getclaimtrie') + return self.ulordd('getclaimtrie') @command('blockchain.claimtrie.getclaimbyid') def cmd_claimtrie_getclaimbyid(self, claim_id): @@ -1052,7 +1053,7 @@ def cmd_claimtrie_getnthclaimforname(self, name, n): @command('blockchain.claimtrie.getclaimssignedby') def cmd_claimtrie_getclaimssignedby(self, name): name = str(name) - winning_claim = self.unetd('getvalueforname', (name,)) + winning_claim = self.ulordd('getvalueforname', (name,)) if winning_claim: certificate_id = str(winning_claim['claimId']) claims = self.storage.get_claims_signed_by(certificate_id) @@ -1147,7 +1148,7 @@ def cmd_claimtrie_get_value_for_uri(self, block_hash, uri): claim = {'resolution_type': WINNING, 'result': claim_info} if (claim and # is not an unclaimed winning name - (claim['resolution_type'] != WINNING or unet_proof_has_winning_claim(claim['result']['proof']))): + (claim['resolution_type'] != WINNING or ulord_proof_has_winning_claim(claim['result']['proof']))): try: claim_val = self.get_claim_info(claim['result']['claim_id']) decoded = smart_decode(claim_val['value']) diff --git a/uwalletserver/claims_storage.py b/uwalletserver/claims_storage.py index ad21f5b..fbcd036 100644 --- a/uwalletserver/claims_storage.py +++ b/uwalletserver/claims_storage.py @@ -103,7 +103,7 @@ def get_claim_name(self, claim_id): def get_undo_claim_info(self, height): s = self.db_undo_claim.get("undo_info_%d" % height) if s is None: - print_log('no undo info for {}'.format(height)) + print_log('claim no undo info for {}'.format(height)) return None return pickle.loads(s) @@ -381,12 +381,8 @@ def import_signed_claim_transaction(self, claim, claim_id, undo_info): try: #vlaim_value = base64.b64decode(claim.value) - #print vlaim_value - #logger.info('debug1:test where is error.') - decoded_claim = smart_decode(base64.b64decode(claim.value)) - #logger.info('debug1:test where is error.') + decoded_claim = smart_decode(claim.value) parsed_uri = parse_unet_uri(claim.name) - #logger.info('debug2:test where is error.') if decoded_claim.has_signature: cert_id = decoded_claim.certificate_id else: diff --git a/uwalletserver/cryptohello_hash.so b/uwalletserver/cryptohello_hash.so index 4f8c2c5..3445565 100644 Binary files a/uwalletserver/cryptohello_hash.so and b/uwalletserver/cryptohello_hash.so differ diff --git a/uwalletserver/main.py b/uwalletserver/main.py index d18198a..8301799 100644 --- a/uwalletserver/main.py +++ b/uwalletserver/main.py @@ -47,35 +47,35 @@ sys.exit() -def parse_unetd(conf_lines): +def parse_ulordd(conf_lines): for line in conf_lines: if line.startswith("rpcuser="): - yield "unetd_user", line[8:].rstrip('\n') + yield "ulordd_user", line[8:].rstrip('\n') elif line.startswith("rpcpassword="): - yield "unetd_password", line[12:].rstrip('\n') + yield "ulordd_password", line[12:].rstrip('\n') elif line.startswith("rpcport="): - yield "unetd_port", line[8:].rstrip('\n') + yield "ulordd_port", line[8:].rstrip('\n') -def load_unetd_connection_info(config, wallet_conf): +def load_ulordd_connection_info(config, wallet_conf): type = config.get('network', 'type') params = networks.params.get(type) settings = { - "unetd_user": "rpcuser", - "unetd_password": "rpcpassword", - "unetd_port": str(params.get('default_rpc_port')), - "unetd_host": "localhost" + "ulordd_user": "rpcuser", + "ulordd_password": "rpcpassword", + "ulordd_port": str(params.get('default_rpc_port')), + "ulordd_host": "localhost" } with open(wallet_conf, "r") as conf: conf_lines = conf.readlines() - unetd_settings = {} - for k, v in parse_unetd(conf_lines): - unetd_settings.update({k: v}) - settings.update(unetd_settings) - config.add_section('unetd') + ulordd_settings = {} + for k, v in parse_ulordd(conf_lines): + ulordd_settings.update({k: v}) + settings.update(ulordd_settings) + config.add_section('ulordd') for k, v in settings.iteritems(): - config.set('unetd', k, v) + config.set('ulordd', k, v) #bitcoin# def attempt_read_config(config, filename): @@ -94,7 +94,7 @@ def setup_network_settings(config): utils.PUBKEY_ADDRESS_PREFIX = int(params.get('pubkey_address_prefix')) utils.SCRIPT_ADDRESS_PREFIX = int(params.get('script_address_prefix')) storage.GENESIS_HASH = params.get('genesis_hash') - unetschema.BLOCKCHAIN_NAME = "unet_main" + unetschema.BLOCKCHAIN_NAME = "ulord_main" DEFAULT_DATA_DIR = os.path.join(os.path.expanduser("~/"), '.uwalletserver') @@ -142,22 +142,22 @@ def create_config(filename=None): # set network parameters config.add_section('network') - config.set('network', 'type', 'unet_main') + config.set('network', 'type', 'ulord_main') #darwin is if sys.platform == "darwin": - default_unetd_dir = os.path.join(os.path.expanduser("~/"), "Library", "Application Support", "unetcore") + default_ulordd_dir = os.path.join(os.path.expanduser("~/"), "Library", "Application Support", "ulordcore") else: - default_unetd_dir = os.path.join(os.path.expanduser("~/"), ".unetcore") + default_ulordd_dir = os.path.join(os.path.expanduser("~/"), ".ulordcore") - unetd_conf = os.path.join(default_unetd_dir, "unet.conf") - if os.path.isfile(unetd_conf): - print_log("loading unetd info") - load_unetd_connection_info(config, unetd_conf) - found_unetd = True + ulordd_conf = os.path.join(default_ulordd_dir, "ulord.conf") + if os.path.isfile(ulordd_conf): + print_log("loading ulordd info") + load_ulordd_connection_info(config, ulordd_conf) + found_ulordd = True else: - print_log("no config for unetd found (%s)" % unetd_conf) - found_unetd = False + print_log("no config for ulordd found (%s)" % ulordd_conf) + found_ulordd = False # try to find the config file in the default paths if not filename: @@ -171,8 +171,8 @@ def create_config(filename=None): if not os.path.isfile(filename): print 'could not find uwallet configuration file "%s"' % filename - if not found_unetd: - print "could not find unetd configutation file" + if not found_ulordd: + print "could not find ulordd configutation file" sys.exit(1) attempt_read_config(config, filename) diff --git a/uwalletserver/networks.py b/uwalletserver/networks.py index 3c0d126..13d41ed 100644 --- a/uwalletserver/networks.py +++ b/uwalletserver/networks.py @@ -5,15 +5,15 @@ #TODO: add regtest #NOTICE: This port may be 9456 params = { - 'unet_main': { + 'ulord_main': { 'pubkey_address': 0, 'script_address': 5, - 'pubkey_address_prefix': 130,#68 - 'script_address_prefix': 125, #204 - 'genesis_hash': '000009c278dda2285ff7d1595d919b2ae1f3728306409f50e374ea313391db8f', - 'default_rpc_port': 19889 #9998 + 'pubkey_address_prefix': 130,#68, + 'script_address_prefix': 125,#63, + 'genesis_hash': '000e0979b2a26db104fb4d8c2c8d572919a56662cecdcadc3d0583ac8d548e23', + 'default_rpc_port': 19889#9889 }, - 'unet_test': { + 'ulord_test': { 'pubkey_address': 0, 'script_address': 5, 'pubkey_address_prefix': 130, diff --git a/uwalletserver/storage.py b/uwalletserver/storage.py index af83c6a..1bde889 100644 --- a/uwalletserver/storage.py +++ b/uwalletserver/storage.py @@ -22,7 +22,7 @@ # increase this when database needs to be updated global GENESIS_HASH -GENESIS_HASH = '000009c278dda2285ff7d1595d919b2ae1f3728306409f50e374ea313391db8f' +GENESIS_HASH = '000e0979b2a26db104fb4d8c2c8d572919a56662cecdcadc3d0583ac8d548e23' DB_VERSION = 5 KEYLENGTH = 56 # 20 + 32 + 4 @@ -241,7 +241,7 @@ def __init__(self, config, shared, test_reorgs): print_log("UTXO tree root hash:", self.root_hash.encode('hex')) print_log("Coins in database:", coins) - # convert between unet addresses and 20 bytes keys used for storage. + # convert between ulord addresses and 20 bytes keys used for storage. @staticmethod def address_to_key(addr): return bc_address_to_hash_160(addr) @@ -281,7 +281,7 @@ def get_balance(self, addr): def listunspent(self, addr): key = self.address_to_key(addr) if key is None: - raise BaseException('Invalid unet address', addr) + raise BaseException('Invalid ulord address', addr) out = [] with self.db_utxo.lock: for k, v in self.db_utxo.db.iterator(start=key): @@ -328,7 +328,7 @@ def get_address(self, txi): def get_undo_info(self, height): s = self.db_undo.get("undo_info_%d" % height) if s is None: - print_log("no undo info for ", height) + print_log("storage no undo info for ", height) return None return pickle.loads(s) diff --git a/uwalletserver/utils.py b/uwalletserver/utils.py index 560f5de..ec0253e 100644 --- a/uwalletserver/utils.py +++ b/uwalletserver/utils.py @@ -60,6 +60,7 @@ def print_warning(message): SCRIPT_ADDRESS = 5 PUBKEY_ADDRESS_PREFIX = 130 #85 SCRIPT_ADDRESS_PREFIX = 125 #122 + HAS_AES_NI = cpu_has_aes_in_supported() @@ -127,7 +128,7 @@ def header_to_string(res): + rev_hex(res.get('claim_trie_root')) \ + int_to_hex(int(res.get('timestamp')), 4) \ + int_to_hex(int(res.get('bits')), 4) \ - + int_to_hex(int(res.get('nonce')), 4) #\ + + rev_hex(res.get('nonce')) #\ #+ rev_hex(res.get('solution')) #Fix block header loss validation issue -lqp @@ -142,7 +143,7 @@ def header_to_string_verify(res): + rev_hex(res.get('claim_trie_root')) \ + int_to_hex(int(res.get('timestamp')), 4) \ + int_to_hex(int(res.get('bits')), 4) \ - + int_to_hex(int(res.get('nonce')),4) + + rev_hex(res.get('nonce')) #sol_len = len(res.get('solution')) / 2 #str_len = '' #if sol_len < 253: @@ -170,7 +171,7 @@ def header_from_string(s): 'claim_trie_root': hash_encode(s[68:100]), 'timestamp': hex_to_int(s[100:104]), 'bits': hex_to_int(s[104:108]), - 'nonce': hex_to_int(s[108:112])#, + 'nonce': hash_encode(s[108:140])#, #'solution': hash_encode(s[140:1484]) #3 1487 } #'nonce': hex_to_int(s[108:140]),