Remove consensus branch id from roundtrip serialization check.

Possible now that it's part of the transaction.
This commit is contained in:
Kris Nuttycombe 2021-06-05 09:48:12 -06:00
parent 47ce97c3d2
commit 97bef30582
2 changed files with 15 additions and 17 deletions

View File

@ -490,9 +490,7 @@ impl<P: consensus::Parameters> SaplingBuilder<P> {
shielded_spends, shielded_spends,
shielded_outputs, shielded_outputs,
value_balance: self.value_balance, value_balance: self.value_balance,
authorization: Unauthorized { authorization: Unauthorized { tx_metadata },
tx_metadata,
},
}) })
}; };
@ -530,14 +528,14 @@ impl Bundle<Unauthorized> {
shielded_spends: self shielded_spends: self
.shielded_spends .shielded_spends
.iter() .iter()
.map(|spend| spend.apply_signature( .map(|spend| {
spend_sig_internal( spend.apply_signature(spend_sig_internal(
PrivateKey(spend.spend_auth_sig.extsk.expsk.ask), PrivateKey(spend.spend_auth_sig.extsk.expsk.ask),
spend.spend_auth_sig.alpha, spend.spend_auth_sig.alpha,
sighash_bytes, sighash_bytes,
rng, rng,
) ))
)) })
.collect(), .collect(),
shielded_outputs: self.shielded_outputs, shielded_outputs: self.shielded_outputs,
value_balance: self.value_balance, value_balance: self.value_balance,

View File

@ -28,10 +28,10 @@ fn tx_read_write() {
assert_eq!(&data[..], &encoded[..]); assert_eq!(&data[..], &encoded[..]);
} }
fn check_roundtrip(branch_id: BranchId, tx: Transaction) -> Result<(), TestCaseError> { fn check_roundtrip(tx: Transaction) -> Result<(), TestCaseError> {
let mut txn_bytes = vec![]; let mut txn_bytes = vec![];
tx.write(&mut txn_bytes).unwrap(); tx.write(&mut txn_bytes).unwrap();
let txo = Transaction::read(&txn_bytes[..], branch_id).unwrap(); let txo = Transaction::read(&txn_bytes[..], tx.consensus_branch_id).unwrap();
prop_assert_eq!(tx.version, txo.version); prop_assert_eq!(tx.version, txo.version);
#[cfg(feature = "zfuture")] #[cfg(feature = "zfuture")]
@ -53,7 +53,7 @@ proptest! {
#[test] #[test]
#[ignore] #[ignore]
fn tx_serialization_roundtrip_sprout(tx in arb_tx(BranchId::Sprout)) { fn tx_serialization_roundtrip_sprout(tx in arb_tx(BranchId::Sprout)) {
check_roundtrip(BranchId::Sprout, tx)?; check_roundtrip(tx)?;
} }
} }
@ -61,7 +61,7 @@ proptest! {
#[test] #[test]
#[ignore] #[ignore]
fn tx_serialization_roundtrip_overwinter(tx in arb_tx(BranchId::Overwinter)) { fn tx_serialization_roundtrip_overwinter(tx in arb_tx(BranchId::Overwinter)) {
check_roundtrip(BranchId::Overwinter, tx)?; check_roundtrip(tx)?;
} }
} }
@ -69,7 +69,7 @@ proptest! {
#[test] #[test]
#[ignore] #[ignore]
fn tx_serialization_roundtrip_sapling(tx in arb_tx(BranchId::Sapling)) { fn tx_serialization_roundtrip_sapling(tx in arb_tx(BranchId::Sapling)) {
check_roundtrip(BranchId::Sapling, tx)?; check_roundtrip(tx)?;
} }
} }
@ -77,7 +77,7 @@ proptest! {
#[test] #[test]
#[ignore] #[ignore]
fn tx_serialization_roundtrip_blossom(tx in arb_tx(BranchId::Blossom)) { fn tx_serialization_roundtrip_blossom(tx in arb_tx(BranchId::Blossom)) {
check_roundtrip(BranchId::Blossom, tx)?; check_roundtrip(tx)?;
} }
} }
@ -85,7 +85,7 @@ proptest! {
#[test] #[test]
#[ignore] #[ignore]
fn tx_serialization_roundtrip_heartwood(tx in arb_tx(BranchId::Heartwood)) { fn tx_serialization_roundtrip_heartwood(tx in arb_tx(BranchId::Heartwood)) {
check_roundtrip(BranchId::Heartwood, tx)?; check_roundtrip(tx)?;
} }
} }
@ -93,7 +93,7 @@ proptest! {
#![proptest_config(ProptestConfig::with_cases(10))] #![proptest_config(ProptestConfig::with_cases(10))]
#[test] #[test]
fn tx_serialization_roundtrip_canopy(tx in arb_tx(BranchId::Canopy)) { fn tx_serialization_roundtrip_canopy(tx in arb_tx(BranchId::Canopy)) {
check_roundtrip(BranchId::Canopy, tx)?; check_roundtrip(tx)?;
} }
} }
@ -101,7 +101,7 @@ proptest! {
#![proptest_config(ProptestConfig::with_cases(10))] #![proptest_config(ProptestConfig::with_cases(10))]
#[test] #[test]
fn tx_serialization_roundtrip_nu5(tx in arb_tx(BranchId::Nu5)) { fn tx_serialization_roundtrip_nu5(tx in arb_tx(BranchId::Nu5)) {
check_roundtrip(BranchId::Nu5, tx)?; check_roundtrip(tx)?;
} }
} }
@ -110,7 +110,7 @@ proptest! {
#[test] #[test]
#[ignore] #[ignore]
fn tx_serialization_roundtrip_future(tx in arb_tx(BranchId::ZFuture)) { fn tx_serialization_roundtrip_future(tx in arb_tx(BranchId::ZFuture)) {
check_roundtrip(BranchId::ZFuture, tx)?; check_roundtrip(tx)?;
} }
} }