def get_mempool_transaction(self, txid):
        try:
            raw_tx = self.bitcoind('getrawtransaction', [txid, 0, -1])
        except:
            return None

        vds = deserialize.BCDataStream()
        vds.write(raw_tx.decode('hex'))

        return deserialize.parse_Transaction(vds, is_coinbase=False)
    def get_mempool_transaction(self, txid):
        try:
            raw_tx = self.bitcoind('getrawtransaction', [txid, 0, -1])
        except:
            return None

        vds = deserialize.BCDataStream()
        vds.write(raw_tx.decode('hex'))

        return deserialize.parse_Transaction(vds, is_coinbase=False)
    def get_mempool_transaction(self, txid):
        try:
            raw_tx = self.bitcoind("getrawtransaction", [txid, 0])
        except:
            return None

        vds = deserialize.BCDataStream()
        vds.write(raw_tx.decode("hex"))
        try:
            return deserialize.parse_Transaction(vds, is_coinbase=False)
        except:
            print_log("ERROR: cannot parse", txid)
            return None
 def deserialize_block(self, block):
     txlist = block.get('tx')
     tx_hashes = []  # ordered txids
     txdict = {}     # deserialized tx
     is_coinbase = True
     for raw_tx in txlist:
         tx_hash = hash_encode(Hash(raw_tx.decode('hex')))
         tx_hashes.append(tx_hash)
         vds = deserialize.BCDataStream()
         vds.write(raw_tx.decode('hex'))
         tx = deserialize.parse_Transaction(vds, is_coinbase)
         txdict[tx_hash] = tx
         is_coinbase = False
     return tx_hashes, txdict
 def deserialize_block(self, block):
     txlist = block.get('tx')
     tx_hashes = []  # ordered txids
     txdict = {}  # deserialized tx
     is_coinbase = True
     for raw_tx in txlist:
         tx_hash = hash_encode(Hash(raw_tx.decode('hex')))
         tx_hashes.append(tx_hash)
         vds = deserialize.BCDataStream()
         vds.write(raw_tx.decode('hex'))
         tx = deserialize.parse_Transaction(vds, is_coinbase)
         txdict[tx_hash] = tx
         is_coinbase = False
     return tx_hashes, txdict
 def deserialize_block(self, block):
     txlist = block.get("tx")
     tx_hashes = []  # ordered txids
     txdict = {}  # deserialized tx
     is_coinbase = True
     for raw_tx in txlist:
         tx_hash = hash_encode(Hash(raw_tx.decode("hex")))
         vds = deserialize.BCDataStream()
         vds.write(raw_tx.decode("hex"))
         try:
             tx = deserialize.parse_Transaction(vds, is_coinbase)
         except:
             print_log("ERROR: cannot parse", tx_hash)
             continue
         tx_hashes.append(tx_hash)
         txdict[tx_hash] = tx
         is_coinbase = False
     return tx_hashes, txdict
    def deserialize_block(self, block):
        txlist = block.get('tx')

        tx_hashes = []  # ordered txids
        txdict = {}     # deserialized tx

        for i, raw_tx in enumerate(txlist):
            tx_hash = hash_encode(Hash(raw_tx.decode('hex')))
            vds = deserialize.BCDataStream()
            vds.write(raw_tx.decode('hex'))
            try:
                tx = deserialize.parse_Transaction(vds, i == 0) # first transaction is always coinbase
            except:
                print_log("ERROR: cannot parse", tx_hash)
                continue
            tx_hashes.append(tx_hash)
            txdict[tx_hash] = tx
        return tx_hashes, txdict
    def deserialize_block(self, block):
        txlist = block.get('tx')

        tx_hashes = []  # ordered txids
        txdict = {}  # deserialized tx

        for i, raw_tx in enumerate(txlist):
            tx_hash = hash_encode(Hash(raw_tx.decode('hex')))
            vds = deserialize.BCDataStream()
            vds.write(raw_tx.decode('hex'))
            try:
                tx = deserialize.parse_Transaction(
                    vds, i == 0)  # first transaction is always coinbase
            except:
                print_log("ERROR: cannot parse", tx_hash)
                continue
            tx_hashes.append(tx_hash)
            txdict[tx_hash] = tx
        return tx_hashes, txdict