From a25b6d2eb028c7d04d72be190da7a4a181b3c104 Mon Sep 17 00:00:00 2001 From: 4tochka Date: Mon, 27 May 2019 01:21:12 +0400 Subject: [PATCH] connector --- pybtc/connector/block_loader.py | 5 +++-- pybtc/connector/connector.py | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pybtc/connector/block_loader.py b/pybtc/connector/block_loader.py index 4c6f94a..5bc3ed8 100644 --- a/pybtc/connector/block_loader.py +++ b/pybtc/connector/block_loader.py @@ -265,10 +265,11 @@ class Worker: 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"])) + except: + address = block["rawTx"][z]["vOut"][i]["scriptPubKey"] + self.coins[o] = (pointer, block["rawTx"][z]["vOut"][i]["value"], address) if not block["rawTx"][z]["coinbase"]: for i in block["rawTx"][z]["vIn"]: diff --git a/pybtc/connector/connector.py b/pybtc/connector/connector.py index fc7b5ff..3df866a 100644 --- a/pybtc/connector/connector.py +++ b/pybtc/connector/connector.py @@ -540,9 +540,9 @@ class Connector: continue pointer = (block["height"] << 42) + (q << 21) + i try: - address = b"".join((bytes([out["nType"]]), out["scriptPubKey"])) - except: address = b"".join((bytes([out["nType"]]), out["addressHash"])) + except: + address = b"".join((bytes([out["nType"]]), out["scriptPubKey"])) self.utxo.set(b"".join((tx["txId"], int_to_bytes(i))), pointer, out["value"], address) c = 0 @@ -745,9 +745,10 @@ class Connector: continue pointer = (block_height << 42) + (block_index << 21) + i try: - address = b"".join((bytes([out["nType"]]), out["scriptPubKey"])) - except: address = b"".join((bytes([out["nType"]]), out["addressHash"])) + + except: + address = b"".join((bytes([out["nType"]]), out["scriptPubKey"])) self.utxo.set(b"".join((tx["txId"], int_to_bytes(i))), pointer, out["value"], address) self.tx_cache.set(tx["txId"], True)