Ejemplo n.º 1
0
 def __init__(self, params):
     """Create a fetcher object given configuration in <params>
     """
     use = params.get('interface', 'blockchain.info')
     if use == 'blockchain.info':
         self.interface = BlockchainInfoInterface()
     elif use == 'testnet':
         self.interface = AbeInterface()
     elif use == 'electrum':
         electrum_server = params.get('electrum_server',
                                      DEFAULT_ELECTRUM_SERVER)
         electrum_port = params.get('electrum_port', DEFAULT_ELECTRUM_PORT)
         self.interface = ElectrumInterface(electrum_server, electrum_port)
     else:
         raise Exception('unknown service for UTXOFetcher')
Ejemplo n.º 2
0
 def make_interface(cls, model, params):
     use = params.get('interface', 'helloblock')
     if model.testnet:
         if use != 'helloblock':
             use = 'abe_testnet'
     if use == 'helloblock':
         return HelloBlockInterface(model.testnet)
     elif use == 'blockchain.info':
         return BlockchainInfoInterface()
     elif use == 'abe_testnet':
         return AbeInterface()
     elif use == 'electrum':
         electrum_server = params.get('electrum_server',
                                      DEFAULT_ELECTRUM_SERVER)
         electrum_port = params.get('electrum_port', DEFAULT_ELECTRUM_PORT)
         return ElectrumInterface(electrum_server, electrum_port)
     else:
         raise Exception('unknown service for UTXOFetcher')
Ejemplo n.º 3
0
 def test_blockchain(self):
     self.assertEqual(
         BlockchainInfoInterface.get_utxo(self.address)[0][0], self.txhash)
     self.assertEqual(BlockchainInfoInterface.get_utxo(self.address2), [])
Ejemplo n.º 4
0
 def test_blockchain(self):
     self.assertEqual(BlockchainInfoInterface.get_utxo(self.address)[0][0],
                      self.txhash)
     self.assertEqual(BlockchainInfoInterface.get_utxo(self.address2), [])