def __init__(self, wallet, db=None, account='default', testnet=False, blockchain=None, zeroconf=True, sync_period=600): """Initalize the payment server. Args: wallet (.wallet.Two1WalletWrapper): a two1 wallet wrapped with payment server functionality. db (.models.ChannelDataManager): a database wrapper to manage the payment channel server's interface with a persistent store of data. account (string): which account within the wallet to use (e.g. 'merchant', 'customer', 'default', etc). testnet (boolean): whether or not the server should broadcast and verify transactions against the bitcoin testnet blockchain. blockchain (two1.lib.blockchain.provider): a blockchain data provider capable of broadcasting raw transactions. zeroconf (boolean): whether or not to use a payment channel before the deposit transaction has been confirmed by the network. sync_period (integer): how often to sync channel status (in sec). """ self.zeroconf = zeroconf self._wallet = Two1WalletWrapper(wallet, account) self._blockchain = blockchain self._db = db if db is None: self._db = DatabaseSQLite3() if blockchain is None: self._blockchain = TwentyOneBlockchain(PaymentServer.DEFAULT_TWENTYONE_BLOCKCHAIN_URL if not self._wallet._wallet.testnet else PaymentServer.DEFAULT_TWENTYONE_TESTNET_BLOCKCHAIN_URL) self._sync_stop = threading.Event() self._sync_thread = threading.Thread(target=self._auto_sync, args=(sync_period, self._sync_stop), daemon=True) self._sync_thread.start()