MCPcopy Create free account
hub / github.com/ElementsProject/elements / default_sighash

Function default_sighash

test/functional/feature_taproot.py:266–276  ·  view source on GitHub ↗

Default expression for "sighash": depending on mode, compute tagged hash or dsha256 of sigmsg.

(ctx)

Source from the content-addressed store, hash-verified

264 return LegacySignatureMsg(scriptcode, tx, idx, hashtype, enable_sighash_rangeproof=False)[0]
265
266def default_sighash(ctx):
267 """Default expression for "sighash": depending on mode, compute tagged hash or dsha256 of sigmsg."""
268 msg = get(ctx, "sigmsg")
269 mode = get(ctx, "mode")
270 if mode == "taproot":
271 return TaggedHash("TapSighash/elements", msg)
272 else:
273 if msg is None:
274 return (1).to_bytes(32, 'little')
275 else:
276 return hash256(msg)
277
278def default_tweak(ctx):
279 """Default expression for "tweak": None if a leaf is specified, tap[0] otherwise."""

Callers

nothing calls this directly

Calls 3

getFunction · 0.85
TaggedHashFunction · 0.50
hash256Function · 0.50

Tested by

no test coverage detected