diff --git a/pybtc/connector/block_loader.py b/pybtc/connector/block_loader.py index a5e1207..f109336 100644 --- a/pybtc/connector/block_loader.py +++ b/pybtc/connector/block_loader.py @@ -272,7 +272,7 @@ class Worker: 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 + pointer = (x << 39)+(z << 20)+(1 << 19) + i try: address = b"".join((bytes([block["rawTx"][z]["vOut"][i]["nType"]]), block["rawTx"][z]["vOut"][i]["addressHash"])) @@ -288,7 +288,7 @@ class Worker: outpoint = b"".join((inp["txId"], int_to_bytes(inp["vOut"]))) try: r = self.coins.delete(outpoint) - if r[0] >> 42 >= start_height and r[0] >> 42 < height: + if r[0] >> 39 >= start_height and r[0] >> 39 < height: block["rawTx"][z]["vIn"][i]["_a_"] = r else: block["rawTx"][z]["vIn"][i]["_c_"] = r @@ -304,7 +304,7 @@ class Worker: for y in blocks[x]["rawTx"]: for i in blocks[x]["rawTx"][y]["vOut"]: try: - pointer = (x << 42) + (y << 21) + i + pointer = (x << 39)+(y << 20)+(1 << 19) + i r = self.destroyed_coins.delete(pointer) self.a_coins[pointer]=True blocks[x]["rawTx"][y]["vOut"][i]["_s_"] = r diff --git a/pybtc/connector/connector.py b/pybtc/connector/connector.py index c13c7b1..81f9f6a 100644 --- a/pybtc/connector/connector.py +++ b/pybtc/connector/connector.py @@ -569,7 +569,7 @@ class Connector: self.op_return += 1 continue self.coins += 1 - pointer = (block["height"] << 42) + (q << 21) + i + pointer = (block["height"] << 39) + (q << 20) + (1 << 19) + i try: address = b"".join((bytes([out["nType"]]), out["addressHash"])) except: @@ -609,7 +609,7 @@ class Connector: tx["vIn"][i]["coin"] = r c += 1 else: - missed.add((outpoint, (block["height"] << 42) + (q << 21) + i, q, i)) + missed.add((outpoint, (block["height"] << 39) + (q << 20) + (1 << 19) + i, q, i)) if missed: await self.utxo.load_utxo() @@ -750,7 +750,7 @@ class Connector: tx["vIn"][i]["coin"] = r c += 1 else: - missed.add((outpoint, (block_height << 42) + (block_index << 21) + i, i)) + missed.add((outpoint,(block_height << 39)+(block_index << 20)+(1 << 19) + i)) if missed: await self.utxo.load_utxo() @@ -775,7 +775,7 @@ class Connector: out = tx["vOut"][i] if self.skip_opreturn and out["nType"] in (3, 8): continue - pointer = (block_height << 42) + (block_index << 21) + i + pointer = (block_height << 39)+(block_index << 20)+(1 << 19) + i try: address = b"".join((bytes([out["nType"]]), out["addressHash"])) @@ -814,7 +814,7 @@ class Connector: inp = tx["vIn"][i] outpoint = b"".join((inp["txId"], int_to_bytes(inp["vOut"]))) r = self.utxo.get(outpoint) - stxo.add(r) if r else missed.add((outpoint, (block_height << 42) + (block_index << 21) + i)) + stxo.add(r) if r else missed.add((outpoint, (block_height << 39)+(block_index << 20)+(1 << 19) + i)) if missed: await self.utxo.load_utxo() diff --git a/pybtc/connector/utxo.py b/pybtc/connector/utxo.py index d2b136a..0fcb30d 100644 --- a/pybtc/connector/utxo.py +++ b/pybtc/connector/utxo.py @@ -69,9 +69,9 @@ class UTXO(): while self.cached: i = self.cached.pop() - if lb != i[1][0] >> 42: + if lb != i[1][0] >> 39: block_changed = True - lb = i[1][0] >> 42 + lb = i[1][0] >> 39 if lb - 1 == checkpoint: if len(self.cached) > int(self.size_limit * 0.95): if self.checkpoints: