Exemple #1
0
    def __init__(self, app):
        super().__init__(AndroidConfig(app), wallet=None, network=None)
        fd, server = daemon.get_fd_or_server(self.config)
        if not fd:
            raise Exception("Daemon already running")  # Same wording as in daemon.py.

        # Initialize here rather than in start() so the DaemonModel has a chance to register
        # its callback before the daemon threads start.
        self.daemon = daemon.Daemon(self.config, fd, False, None)
        self.network = self.daemon.network
        self.network.register_callback(self._on_callback, CALLBACKS)
        self.daemon_running = False
Exemple #2
0
    def __init__(self, config):
        super().__init__(config, wallet=None, network=None)
        fd, server = daemon.get_fd_or_server(self.config)
        if not fd:
            raise Exception(
                "Daemon already running")  # Same wording as in daemon.py.

        # Create daemon here rather than in start() so the DaemonModel has a chance to register
        # its callback before the daemon threads start.
        self.daemon = daemon.Daemon(self.config,
                                    fd,
                                    is_gui=False,
                                    plugins=None)
        self.daemon_running = False

        self.gui_callback = None
        self.network = self.daemon.network
        self.network.register_callback(self._on_callback, CALLBACKS)
        self.network.add_jobs([AutoSaver(self.daemon)])
Exemple #3
0
    if not storage.file_exists():
        print_msg("Wallet doesn't exist, creating...")
        data = create_new_wallet(path=storage.path,
                                 config=config,
                                 password=config_options['wallet_password'],
                                 encrypt_file=True)
        storage = WalletStorage(storage.path)

    if storage.is_encrypted() is False:
        print_msg("Error: Wallet is unencrypted")
        sys.exit(1)

    fd, server = daemon.get_fd_or_server(config)
    if fd is not None:
        plugins = init_plugins(config, 'cmdline')
        d = daemon.Daemon(config, fd, False, plugins)

        wallet = d.load_wallet(path=storage.path,
                               password=config_options['wallet_password'])

        if wallet is None:
            raise Exception("Failed to load wallet")

        d.cmd_runner.wallet = wallet

        if config.get('websocket_server'):
            from electroncash import websockets
            websockets.WebSocketServer(config, d.network).start()

        d.start()
        d.join()