diff --git a/pybtc/connector/block_loader.py b/pybtc/connector/block_loader.py index 4b30933..111bea0 100644 --- a/pybtc/connector/block_loader.py +++ b/pybtc/connector/block_loader.py @@ -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: diff --git a/pybtc/connector/connector.py b/pybtc/connector/connector.py index 91a5cfb..5516a99 100644 --- a/pybtc/connector/connector.py +++ b/pybtc/connector/connector.py @@ -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()