break
tx_hash = self.hashout_hex(tx_hash)
txpoint = {
- "nTime": int(nTime),
+ "timestamp": int(nTime),
"height": int(height),
- "is_in": int(is_in),
- "blk_hash": self.hashout_hex(blk_hash),
+ "is_input": int(is_in),
+ "block_hash": self.hashout_hex(blk_hash),
"tx_hash": tx_hash,
"tx_id": int(tx_id),
- "pos": int(pos),
+ "index": int(pos),
"value": int(value),
}
# todo: sort them really...
- txpoints = sorted(txpoints, key=operator.itemgetter("nTime"))
+ txpoints = sorted(txpoints, key=operator.itemgetter("timestamp"))
# read memory pool
rows = []
#print "mempool", tx_hash
txpoint = {
- "nTime": 0,
+ "timestamp": 0,
"height": 0,
- "is_in": int(is_in),
- "blk_hash": 'mempool',
+ "is_input": int(is_in),
+ "block_hash": 'mempool',
"tx_hash": tx_hash,
"tx_id": int(tx_id),
- "pos": int(pos),
+ "index": int(pos),
"value": int(value),
}
txpoints.append(txpoint)
txpoint['outputs'] = txoutputs
# for all unspent inputs, I want their scriptpubkey. (actually I could deduce it from the address)
- if not txpoint['is_in']:
+ if not txpoint['is_input']:
# detect if already redeemed...
for row in outrows:
if row[6] == dbhash: break
# pos, script, value, o_hash, o_id, o_pos, binaddr = row
# if not redeemed, we add the script
if row:
- if not row[4]: txpoint['raw_scriptPubKey'] = row[1]
+ if not row[4]: txpoint['raw_output_script'] = row[1]
# cache result
if not address_has_mempool:
status = None
else:
lastpoint = tx_points[-1]
- status = lastpoint['blk_hash']
+ status = lastpoint['block_hash']
# this is a temporary hack; move it up once old clients have disappeared
if status == 'mempool': # and session['version'] != "old":
status = status + ':%d'% len(tx_points)
return time.strftime("[%d/%m/%Y-%H:%M:%S]")
+def new_to_old(s):
+ s = s.replace("'block_hash'", "'blk_hash'")
+ s = s.replace("'index'", "'pos'")
+ s = s.replace("'timestamp'", "'nTime'")
+ s = s.replace("'is_input'", "'is_in'")
+ s = s.replace("'raw_output_script'","'raw_scriptPubKey'")
+ return s
+
+
class NativeServer(threading.Thread):
def __init__(self, shared, abe, irc, banner, host, port):
elif cmd == 'h':
address = data
out = repr( self.store.get_history( address ) )
+ out = new_to_old(out)
elif cmd =='tx':
out = self.store.send_tx(data)