Skip to content

Commit

Permalink
transaction: deprecate SigHashType::from_u32 in favor of from_u32_con…
Browse files Browse the repository at this point in the history
…sensus

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
  • Loading branch information
darosior committed Feb 19, 2021
1 parent bf98d9f commit bc6f54f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/blockdata/transaction.rs
Expand Up @@ -686,11 +686,17 @@ impl SigHashType {
}
}

/// Reads a 4-byte uint32 as a sighash type.
#[deprecated(since="0.26.1", note="please use `from_u32_consensus` or `from_u32_standard` instead")]
pub fn from_u32(n: u32) -> SigHashType {
Self::from_u32_consensus(n)
}

/// Reads a 4-byte uint32 as a sighash type.
///
/// **Note**: this replicates consensus behaviour, for current standardness rules correctness
/// you probably want [from_u32_standard].
pub fn from_u32(n: u32) -> SigHashType {
pub fn from_u32_consensus(n: u32) -> SigHashType {
// In Bitcoin Core, the SignatureHash function will mask the (int32) value with
// 0x1f to (apparently) deactivate ACP when checking for SINGLE and NONE bits.
// We however want to be matching also against on ACP-masked ALL, SINGLE, and NONE.
Expand Down

0 comments on commit bc6f54f

Please sign in to comment.