Exemple #1
0
 def __init__(self, d):
     Xpub.__init__(self)
     KeyStore.__init__(self)
     # Errors and other user interaction is done through the wallet's
     # handler.  The handler is per-window and preserved across
     # device reconnects
     self.xpub = d.get('xpub')
     self.label = d.get('label')
     self.derivation = d.get('derivation')
     self.handler = None
     run_hook('init_keystore', self)
Exemple #2
0
    def run(self):
        run_hook('set_network', self)
        self.blockchain.init()
        while self.is_running():
            self.maintain_sockets()
            self.wait_on_sockets()
            self.handle_bc_requests()
            self.run_jobs()    # Synchronizer and Verifier
            self.process_pending_sends()

        self.stop_network()
        run_hook('set_network', None)
        self.print_error("stopped")
Exemple #3
0
 def resolve(self, k):
     if bitcoin.is_address(k):
         return {'address':k, 'type':'address'}
     if k in self.keys():
         _type, addr = self[k]
         if _type == 'address':
             return {'address':addr, 'type':'contact'}
     out = run_hook('resolve_address', k)
     if out:
         return out
     raise Exception("Invalid Bitcoin address or alias", k)
Exemple #4
0
 def resolve(self, k, nocheck=False):
     if bitcoin.is_address(k):
         return {'address':k, 'type':'address'}
     if k in self.keys():
         _type, addr = self[k]
         if _type == 'address':
             return {'address':addr, 'type':'contact'}
     out = run_hook('resolve_address', k)
     if out:
         if not nocheck and out.get('validated') is False:
             raise Exception("cannot validate alias")
         return out
     raise Exception("invalid Litecoin address", k)
Exemple #5
0
 def get_action(self):
     action = run_hook('get_action', self)
     if action:
         return action
     if not self.file_exists:
         return 'new'
Exemple #6
0
 def get_action(self):
     action = run_hook('get_action', self)
     if action:
         return action
     if not self.file_exists:
         return 'new'