Beispiel #1
0
    def warn_if_no_secp(self, parent=None, message=None, icon=QMessageBox.Warning):
        ''' Returns True if it DID warn: ie if there's no secp and ecc operations
        are slow, otherwise returns False if we have secp.

        Pass message (rich text) to provide a custom message.

        Note that the URL link to the HOWTO will always be appended to the custom message.'''
        from electroncash import ecc_fast
        has_secp = ecc_fast.is_using_fast_ecc()
        if has_secp:
            return False

        # else..
        howto_url = 'https://github.com/Bitcoin-ABC/ElectrumABC/blob/master/contrib/secp_HOWTO.md'
        message = message or _(
            f"{PROJECT_NAME} was unable to find the secp256k1 library on this "
            f"system. Elliptic curve cryptography operations will be performed"
            f" in slow Python-only mode."),
        url_blurb = _("Please visit this page for instructions on how to "
                      "correct the situation:")
        msg = f'''
        <html><body>
            <p>
            {message}
            <p>
            {url_blurb}
            </p>
            <p><a href="{howto_url}">{PROJECT_NAME} Secp Mini-HOWTO</a></p>
        </body></html>
        '''
        self.warning(parent=parent, title=_("Missing libsecp256k1"),
                     message=msg, rich_text=True)
        return True
Beispiel #2
0
 def thrdfunc(config_options):
     # lazy init of SSL
     import ssl, sys
     from electroncash import version, ecc_fast, schnorr
     NSLog("Electron Cash lib version: %s (using server protocol: %s)",
           version.PACKAGE_VERSION, version.PROTOCOL_VERSION)
     NSLog("Python version: %s", ' '.join(sys.version.split('\n')))
     NSLog("OpenSSL version: %s", ssl.OPENSSL_VERSION)
     NSLog("Fast ECC: %s  Fast Schnorr: %s",
           str(ecc_fast.is_using_fast_ecc()), str(schnorr.has_fast_sign()))
Beispiel #3
0
    def warn_if_no_secp(self,
                        parent=None,
                        message=None,
                        icon=QMessageBox.Warning,
                        relaxed=False):
        ''' Returns True if it DID warn: ie if there's no secp and ecc operations
        are slow, otherwise returns False if we have secp.

        Pass message (rich text) to provide a custom message.

        Note that the URL link to the HOWTO will always be appended to the custom message.'''
        from electroncash import ecc_fast
        has_secp = ecc_fast.is_using_fast_ecc()
        if has_secp:
            return False

        # When relaxwarn is set return True without showing the warning
        from electroncash import get_config
        if relaxed and get_config().cmdline_options["relaxwarn"]:
            return True

        # else..
        howto_url = 'https://github.com/Electron-Cash/Electron-Cash/blob/master/contrib/secp_HOWTO.md#libsecp256k1-0-for-electron-cash'
        template = '''
        <html><body>
            <p>
            {message}
            <p>
            {url_blurb}
            </p>
            <p><a href="{url}">Electron Cash Secp Mini-HOWTO</a></p>
        </body></html>
        '''
        msg = template.format(
            message=message or
            _("Electron Cash was unable to find the secp256k1 library on this system. Elliptic curve cryptography operations will be performed in slow Python-only mode."
              ),
            url=howto_url,
            url_blurb=
            _("Please visit this page for instructions on how to correct the situation:"
              ))
        self.warning(parent=parent,
                     title=_("Missing libsecp256k1"),
                     message=msg,
                     rich_text=True)
        return True