Default expression for "signature": BIP340 signature or ECDSA signature depending on mode.
(ctx)
| 291 | return tweak_add_privkey(key, tweak) |
| 292 | |
| 293 | def default_signature(ctx): |
| 294 | """Default expression for "signature": BIP340 signature or ECDSA signature depending on mode.""" |
| 295 | sighash = get(ctx, "sighash") |
| 296 | deterministic = get(ctx, "deterministic") |
| 297 | if get(ctx, "mode") == "taproot": |
| 298 | key = get(ctx, "key_tweaked") |
| 299 | flip_r = get(ctx, "flag_flip_r") |
| 300 | flip_p = get(ctx, "flag_flip_p") |
| 301 | aux = bytes([0] * 32) |
| 302 | if not deterministic: |
| 303 | aux = random.getrandbits(256).to_bytes(32, 'big') |
| 304 | return sign_schnorr(key, sighash, flip_r=flip_r, flip_p=flip_p, aux=aux) |
| 305 | else: |
| 306 | key = get(ctx, "key") |
| 307 | return key.sign_ecdsa(sighash, rfc6979=deterministic) |
| 308 | |
| 309 | def default_hashtype_actual(ctx): |
| 310 | """Default expression for "hashtype_actual": hashtype, unless mismatching SIGHASH_SINGLE in taproot.""" |
nothing calls this directly
no test coverage detected