diff --git a/pywallet.py b/pywallet.py index 7cd6881..812acb3 100755 --- a/pywallet.py +++ b/pywallet.py @@ -571,7 +571,8 @@ def open_wallet(db_env, walletfile, writable=False): def inversetxid(txid): if len(txid) is not 64: print("Bad txid") - exit(0) + return "CORRUPTEDTXID:"+txid +# exit(0) new_txid = "" for i in range(32): new_txid += txid[62-2*i]; @@ -625,7 +626,9 @@ def parse_wallet(db, item_callback): for i in xrange(n_vout): d['txOut'].append(parse_TxOut(vds)) d['lockTime'] = vds.read_uint32() - d['tx'] = vds.input[start:vds.read_cursor] + d['tx'] = vds.input[start:vds.read_cursor].encode('hex_codec') + d['txv'] = value.encode('hex_codec') + d['txk'] = key.encode('hex_codec') elif type == "name": d['hash'] = kds.read_string() d['name'] = vds.read_string() @@ -729,8 +732,9 @@ def update_wallet(db, type, data): try: if type == "tx": - raise NotImplementedError("Writing items of type 'tx'") - kds.write(d['tx_id']) +# raise NotImplementedError("Writing items of type 'tx'") + kds.write(d['txi'][6:].decode('hex_codec')) + vds.write(d['txv'].decode('hex_codec')) elif type == "name": kds.write_string(d['hash']) vds.write_string(d['name']) @@ -815,7 +819,7 @@ def read_wallet(json_db, db_env, walletfile, print_wallet, print_wallet_transact def item_callback(type, d): if type == "tx": - json_db['tx'].append({"txid" : d['tx_id'], "txin" : d['txIn'], "txout" : d['txOut']}) + json_db['tx'].append({"tx_id" : d['tx_id'], "txin" : d['txIn'], "txout" : d['txOut'], "tx_v" : d['txv'], "tx_k" : d['txk']}) elif type == "name": json_db['names'][d['hash']] = d['name'] @@ -966,7 +970,7 @@ class WIRoot(resource.Resource):
\