diff --git a/zebra-chain/src/primitives/zcash_primitives.rs b/zebra-chain/src/primitives/zcash_primitives.rs index 21ffeead609..149ca423cd4 100644 --- a/zebra-chain/src/primitives/zcash_primitives.rs +++ b/zebra-chain/src/primitives/zcash_primitives.rs @@ -220,6 +220,8 @@ impl<'a> PrecomputedTxData<'a> { /// # Panics /// /// - If `tx` can't be converted to its `librustzcash` equivalent. + /// - If `nu` doesn't contain a consensus branch id convertible to its `librustzcash` + /// equivalent. /// /// # Consensus /// diff --git a/zebra-chain/src/transaction.rs b/zebra-chain/src/transaction.rs index f7cc72045fc..025bd22881d 100644 --- a/zebra-chain/src/transaction.rs +++ b/zebra-chain/src/transaction.rs @@ -216,6 +216,10 @@ impl Transaction { /// - if called on a v1 or v2 transaction /// - if the input index points to a transparent::Input::CoinBase /// - if the input index is out of bounds for self.inputs() + /// - if the tx contains `nConsensusBranchId` field and `nu` doesn't match it + /// - if the tx is not convertible to its `librustzcash` equivalent + /// - if `nu` doesn't contain a consensus branch id convertible to its `librustzcash` + /// equivalent pub fn sighash( &self, nu: NetworkUpgrade, diff --git a/zebra-chain/src/transaction/sighash.rs b/zebra-chain/src/transaction/sighash.rs index 4738a77bc06..c2460a7101c 100644 --- a/zebra-chain/src/transaction/sighash.rs +++ b/zebra-chain/src/transaction/sighash.rs @@ -48,6 +48,14 @@ pub struct SigHasher<'a> { impl<'a> SigHasher<'a> { /// Create a new SigHasher for the given transaction. + /// + /// # Panics + /// + /// - If `trans` can't be converted to its `librustzcash` equivalent. This could happen, for + /// example, if `trans` contains the `nConsensusBranchId` field, and `nu` doesn't match it. + /// More details in [`PrecomputedTxData::new`]. + /// - If `nu` doesn't contain a consensus branch id convertible to its `librustzcash` + /// equivalent. pub fn new( trans: &'a Transaction, nu: NetworkUpgrade,