예제 #1
0
    def setup_nodes(self):

        # Check that bitcoin has been built with ZMQ enabled and we have python zmq package installed.
        check_zmq_test_requirements(
            self.options.configfile,
            SkipTest("bitcoind has not been built with zmq enabled."))
        # import zmq when we know we have the requirements for test with zmq.
        import zmq

        self.zmqContext = zmq.Context()
        self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)
        self.zmqSubSocket.set(zmq.RCVTIMEO, 60000)
        self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock")
        self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx")
        self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawblock")
        self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawtx")
        address = f"tcp://127.0.0.1:{zmq_port(0)}"
        self.zmqSubSocket.connect(address)
        self.extra_args = [[
            '-zmqpubhashblock=%s' % address,
            '-zmqpubhashtx=%s' % address,
            '-zmqpubrawblock=%s' % address,
            '-zmqpubrawtx=%s' % address
        ], []]
        self.add_nodes(self.num_nodes, self.extra_args)
        self.start_nodes()
예제 #2
0
    def setup_nodes(self):

        # Check that bitcoin has been built with ZMQ enabled and we have python zmq package installed.
        check_zmq_test_requirements(self.options.configfile,
                                    SkipTest("bitcoind has not been built with zmq enabled."))
        # import zmq when we know we have the requirements for test with zmq.
        import zmq

        self.zmqContext = zmq.Context()
        self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)
        self.zmqSubSocket.set(zmq.RCVTIMEO, 60000)
        self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"invalidtx")
        self.address = f"tcp://127.0.0.1:{zmq_port(0)}"

        self.add_nodes(self.num_nodes)
    def setup_nodes(self):

        # Check that bitcoin has been built with ZMQ enabled and we have python zmq package installed.
        check_zmq_test_requirements(
            self.options.configfile,
            SkipTest("bitcoind has not been built with zmq enabled."))
        # import zmq when we know we have the requirements for test with zmq.
        import zmq

        self.zmqContext = zmq.Context()
        self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)
        self.zmqSubSocket.set(zmq.RCVTIMEO, 60000)
        self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"discardedfrommempool")
        self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"removedfrommempoolblock")
        ip_address = "tcp://127.0.0.1:28332"
        self.zmqSubSocket.connect(ip_address)
        self.extra_args = [[
            "-zmqpubdiscardedfrommempool=%s" % ip_address,
            "-zmqpubremovedfrommempoolblock=%s" % ip_address
        ], []]
        self.add_nodes(self.num_nodes, self.extra_args)
        self.start_nodes()