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)
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")
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)
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)
def get_action(self): action = run_hook('get_action', self) if action: return action if not self.file_exists: return 'new'