connector

This commit is contained in:
4tochka 2019-05-09 00:08:02 +04:00
parent b1ef24f362
commit 07ad03bb6a

View File

@ -221,31 +221,31 @@ class Worker:
for x, y in zip(h, result): for x, y in zip(h, result):
if y["result"] is not None: if y["result"] is not None:
block = decode_block_tx(y["result"]) block = decode_block_tx(y["result"])
for z in block["tx"]: for z in block["rawTx"]:
for i in block["tx"][z]["vIn"]: for i in block["rawTx"][z]["vIn"]:
inp = block["tx"][z]["vIn"][i] inp = block["rawTx"][z]["vIn"][i]
outpoint = b"".join((inp["txId"], int_to_bytes(inp["vOut"]))) outpoint = b"".join((inp["txId"], int_to_bytes(inp["vOut"])))
try: try:
r = self.coins[outpoint] r = self.coins[outpoint]
block["tx"][z]["vIn"][i]["__coin__"] = (outpoint, r[0], r[1], r[2]) block["rawTx"][z]["vIn"][i]["__coin__"] = (outpoint, r[0], r[1], r[2])
self.destroyed_coins[r[0]] = True self.destroyed_coins[r[0]] = True
except: except:
pass pass
for i in block["tx"][z]["vOut"]: for i in block["rawTx"][z]["vOut"]:
o = b"".join((block["tx"][z]["txId"], int_to_bytes(i))) o = b"".join((block["rawTx"][z]["txId"], int_to_bytes(i)))
pointer = (x << 42) + (z << 21) + i pointer = (x << 42) + (z << 21) + i
try: try:
address = block["tx"][z]["vOut"][i]["scriptPubKey"] address = block["rawTx"][z]["vOut"][i]["scriptPubKey"]
except: except:
address = b"".join((bytes([block["tx"][z]["vOut"][i]["nType"]]), address = b"".join((bytes([block["rawTx"][z]["vOut"][i]["nType"]]),
block["tx"][z]["vOut"][i]["addressHash"])) block["rawTx"][z]["vOut"][i]["addressHash"]))
self.coins[o] = (pointer, block["tx"][z]["vOut"][i], address) self.coins[o] = (pointer, block["rawTx"][z]["vOut"][i], address)
for x in blocks: for x in blocks:
for y in blocks[x]["tx"]: for y in blocks[x]["rawTx"]:
for i in blocks[x]["tx"][y]["vOut"]: for i in blocks[x]["rawTx"][y]["vOut"]:
try: try:
pointer = (x << 42) + (y << 21) + i pointer = (x << 42) + (y << 21) + i
blocks[x]["tx"][y]["vOut"]["__spent__"] = self.destroyed_coins[pointer] blocks[x]["rawTx"][y]["vOut"]["__spent__"] = self.destroyed_coins[pointer]
except: pass except: pass
blocks[x] = pickle.dumps(blocks[x]) blocks[x] = pickle.dumps(blocks[x])