Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: adityapk00/librustzcash
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: zerocurrencycoin/librustzcash
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Jul 13, 2020

  1. use zero consensus ids

    CryptoForge committed Jul 13, 2020
    Copy the full SHA
    1ce4e97 View commit details

Commits on Jul 31, 2020

  1. add set_fee to tx builder

    CryptoForge committed Jul 31, 2020
    Copy the full SHA
    0883d7f View commit details

Commits on Oct 12, 2020

  1. Copy the full SHA
    2981c4d View commit details
Showing with 14 additions and 10 deletions.
  1. +2 −2 zcash_client_backend/src/constants.rs
  2. +4 −4 zcash_primitives/src/consensus.rs
  3. +6 −2 zcash_primitives/src/transaction/builder.rs
  4. +2 −2 zcash_primitives/src/transaction/sighash.rs
4 changes: 2 additions & 2 deletions zcash_client_backend/src/constants.rs
Original file line number Diff line number Diff line change
@@ -5,5 +5,5 @@ pub mod regtest;
pub mod testnet;

pub const SPROUT_CONSENSUS_BRANCH_ID: u32 = 0;
pub const OVERWINTER_CONSENSUS_BRANCH_ID: u32 = 0x5ba8_1b19;
pub const SAPLING_CONSENSUS_BRANCH_ID: u32 = 0x76b8_09bb;
pub const OVERWINTER_CONSENSUS_BRANCH_ID: u32 = 0x6f76_727a;
pub const SAPLING_CONSENSUS_BRANCH_ID: u32 = 0x7361_707a;
8 changes: 4 additions & 4 deletions zcash_primitives/src/consensus.rs
Original file line number Diff line number Diff line change
@@ -135,8 +135,8 @@ impl TryFrom<u32> for BranchId {
fn try_from(value: u32) -> Result<Self, Self::Error> {
match value {
0 => Ok(BranchId::Sprout),
0x5ba8_1b19 => Ok(BranchId::Overwinter),
0x76b8_09bb => Ok(BranchId::Sapling),
0x6f76_727a => Ok(BranchId::Overwinter),
0x7361_707a => Ok(BranchId::Sapling),
0x2bb4_0e60 => Ok(BranchId::Blossom),
0xf5b9_230b => Ok(BranchId::Heartwood),
_ => Err("Unknown consensus branch ID"),
@@ -148,8 +148,8 @@ impl From<BranchId> for u32 {
fn from(consensus_branch_id: BranchId) -> u32 {
match consensus_branch_id {
BranchId::Sprout => 0,
BranchId::Overwinter => 0x5ba8_1b19,
BranchId::Sapling => 0x76b8_09bb,
BranchId::Overwinter => 0x6f76_727a,
BranchId::Sapling => 0x7361_707a,
BranchId::Blossom => 0x2bb4_0e60,
BranchId::Heartwood => 0xf5b9_230b,
}
8 changes: 6 additions & 2 deletions zcash_primitives/src/transaction/builder.rs
Original file line number Diff line number Diff line change
@@ -214,7 +214,7 @@ impl TransparentInputs {
fn apply_signatures(
&self,
mtx: &mut TransactionData,
consensus_branch_id: consensus::BranchId,
consensus_branch_id: u32,
) {
let mut sighash = [0u8; 32];
for (i, info) in self.inputs.iter().enumerate() {
@@ -332,6 +332,10 @@ impl<R: RngCore + CryptoRng> Builder<R> {
}
}

pub fn set_fee(&mut self, fee: Amount) {
self.fee = fee;
}

/// Adds a Sapling note to be spent in this transaction.
///
/// Returns an error if the given Merkle path does not have the same anchor as the
@@ -434,7 +438,7 @@ impl<R: RngCore + CryptoRng> Builder<R> {
/// the network.
pub fn build(
mut self,
consensus_branch_id: consensus::BranchId,
consensus_branch_id: u32,
prover: &impl TxProver,
) -> Result<(Transaction, TransactionMetadata), Error> {
let mut tx_metadata = TransactionMetadata::new();
4 changes: 2 additions & 2 deletions zcash_primitives/src/transaction/sighash.rs
Original file line number Diff line number Diff line change
@@ -152,7 +152,7 @@ fn shielded_outputs_hash(tx: &TransactionData) -> Blake2bHash {

pub fn signature_hash_data(
tx: &TransactionData,
consensus_branch_id: consensus::BranchId,
consensus_branch_id: u32,
hash_type: u32,
transparent_input: Option<(usize, &Script, Amount)>,
) -> Vec<u8> {
@@ -230,7 +230,7 @@ pub fn signature_hash_data(

pub fn signature_hash(
tx: &Transaction,
consensus_branch_id: consensus::BranchId,
consensus_branch_id: u32,
hash_type: u32,
transparent_input: Option<(usize, &Script, Amount)>,
) -> Vec<u8> {