Merge rust-bitcoin/rust-bitcoin#3684: refactor: remove unnecessary if block

b5a0731a23 refactor: remove unnecessary if block (Chris Hyunhum Cho)

Pull request description:

  This `if...else` block can be replaced with one `if` block, by changing `==` to `!=`.

ACKs for top commit:
  jamillambert:
    ACK b5a0731a23
  apoelstra:
    ACK b5a0731a23f945f7e4cc7d8f3c0f1d3f83875272; successfully ran local tests
  tcharding:
    ACK b5a0731a23

Tree-SHA512: eee0d63532953d27fe081c36180ae9adb63c0ab7f1fb8324d9fc5e4a408f421d8df894efcccfc4bd3142625d6be6ea1258c9478faa025ce147ebe1b4e9377738
This commit is contained in:
merge-script 2024-12-01 23:25:32 +00:00
commit 8acf3ec30a
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 2 additions and 3 deletions

View File

@ -49,9 +49,8 @@ impl Signature {
/// Note: this allocates on the heap, prefer [`serialize`](Self::serialize) if vec is not needed.
pub fn to_vec(self) -> Vec<u8> {
let mut ser_sig = self.signature.as_ref().to_vec();
if self.sighash_type == TapSighashType::Default {
// default sighash type, don't add extra sighash byte
} else {
// If default sighash type, don't add extra sighash byte
if self.sighash_type != TapSighashType::Default {
ser_sig.push(self.sighash_type as u8);
}
ser_sig