You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
less debug
This commit is contained in:
@@ -8,8 +8,7 @@ EC_COMPRESSED = lib.SECP256K1_EC_COMPRESSED
|
||||
EC_UNCOMPRESSED = lib.SECP256K1_EC_UNCOMPRESSED
|
||||
|
||||
HAS_RECOVERABLE = hasattr(lib, 'secp256k1_ecdsa_sign_recoverable')
|
||||
#HAS_SCHNORR = hasattr(lib, 'secp256k1_schnorrsig_sign')
|
||||
HAS_SCHNORR = hasattr(lib, 'secp256k1_schnorrsig_sign_custom') # forgot why it's called custom
|
||||
HAS_SCHNORR = hasattr(lib, 'secp256k1_schnorrsig_sign')
|
||||
HAS_ECDH = hasattr(lib, 'secp256k1_ecdh')
|
||||
HAS_EXTRAKEYS = hasattr(lib, 'secp256k1_keypair_create')
|
||||
|
||||
@@ -232,17 +231,13 @@ class PublicKey(ECDSA):
|
||||
return bool(verified)
|
||||
|
||||
def schnorr_verify(self, msg, schnorr_sig, bip340tag, raw=False):
|
||||
print("schnorr_verify 0")
|
||||
assert self.public_key, "No public key defined"
|
||||
if not HAS_SCHNORR:
|
||||
raise Exception("secp256k1_schnorr not enabled")
|
||||
print("schnorr_verify 1")
|
||||
msg_to_sign = _bip340_tag(msg, raw, bip340tag)
|
||||
print("schnorr_verify 2")
|
||||
verified = lib.secp256k1_schnorrsig_verify(
|
||||
secp256k1_ctx, schnorr_sig, msg_to_sign, len(msg_to_sign),
|
||||
self.xonly_pubkey)
|
||||
print("schnorr_verify 3")
|
||||
return bool(verified)
|
||||
|
||||
def ecdh(self, scalar, hashfn=ffi.NULL, hasharg=ffi.NULL):
|
||||
@@ -366,7 +361,7 @@ class PrivateKey(ECDSA):
|
||||
sig64 = ffi.new('char [64]')
|
||||
|
||||
# FIXME: It's recommended to provide aux_rand32...
|
||||
signed = lib.secp256k1_schnorrsig_sign_custom(
|
||||
signed = lib.secp256k1_schnorrsig_sign(
|
||||
secp256k1_ctx, sig64, msg_to_sign, len(msg_to_sign),
|
||||
self.keypair, ffi.NULL)
|
||||
assert signed == 1
|
||||
|
||||
@@ -252,7 +252,7 @@ class Lib:
|
||||
except (ValueError, AttributeError):
|
||||
return 0
|
||||
|
||||
def secp256k1_schnorrsig_sign_custom(self, ctx, sig64, msg, msg_len, keypair, aux_rand32):
|
||||
def secp256k1_schnorrsig_sign(self, ctx, sig64, msg, msg_len, keypair, aux_rand32):
|
||||
try:
|
||||
if isinstance(keypair, FFI.CData):
|
||||
keypair = keypair._data
|
||||
|
||||
@@ -59,12 +59,13 @@ def printevents():
|
||||
# allowing 30 seconds for stuff to come in...
|
||||
for _ in range(30):
|
||||
time.sleep(1)
|
||||
print(".")
|
||||
print("checking pool....")
|
||||
try:
|
||||
event_msg = relay_manager.message_pool.get_event()
|
||||
print(f"event_msg: pubkey: {event_msg.event.public_key} created_at {event_msg.event.created_at}")
|
||||
except Exception as e:
|
||||
print(f"pool.get_event() got error: {e}")
|
||||
#print(f"pool.get_event() got error: {e}")
|
||||
pass
|
||||
print("30 seconds passed, closing:")
|
||||
relay_manager.close_connections()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user