From 85009a7b50d0a6935e5a13a9cb81aac968b703b9 Mon Sep 17 00:00:00 2001 From: sanket1729 Date: Thu, 13 Jan 2022 08:46:27 +0530 Subject: [PATCH] Update documentation of from_u32_consensus --- src/blockdata/transaction.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/blockdata/transaction.rs b/src/blockdata/transaction.rs index 5e92eea6..445da7d8 100644 --- a/src/blockdata/transaction.rs +++ b/src/blockdata/transaction.rs @@ -758,6 +758,10 @@ impl EcdsaSigHashType { /// /// **Note**: this replicates consensus behaviour, for current standardness rules correctness /// you probably want [Self::from_u32_standard]. + /// This might cause unexpected behavior because it does not roundtrip. That is, + /// `EcdsaSigHashType::from_u32_consensus(n) as u32 != n` for non-standard values of + /// `n`. While verifying signatures, the user should retain the `n` and use it compute the + /// signature hash message. pub fn from_u32_consensus(n: u32) -> EcdsaSigHashType { // In Bitcoin Core, the SignatureHash function will mask the (int32) value with // 0x1f to (apparently) deactivate ACP when checking for SINGLE and NONE bits.