connector
This commit is contained in:
parent
6736fa0dfe
commit
a0e3b2f10e
@ -241,16 +241,17 @@ class Worker:
|
|||||||
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["rawTx"]:
|
for z in block["rawTx"]:
|
||||||
for i in block["rawTx"][z]["vIn"]:
|
if not block["rawTx"][z]["coinbase"]:
|
||||||
inp = block["rawTx"][z]["vIn"][i]
|
for i in block["rawTx"][z]["vIn"]:
|
||||||
outpoint = b"".join((inp["txId"], int_to_bytes(inp["vOut"])))
|
inp = block["rawTx"][z]["vIn"][i]
|
||||||
try:
|
outpoint = b"".join((inp["txId"], int_to_bytes(inp["vOut"])))
|
||||||
r = self.coins.delete(outpoint)
|
try:
|
||||||
block["rawTx"][z]["vIn"][i]["_c_"] = r
|
r = self.coins.delete(outpoint)
|
||||||
t += 1
|
block["rawTx"][z]["vIn"][i]["_c_"] = r
|
||||||
self.destroyed_coins[r[0]] = True
|
t += 1
|
||||||
except:
|
self.destroyed_coins[r[0]] = True
|
||||||
pass
|
except:
|
||||||
|
pass
|
||||||
for i in block["rawTx"][z]["vOut"]:
|
for i in block["rawTx"][z]["vOut"]:
|
||||||
o = b"".join((block["rawTx"][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
|
||||||
@ -273,7 +274,6 @@ class Worker:
|
|||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
blocks[x] = pickle.dumps(blocks[x])
|
blocks[x] = pickle.dumps(blocks[x])
|
||||||
self.log.critical("worker [%s]" % self.name)
|
|
||||||
self.pipe_sent_msg(b'result', pickle.dumps(blocks))
|
self.pipe_sent_msg(b'result', pickle.dumps(blocks))
|
||||||
except:
|
except:
|
||||||
self.pipe_sent_msg(b'result', pickle.dumps([]))
|
self.pipe_sent_msg(b'result', pickle.dumps([]))
|
||||||
|
|||||||
@ -342,14 +342,15 @@ class Connector:
|
|||||||
|
|
||||||
async def _new_block(self, block):
|
async def _new_block(self, block):
|
||||||
tq = time.time()
|
tq = time.time()
|
||||||
|
if not self.active or not self.active_block.done() or self.last_block_height >= block["height"]:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
if self.block_headers_cache.get(block["hash"]) is not None:
|
if self.block_headers_cache.get(block["hash"]) is not None:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.deep_synchronization:
|
if self.deep_synchronization:
|
||||||
block["height"] = self.last_block_height + 1
|
block["height"] = self.last_block_height + 1
|
||||||
if not self.active or not self.active_block.done() or self.last_block_height >= block["height"]:
|
|
||||||
return
|
|
||||||
self.active_block = asyncio.Future()
|
self.active_block = asyncio.Future()
|
||||||
|
|
||||||
self.log.debug("Block %s %s" % (block["height"], block["hash"]))
|
self.log.debug("Block %s %s" % (block["height"], block["hash"]))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user