Example #1
0
    def __init__(self, txfile):
        self.tx_by_id = {}
        self.txout_by_address = {}
        for line in open(datafile(txfile)).readlines():
            tx = txutil.from_hex(line.strip())
            self.tx_by_id[txutil.get_txhash_bin(tx)] = tx
            for i in range(wally.tx_get_num_outputs(tx)):
                addr = txutil.get_output_address(tx, i, gaconstants.ADDR_VERSIONS_TESTNET)
                self.txout_by_address[addr] = (tx, i)
        self.imported = {}

        # This is something of a workaround because all the existing tests are based on generating
        # txs where nlocktime was fixed as 0. The code changed to use current blockheight, so by
        # fudging this value to 0 the existing tests don't notice the difference
        self.getblockcount.return_value = 0
Example #2
0
 def get_bitcoin_address(tx_wif, idx):
     addr_versions = gaconstants.get_address_versions(
         clargs.args.network)
     addr_family = gaconstants.get_address_family(clargs.args.network)
     return txutil.get_output_address(tx_wif[0], idx, addr_versions,
                                      addr_family)
Example #3
0
 def get_bitcoin_address(tx_wif, idx):
     addr_versions = gaconstants.get_address_versions(
         clargs.args.is_testnet)
     return txutil.get_output_address(tx_wif[0], idx, addr_versions)