diff --git a/src/electrum_ecc/__init__.py b/src/electrum_ecc/__init__.py index 669d8e8..a7059df 100644 --- a/src/electrum_ecc/__init__.py +++ b/src/electrum_ecc/__init__.py @@ -10,3 +10,14 @@ # Some unit tests need to create ECDSA sigs without grinding the R value (and just use RFC6979). # see https://github.com/bitcoin/bitcoin/pull/13666 ENABLE_ECDSA_R_VALUE_GRINDING = True + + +# Ensure that asserts are enabled. For sanity and paranoia, we require this. +# Code *should not rely* on asserts being enabled. In particular, safety and security checks should +# always explicitly raise exceptions. However, this rule is mistakenly broken occasionally... +try: + assert False # noqa: B011 +except AssertionError: + pass +else: + raise ImportError("Running with asserts disabled. Refusing to continue. Exiting...")