1- use std:: num:: { NonZeroU32 , NonZeroUsize } ;
1+ use std:: num:: NonZeroUsize ;
22
33use bip0039:: { English , Mnemonic } ;
44use nonempty:: NonEmpty ;
@@ -29,7 +29,7 @@ use zcash_address::ZcashAddress;
2929use zcash_client_backend:: data_api:: wallet:: {
3030 create_pczt_from_proposal, create_proposed_transactions,
3131 extract_and_store_transaction_from_pczt, input_selection:: GreedyInputSelector ,
32- propose_shielding, propose_transfer,
32+ propose_shielding, propose_transfer, ConfirmationsPolicy , SpendingKeys ,
3333} ;
3434use zcash_client_backend:: data_api:: {
3535 Account , AccountBirthday , AccountPurpose , InputSource , WalletRead , WalletSummary , WalletWrite ,
@@ -88,7 +88,7 @@ pub struct Wallet<W, T> {
8888 // gRPC client used to connect to a lightwalletd instance for network data
8989 pub ( crate ) client : CompactTxStreamerClient < T > ,
9090 pub ( crate ) network : Network ,
91- pub ( crate ) min_confirmations : NonZeroU32 ,
91+ pub ( crate ) min_confirmations : ConfirmationsPolicy ,
9292 /// Note management: the number of notes to maintain in the wallet
9393 pub ( crate ) target_note_count : usize ,
9494 /// Note management: the minimum allowed value for split change amounts
@@ -154,7 +154,7 @@ where
154154 db : W ,
155155 client : T ,
156156 network : Network ,
157- min_confirmations : NonZeroU32 ,
157+ min_confirmations : ConfirmationsPolicy ,
158158 ) -> Result < Self , Error > {
159159 Ok ( Wallet {
160160 db : Arc :: new ( RwLock :: new ( db) ) ,
@@ -294,7 +294,7 @@ where
294294 . db
295295 . read ( )
296296 . await
297- . get_wallet_summary ( self . min_confirmations . into ( ) ) ?)
297+ . get_wallet_summary ( self . min_confirmations ) ?)
298298 }
299299
300300 ///
@@ -330,7 +330,7 @@ where
330330 self . db
331331 . read( )
332332 . await
333- . get_target_and_anchor_heights( self . min_confirmations) ?
333+ . get_target_and_anchor_heights( self . min_confirmations. trusted ( ) ) ?
334334 ) ;
335335 let mut db = self . db . write ( ) . await ;
336336 let proposal = propose_transfer :: < _ , _ , _ , _ , <W as WalletCommitmentTrees >:: Error > (
@@ -372,7 +372,7 @@ where
372372 & self . network ,
373373 & prover,
374374 & prover,
375- usk,
375+ & SpendingKeys :: from_unified_spending_key ( usk. clone ( ) ) ,
376376 OvkPolicy :: Sender ,
377377 & proposal,
378378 )
@@ -459,7 +459,8 @@ where
459459 }
460460 } ;
461461
462- let transparent_balances = db. get_transparent_balances ( account_id, max_height) ?;
462+ let transparent_balances =
463+ db. get_transparent_balances ( account_id, max_height. into ( ) , self . min_confirmations ) ?;
463464 let from_addrs = transparent_balances. into_keys ( ) . collect :: < Vec < _ > > ( ) ;
464465
465466 let proposal = propose_shielding :: < _ , _ , _ , _ , <W as WalletCommitmentTrees >:: Error > (
@@ -470,7 +471,7 @@ where
470471 SHIELDING_THRESHOLD , // use a shielding threshold above a marginal fee transaction plus some value like Zashi does.
471472 & from_addrs,
472473 account_id,
473- 1 , // librustzcash operates under the assumption of zero or one conf being the same but that could change.
474+ self . min_confirmations , // librustzcash operates under the assumption of zero or one conf being the same but that could change.
474475 )
475476 . map_err ( |e| Error :: Generic ( format ! ( "Error when shielding: {:?}" , e) ) ) ?;
476477
@@ -617,9 +618,8 @@ where
617618 let txid = extract_and_store_transaction_from_pczt :: < _ , ( ) > (
618619 & mut * db,
619620 pczt,
620- & spend_vk,
621- & output_vk,
622- & orchard:: circuit:: VerifyingKey :: build ( ) ,
621+ Some ( ( & spend_vk, & output_vk) ) ,
622+ Some ( & orchard:: circuit:: VerifyingKey :: build ( ) ) ,
623623 )
624624 . map_err ( |e| {
625625 Error :: PcztSend ( format ! (
0 commit comments