File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,9 @@ impl MerkleNote {
285
285
}
286
286
287
287
#[ cfg( feature = "transaction-proofs" ) ]
288
- pub ( crate ) fn sapling_auth_path ( witness : & dyn WitnessTrait ) -> Vec < Option < ( Scalar , bool ) > > {
288
+ pub ( crate ) fn sapling_auth_path < W : WitnessTrait + ?Sized > (
289
+ witness : & W ,
290
+ ) -> Vec < Option < ( Scalar , bool ) > > {
289
291
let mut auth_path = vec ! [ ] ;
290
292
for element in & witness. get_auth_path ( ) {
291
293
let sapling_element = match element {
@@ -305,7 +307,7 @@ pub(crate) fn sapling_auth_path(witness: &dyn WitnessTrait) -> Vec<Option<(Scala
305
307
/// like making Witness a trait since it's otherwise very simple.
306
308
/// So this hacky function gets to live here.
307
309
#[ cfg( feature = "transaction-proofs" ) ]
308
- pub ( crate ) fn position ( witness : & dyn WitnessTrait ) -> u64 {
310
+ pub ( crate ) fn position < W : WitnessTrait + ? Sized > ( witness : & W ) -> u64 {
309
311
let mut pos = 0 ;
310
312
for ( i, element) in witness. get_auth_path ( ) . iter ( ) . enumerate ( ) {
311
313
if let WitnessNode :: Right ( _) = element {
Original file line number Diff line number Diff line change @@ -102,10 +102,10 @@ impl ProposedTransaction {
102
102
}
103
103
104
104
/// Spend the note owned by spender_key at the given witness location.
105
- pub fn add_spend (
105
+ pub fn add_spend < W : WitnessTrait + ? Sized > (
106
106
& mut self ,
107
107
note : Note ,
108
- witness : & dyn WitnessTrait ,
108
+ witness : & W ,
109
109
) -> Result < ( ) , IronfishError > {
110
110
self . value_balances
111
111
. add ( note. asset_id ( ) , note. value ( ) . try_into ( ) ?) ?;
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ impl SpendBuilder {
68
68
/// This is the only time this API thinks about the merkle tree. The witness
69
69
/// contains the root-hash at the time the witness was created and the path
70
70
/// to verify the location of that note in the tree.
71
- pub ( crate ) fn new ( note : Note , witness : & dyn WitnessTrait ) -> Self {
71
+ pub ( crate ) fn new < W : WitnessTrait + ? Sized > ( note : Note , witness : & W ) -> Self {
72
72
let value_commitment = ValueCommitment :: new ( note. value , note. asset_generator ( ) ) ;
73
73
74
74
SpendBuilder {
You can’t perform that action at this time.
0 commit comments