Skip to content

Commit

Permalink
remove sizeof test, fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
RCasatta committed Jul 15, 2021
1 parent c232442 commit a37de1a
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/util/sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,10 @@ impl<R: Deref<Target = Transaction>> SigHashCache<R> {
zero_hash.consensus_encode(&mut writer)?;
}

if !anyone_can_pay && sighash != LegacySigHashType::Single && sighash != LegacySigHashType::None {
if !anyone_can_pay
&& sighash != LegacySigHashType::Single
&& sighash != LegacySigHashType::None
{
self.segwit_cache()
.sequences
.consensus_encode(&mut writer)?;
Expand Down Expand Up @@ -447,9 +450,7 @@ impl<R: Deref<Target = Transaction>> SigHashCache<R> {
}

self.tx.lock_time.consensus_encode(&mut writer)?;
sighash_type
.as_u32()
.consensus_encode(&mut writer)?;
sighash_type.as_u32().consensus_encode(&mut writer)?;
Ok(())
}

Expand Down Expand Up @@ -624,14 +625,12 @@ mod tests {
use hashes::hex::FromHex;
use hashes::{Hash, HashEngine};
use network::constants::Network;
use std::mem::size_of;
use std::str::FromStr;
use util::address::Address;
use util::bip143;
use util::ecdsa::PublicKey;
use util::sighash::{
Annex, CommonCache, Error, LegacySigHashType, Prevouts, ScriptPath, SegwitCache,
SigHashCache, SigHashType, TaprootCache,
Annex, Error, LegacySigHashType, Prevouts, ScriptPath, SigHashCache, SigHashType,
};
use util::taproot::TapSighashHash;
use {Script, Transaction, TxIn, TxOut};
Expand Down Expand Up @@ -709,15 +708,6 @@ mod tests {
);
}

#[test]
fn sizeof() {
assert_eq!(size_of::<Option<CommonCache>>(), 97);
assert_eq!(size_of::<Option<TaprootCache>>(), 65);
assert_eq!(size_of::<Option<SegwitCache>>(), 97);
assert_eq!(size_of::<&Transaction>(), 8);
assert_eq!(size_of::<SigHashCache<&Transaction>>(), 272);
}

#[test]
fn test_sighashes_with_annex() {
test_taproot_sighash(
Expand Down

0 comments on commit a37de1a

Please sign in to comment.