예제 #1
0
    def __init__(self,
                 opts,
                 node_ssl_service: Optional[NodeSSLService] = None,
                 block_queueing_cls=BtcBlockQueuingService):
        if opts.use_extensions:
            helpers.set_extensions_parallelism()
        if node_ssl_service is None:
            node_ssl_service = MockNodeSSLService(self.NODE_TYPE, MagicMock())
        super(MockGatewayNode, self).__init__(opts, node_ssl_service)

        self.broadcast_messages = []
        self.broadcast_to_nodes_messages = []
        self._tx_service = GatewayTransactionService(self, 0)
        self.block_cleanup_service = self._get_cleanup_service()
        self.block_queuing_service = block_queueing_cls(self)
        self.message_converter = MockMessageConverter()
        if opts.use_extensions:
            from bxgateway.services.extension_gateway_transaction_service import ExtensionGatewayTransactionService
            self._tx_service = ExtensionGatewayTransactionService(
                self, self.network_num)
        else:
            self._tx_service = GatewayTransactionService(
                self, self.network_num)
        self.opts.has_fully_updated_tx_service = True
        self.requester = MagicMock()
        self.has_active_blockchain_peer = MagicMock(return_value=True)
        self.min_tx_from_node_gas_price = MagicMock()
예제 #2
0
    def __init__(self, opts, node_ssl_service: Optional[NodeSSLService] = None):
        if opts.use_extensions:
            helpers.set_extensions_parallelism()
        if node_ssl_service is None:
            node_ssl_service = MockNodeSSLService(self.NODE_TYPE, MagicMock())
        super(MockOntGatewayNode, self).__init__(opts, node_ssl_service)
        self.requester = MagicMock()

        self.broadcast_messages = []
        self.send_to_node_messages = []
        self._tx_service = TransactionService(self, 0)
        self.block_cleanup_service = self._get_cleanup_service()
        self.block_queuing_service = OntBlockQueuingService(self)
        self.message_converter = MockMessageConverter()
        if opts.use_extensions:
            from bxcommon.services.extension_transaction_service import ExtensionTransactionService
            self._tx_service = ExtensionTransactionService(self, self.network_num)
        else:
            self._tx_service = TransactionService(self, self.network_num)
        self.opts.has_fully_updated_tx_service = True
        self.node_conn = MagicMock()
        self.node_conn.is_active = MagicMock(return_value=True)