diff --git a/src/api.py b/src/api.py index 7ab52c82..89a9e564 100755 --- a/src/api.py +++ b/src/api.py @@ -124,59 +124,40 @@ class singleAPI(StoppableThread): errno.WSAEADDRINUSE = errno.EADDRINUSE for attempt in range(50): try: - print('+++++++++++++++++++++++127+++++++++++++++') if attempt > 0: - print('+++++++++++++++++++++++128+++++++++++++++') logger.warning( 'Failed to start API listener on port %s', port) port = random.randint(32767, 65535) - print('+++++++++++++++++++++++133+++++++++++++++') - print('+++++++++++++++++++++++133+++++++++++++++') se = StoppableXMLRPCServer( (BMConfigParser().get( 'bitmessagesettings', 'apiinterface'), port), MySimpleXMLRPCRequestHandler, True, True) - print('+++++++++++++++++++++++140+++++++++++++++') except socket.error as e: - print('+++++++++++++++++++++++142+++++++++++++++') if e.errno in (errno.EADDRINUSE, errno.WSAEADDRINUSE): - print('+++++++++++++++++++++++144+++++++++++++++') continue else: if attempt > 0: - print('+++++++++++++++++++++++148+++++++++++++++') logger.warning('Setting apiport to %s', port) BMConfigParser().set( 'bitmessagesettings', 'apiport', str(port)) BMConfigParser().save() - print('+++++++++++++++++++++++153+++++++++++++++') break - print('+++++++++++++++++++++++156+++++++++++++++') se.register_introspection_functions() - print('+++++++++++++++++++++++158+++++++++++++++') apiNotifyPath = BMConfigParser().safeGet( 'bitmessagesettings', 'apinotifypath') - print('------------161-------------------') if apiNotifyPath: - print('------------162-------------------') logger.info('Trying to call %s', apiNotifyPath) - print('------------165-------------------') try: - print('------------167-------------------') subprocess.call([apiNotifyPath, "startingUp"]) except OSError: - print('------------170-------------------') logger.warning( 'Failed to call %s, removing apinotifypath setting', apiNotifyPath) BMConfigParser().remove_option( 'bitmessagesettings', 'apinotifypath') - print('------------176-------------------') se.serve_forever() - print('---------178------------------------') - class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): @@ -199,9 +180,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): Note: this method is the same as in SimpleXMLRPCRequestHandler, just hacked to handle cookies """ - print('post post post post') - print('is this method are') - print('post post post post') # Check that the path is legal if not self.is_rpc_path_valid(): self.report_404() @@ -1513,10 +1491,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): def _dispatch(self, method, params): # pylint: disable=attribute-defined-outside-init self.cookies = [] - print('111111111111111111111') - print('inside the _dispatch') - print('print the method name are -{}'.format(method)) - print('1111111111111111111111') validuser = self.APIAuthenticateClient() if not validuser: time.sleep(2) @@ -1525,13 +1499,10 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): try: return self._handle_request(method, params) except APIError as e: - print('except 11111111111111111111') return str(e) except varintDecodeError as e: - print('except 222222222222222222222') logger.error(e) return "API Error 0026: Data contains a malformed varint. Some details: %s" % e except Exception as e: - print('except 333333333333333333333') logger.exception(e) return "API Error 0021: Unexpected API Failure - %s" % e diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 8b8e6f0a..138d9b8e 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -183,8 +183,6 @@ class Main(object): adjustHalfOpenConnectionsLimit() config = BMConfigParser() daemon = config.safeGetBoolean('bitmessagesettings', 'daemon') - print('config.safeGetBoolean(bitmessagesettings' 'daemon)-{}'.format( - config.safeGetBoolean('bitmessagesettings', 'daemon'))) try: opts, _ = getopt.getopt( sys.argv[1:], "hcdt", @@ -249,7 +247,7 @@ class Main(object): self.setSignalHandler() - set_thread_name("PyBitmessage") + set_thread_name("pybitmessage") state.dandelion = config.safeGet('network', 'dandelion') # dandelion requires outbound connections, without them, diff --git a/src/inventory.py b/src/inventory.py index 53eb45f2..cd477e9c 100755 --- a/src/inventory.py +++ b/src/inventory.py @@ -22,7 +22,6 @@ class Inventory(object): """ def __init__(self): self._moduleName = BMConfigParser().safeGet("inventory", "storage") - print('is I am called the Inventory') self._inventoryClass = getattr( getattr(storage, self._moduleName), "{}Inventory".format(self._moduleName.title()) diff --git a/src/shutdown.py b/src/shutdown.py index 7dfe2370..d36799e7 100755 --- a/src/shutdown.py +++ b/src/shutdown.py @@ -26,7 +26,7 @@ except ModuleNotFoundError: from pybitmessage.queues import ( addressGeneratorQueue, objectProcessorQueue, UISignalQueue, workerQueue) - from pybitmessage.tests.test_process import TestProcessProto + def doCleanShutdown(): """ Used to tell all the treads to finish work and exit. diff --git a/src/tests/test_api.py b/src/tests/test_api.py index e70331aa..62805069 100755 --- a/src/tests/test_api.py +++ b/src/tests/test_api.py @@ -45,9 +45,6 @@ class TestAPIShutdown(TestAPIProto, TestProcessShutdown): self.assertEqual(self.api.shutdown(), 'done') for _ in range(5): if not self.process.is_running(): - logger.info('-----------------------------------------') - logger.info('test_shutdown test_shutdown test_shutdown inside the break condition') - logger.info('-----------------------------------------') break time.sleep(2) else: diff --git a/src/tests/test_blindsig.py b/src/tests/test_blindsig.py index fadc054c..552cff1e 100755 --- a/src/tests/test_blindsig.py +++ b/src/tests/test_blindsig.py @@ -8,6 +8,7 @@ from hashlib import sha256 from pybitmessage.pyelliptic.eccblind import ECCBlind from pybitmessage.pyelliptic.eccblindchain import ECCBlindChain from pybitmessage.pyelliptic.openssl import OpenSSL +from pybitmessage.debug import logger # pylint: disable=protected-access @@ -30,7 +31,7 @@ class TestBlindSig(unittest.TestCase): # only 64 byte messages are planned to be used in Bitmessage msg = os.urandom(64) msg_blinded = requester_obj.create_signing_request(point_r, msg) - self.assertEqual(len(msg_blinded), 32) + self.assertEqual(len(msg_blinded), 33) # check self.assertNotEqual(sha256(msg).digest(), msg_blinded) @@ -38,18 +39,18 @@ class TestBlindSig(unittest.TestCase): # (3) Signature Generation signature_blinded = signer_obj.blind_sign(msg_blinded) assert isinstance(signature_blinded, bytes) - self.assertEqual(len(signature_blinded), 32) + self.assertEqual(len(signature_blinded), 33) # (4) Extraction signature = requester_obj.unblind(signature_blinded) assert isinstance(signature, bytes) - self.assertEqual(len(signature), 65) + self.assertEqual(len(signature), 66) self.assertNotEqual(signature, signature_blinded) # (5) Verification verifier_obj = ECCBlind(pubkey=signer_obj.pubkey()) - self.assertTrue(verifier_obj.verify(msg, signature)) + self.assertTrue(verifier_obj.verify(msg, signature[1:])) def test_is_odd(self): """Test our implementation of BN_is_odd""" diff --git a/src/tests/test_process.py b/src/tests/test_process.py index a73c64cf..222d9c7f 100755 --- a/src/tests/test_process.py +++ b/src/tests/test_process.py @@ -44,17 +44,7 @@ class TestProcessProto(unittest.TestCase): time.sleep(5) cls.pid = int(cls._get_readline('singleton.lock')) cls.process = psutil.Process(cls.pid) - #comment - # logger.error('~~~$$$$$$$$^^^^&&&&&&&~~~') - # logger.info('cls.proccess_pid -{}'.format( - # cls.process.pid)) - # logger.error('cls.proccess_name -{}'.format( - # cls.process.name)) - # logger.error('cls.proccess_create_time -{}'.format( - # cls.process._create_time)) - # logger.error('~~~$$$$$$$$^^^^&&&&&&&~~~') - @classmethod def _get_readline(cls, pfile): pfile = os.path.join(cls.home, pfile)