コード例 #1
0
    async def unordered_UTXOs(self, hashX):
        '''Return an unordered list of UTXO named tuples from mempool
        transactions that pay to hashX.

        This does not consider if any other mempool transactions spend
        the outputs.
        '''
        utxos = []
        for tx_hash in self.hashXs.get(hashX, ()):
            tx = self.txs.get(tx_hash)
            for pos, (hX, value) in enumerate(tx.out_pairs):
                if hX == hashX:
                    utxos.append(UTXO(-1, pos, tx_hash, 0, value))
        return utxos
コード例 #2
0
    async def unordered_UTXOs(self, hashX):
        '''Return an unordered list of UTXO named tuples from mempool
        transactions that pay to hashX.

        This does not consider if any other mempool transactions spend
        the outputs.
        '''
        utxos = []
        # hashXs is a defaultdict, so use get() to query
        for tx_hash in self.hashXs.get(hashX, ()):
            tx = self.txs.get(tx_hash)
            for pos, (hX, value, asset) in enumerate(tx.out_pairs):
                if hX == hashX:
                    if self.coin.EXTENDED_VOUT:
                        utxos.append(
                            UTXO_EXTENDED(-1, pos, tx_hash, 0, value, asset))
                    else:
                        utxos.append(UTXO(-1, pos, tx_hash, 0, value))
        return utxos
コード例 #3
0
ファイル: mempool.py プロジェクト: seanmc9/electrumx
    def get_utxos(self, hashX):
        '''Return an unordered list of UTXO named tuples from mempool
        transactions that pay to hashX.

        This does not consider if any other mempool transactions spend
        the outputs.
        '''
        utxos = []
        # hashXs is a defaultdict, so use get() to query
        for hex_hash in self.hashXs.get(hashX, []):
            item = self.txs.get(hex_hash)
            if not item:
                continue
            txout_pairs = item[1]
            for pos, (hX, value) in enumerate(txout_pairs):
                if hX == hashX:
                    # Unfortunately UTXO holds a binary hash
                    utxos.append(
                        UTXO(-1, pos, hex_str_to_hash(hex_hash), 0, value))
        return utxos