mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-02-01 08:12:14 +00:00
Pass &impl TxProver to Builder::build
This allows the caller to build multiple transactions with a single proving backend.
This commit is contained in:
parent
76e0f658c1
commit
2d30c29d06
@ -435,7 +435,7 @@ impl<R: RngCore + CryptoRng> Builder<R> {
|
||||
pub fn build(
|
||||
mut self,
|
||||
consensus_branch_id: consensus::BranchId,
|
||||
prover: impl TxProver,
|
||||
prover: &impl TxProver,
|
||||
) -> Result<(Transaction, TransactionMetadata), Error> {
|
||||
let mut tx_metadata = TransactionMetadata::new();
|
||||
|
||||
@ -558,7 +558,7 @@ impl<R: RngCore + CryptoRng> Builder<R> {
|
||||
// Record the post-randomized output location
|
||||
tx_metadata.output_indices[pos] = i;
|
||||
|
||||
output.build(&prover, &mut ctx, &mut self.rng)
|
||||
output.build(prover, &mut ctx, &mut self.rng)
|
||||
} else {
|
||||
// This is a dummy output
|
||||
let (dummy_to, dummy_note) = {
|
||||
@ -718,7 +718,7 @@ mod tests {
|
||||
{
|
||||
let builder = Builder::new(0);
|
||||
assert_eq!(
|
||||
builder.build(consensus::BranchId::Sapling, MockTxProver),
|
||||
builder.build(consensus::BranchId::Sapling, &MockTxProver),
|
||||
Err(Error::ChangeIsNegative(Amount::from_i64(-10000).unwrap()))
|
||||
);
|
||||
}
|
||||
@ -740,7 +740,7 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
builder.build(consensus::BranchId::Sapling, MockTxProver),
|
||||
builder.build(consensus::BranchId::Sapling, &MockTxProver),
|
||||
Err(Error::ChangeIsNegative(Amount::from_i64(-60000).unwrap()))
|
||||
);
|
||||
}
|
||||
@ -756,7 +756,7 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
builder.build(consensus::BranchId::Sapling, MockTxProver),
|
||||
builder.build(consensus::BranchId::Sapling, &MockTxProver),
|
||||
Err(Error::ChangeIsNegative(Amount::from_i64(-60000).unwrap()))
|
||||
);
|
||||
}
|
||||
@ -796,7 +796,7 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
builder.build(consensus::BranchId::Sapling, MockTxProver),
|
||||
builder.build(consensus::BranchId::Sapling, &MockTxProver),
|
||||
Err(Error::ChangeIsNegative(Amount::from_i64(-1).unwrap()))
|
||||
);
|
||||
}
|
||||
@ -835,7 +835,7 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
builder.build(consensus::BranchId::Sapling, MockTxProver),
|
||||
builder.build(consensus::BranchId::Sapling, &MockTxProver),
|
||||
Err(Error::BindingSig)
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user