connector

This commit is contained in:
4tochka 2019-05-17 14:18:45 +04:00
parent e815ee10e1
commit e1be200cbd
2 changed files with 18 additions and 7 deletions

View File

@ -218,6 +218,7 @@ class Worker:
async def load_blocks(self, height):
try:
t = 0
start_height = height
batch = list()
h_list = list()
while True:
@ -247,7 +248,11 @@ class Worker:
outpoint = b"".join((inp["txId"], int_to_bytes(inp["vOut"])))
try:
r = self.coins.delete(outpoint)
block["rawTx"][z]["vIn"][i]["_c_"] = r
h = r[0] >> 42
if h >= start_height and h < height:
block["rawTx"][z]["vIn"][i]["_a_"] = r
else:
block["rawTx"][z]["vIn"][i]["_c_"] = r
t += 1
self.destroyed_coins[r[0]] = True
except:

View File

@ -614,18 +614,24 @@ class Connector:
self.destroyed_coins += 1
inp = tx["vIn"][i]
outpoint = b"".join((inp["txId"], int_to_bytes(inp["vOut"])))
tx["vIn"][i]["outpoint"] = outpoint
try:
tx["vIn"][i]["outpoint"] = outpoint
tx["vIn"][i]["coin"] = inp["_c_"]
c += 1
self.yy += 1
except:
r = self.utxo.get(outpoint)
if r:
tx["vIn"][i]["coin"] = r
try:
tx["vIn"][i]["coin"] = inp["_c_"]
c += 1
else:
missed.add((outpoint, (block_height << 42) + (block_index << 21) + i, i))
self.yy += 1
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))
if missed:
await self.utxo.load_utxo()