docs: update psbt docs to describe sighash behaviour
What changed, and why it matters
This commit only updates documentation comments in a header file. It adds notes explaining that PSBT signing functions use the sighash value already stored for each input, falling back to a default if none is set, and that callers should verify the sighash is acceptable before signing. No code behavior was changed.
No action required; this is a documentation improvement. Users of the signing APIs should review the clarified documentation to ensure their applications validate input sighashes appropriately.
Security signals we found
Documentation-only change
Clarifies caller responsibility for sighash validation
No code logic modified
Evidence from the diff
The diff modifies include/wally_psbt.h to add three identical documentation notes to wally_psbt_sign, wally_psbt_sign_bip32, and wally_psbt_sign_input_bip32. The notes clarify that inputs are signed using the stored sighash (or SIGHASH_ALL/SIGHASH_DEFAULT if absent) and that the caller is responsible for ensuring the sighash is acceptable. There are no functional code changes.
Changed components
include/wally_psbt.h documentationInspect captured patch +12 / −0
### include/wally_psbt.h
@@ -2649,6 +2649,10 @@ WALLY_CORE_API int wally_psbt_signing_cache_disable(
*
* .. note:: See https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#simple-signer-algorithm
*| for a description of the signing algorithm.
+ *
+ * .. note:: Inputs are signed using the sighash stored for the input,
+ *| or SIGHASH_ALL/SIGHASH_DEFAULT if not present. The caller should ensure
+ *| that each input sighash is acceptable before signing.
*/
WALLY_CORE_API int wally_psbt_sign(
struct wally_psbt *psbt,
@@ -2667,6 +2671,10 @@ WALLY_CORE_API int wally_psbt_sign(
*
* .. note:: See https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#simple-signer-algorithm
*| for a description of the signing algorithm.
+ *
+ * .. note:: Inputs are signed using the sighash stored for the input,
+ *| or SIGHASH_ALL/SIGHASH_DEFAULT if not present. The caller should ensure
+ *| that each input sighash is acceptable before signing.
*/
WALLY_CORE_API int wally_psbt_sign_bip32(
struct wally_psbt *psbt,
@@ -2684,6 +2692,10 @@ WALLY_CORE_API int wally_psbt_sign_bip32(
* :param hdkey: The derived extended key to sign with.
* :param flags: Flags controlling signing. Must be 0 or `EC_FLAG_GRIND_R`,
*| logical or-d with `EC_FLAG_ELEMENTS` if ``psbt`` is a PSET.
+ *
+ * .. note:: Inputs are signed using the sighash stored for the input,
+ *| or SIGHASH_ALL/SIGHASH_DEFAULT if not present. The caller should ensure
+ *| that the sighash is acceptable before signing.
*/
WALLY_CORE_API int wally_psbt_sign_input_bip32(
struct wally_psbt *psbt,Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.