Skip to content

Do not set secp256k1 error callback #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions bitcointx/core/secp256k1.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ class Secp256k1LastErrorContextVar(bitcointx.util.ContextVarsCompat):
_ctypes_functype = getattr(ctypes, 'WINFUNCTYPE', getattr(ctypes, 'CFUNCTYPE'))


@_ctypes_functype(ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p)
def _secp256k1_error_callback_fn(error_str, _data): # type: ignore
_secp256k1_error_storage.last_error = {'code': -1, 'type': 'internal_error', 'message': str(error_str)}


@_ctypes_functype(ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p)
def _secp256k1_illegal_callback_fn(error_str, _data): # type: ignore
_secp256k1_error_storage.last_error = {'code': -2, 'type': 'illegal_argument', 'message': str(error_str)}
Expand Down Expand Up @@ -129,9 +124,6 @@ def _add_function_definitions(_secp256k1: ctypes.CDLL) -> None:
_secp256k1.secp256k1_context_set_illegal_callback.restype = None
_secp256k1.secp256k1_context_set_illegal_callback.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]

_secp256k1.secp256k1_context_set_error_callback.restype = None
_secp256k1.secp256k1_context_set_error_callback.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]

_secp256k1.secp256k1_ecdsa_sign.restype = ctypes.c_int
_secp256k1.secp256k1_ecdsa_sign.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p, ctypes.c_void_p]

Expand Down Expand Up @@ -198,7 +190,6 @@ def secp256k1_create_and_init_context(_secp256k1: ctypes.CDLL, flags: int
if ctx is None:
raise RuntimeError('secp256k1_context_create() returned None')

_secp256k1.secp256k1_context_set_error_callback(ctx, _secp256k1_error_callback_fn, 0)
_secp256k1.secp256k1_context_set_illegal_callback(ctx, _secp256k1_illegal_callback_fn, 0)

seed = os.urandom(32)
Expand Down