connector

This commit is contained in:
4tochka 2019-05-17 16:32:32 +04:00
parent dca0bc2c59
commit d55db7af2b
2 changed files with 16 additions and 23 deletions

View File

@ -243,6 +243,15 @@ class Worker:
if y["result"] is not None:
block = decode_block_tx(y["result"])
for z in block["rawTx"]:
for i in block["rawTx"][z]["vOut"]:
o = b"".join((block["rawTx"][z]["txId"], int_to_bytes(i)))
pointer = (x << 42) + (z << 21) + i
try:
address = block["rawTx"][z]["vOut"][i]["scriptPubKey"]
except:
address = b"".join((bytes([block["rawTx"][z]["vOut"][i]["nType"]]),
block["rawTx"][z]["vOut"][i]["addressHash"]))
self.coins[o] = (pointer, block["rawTx"][z]["vOut"][i]["value"], address)
if not block["rawTx"][z]["coinbase"]:
for i in block["rawTx"][z]["vIn"]:
inp = block["rawTx"][z]["vIn"][i]
@ -254,15 +263,7 @@ class Worker:
self.destroyed_coins[r[0]] = True
except:
pass
for i in block["rawTx"][z]["vOut"]:
o = b"".join((block["rawTx"][z]["txId"], int_to_bytes(i)))
pointer = (x << 42) + (z << 21) + i
try:
address = block["rawTx"][z]["vOut"][i]["scriptPubKey"]
except:
address = b"".join((bytes([block["rawTx"][z]["vOut"][i]["nType"]]),
block["rawTx"][z]["vOut"][i]["addressHash"]))
self.coins[o] = (pointer, block["rawTx"][z]["vOut"][i]["value"], address)
blocks[x] = block
if blocks:
blocks[x]["checkpoint"] = x

View File

@ -621,22 +621,14 @@ class Connector:
tx["vIn"][i]["coin"] = inp["_c_"]
c += 1
self.yy += 1
self.utxo.deleted.add(outpoint)
except:
try:
tx["vIn"][i]["coin"] = inp["_c_"]
r = self.utxo.get(outpoint)
if r:
tx["vIn"][i]["coin"] = r
c += 1
self.aa += 1
try:
self.utxo.get(outpoint)
except:
self.utxo.deleted.add(outpoint)
except:
r = self.utxo.get(outpoint)
if r:
tx["vIn"][i]["coin"] = r
c += 1
else:
missed.add((outpoint, (block_height << 42) + (block_index << 21) + i, i))
else:
missed.add((outpoint, (block_height << 42) + (block_index << 21) + i, i))
if missed:
await self.utxo.load_utxo()