forked from zcash/librustzcash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zcash_client_backend: Factor out input source traits from
WalletRead
Prior to this change, it's necessary to implement the entirety of the `WalletRead` trait in order to be able to use the input selection functionality provided by `zcash_client_backend::data_api::input_selection`. This change factors out the minimal operations required for transaction proposal construction to better reflect the principle of least authority and make the input selection code reusable in more contexts. In order to minimize the operations of the newly-created `InputSource` and `ShieldingSource` traits, this change also removes the `min_confirmations` field from transaction proposals, in favor of storing explicit target and anchor heights. This has the effect of limiting the lifetime of transaction proposals to `PRUNING_DEPTH - min_confirmations` blocks. Added ----- - `zcash_client_backend::data_api::TransparentInputSource` - `zcash_client_backend::data_api::SaplingInputSource` - `zcash_client_backend::data_api::wallet::input_selection::SaplingInputs` - `zcash_client_backend::data_api::wallet::input_selection::ShieldingSelector` has been factored out from the `InputSelector` trait to separate out transparent functionality and move it behind the `transparent-inputs` feature flag. Changed ------- - In order to support better reusability for input selection code, three new supertraits have been factored out from `zcash_client_backend::data_api::WalletRead`: - `zcash_client_backend::data_api::TransparentInputSource` - `zcash_client_backend::data_api::SaplingInputSource` - `zcash_client_backend::data_api::wallet::input_selection::InputSelector::propose_shielding`, has been moved out to the newly-created `ShieldingSelector` trait. - The `zcash_client_backend::data_api::wallet::input_selection::InputSelector::DataSource` associated type has been renamed to `InputSource`. - The signature of `InputSelector::propose_transaction` has been altered such that it longer takes `min_confirmations` as an argument, instead taking explicit `target_height` and `anchor_height` arguments. This helps to minimize the set of capabilities that the `data_api::SaplingInputSource` must expose. - `ShieldingSelector::propose_shielding` has been altered such that it takes an explicit `target_height` in order to minimize the capabilities that the `data_api::TransparentInputSource` trait must expose. Also, it now takes its `min_confirmations` argument as `u32` instead of `NonZeroU32`. - `zcash_client_backend::data_api::wallet::{propose_shielding, shield_transparent_funds}` now takes their `min_confirmations` arguments as `u32` rather than a `NonZeroU32` to permit implmentations to enable zero-conf shielding. - `zcash_client_backend::data_api::wallet::create_proposed_transaction` now forces implementations to ignore the database identifiers for its contained notes by universally quantifying the `NoteRef` type parameter. - `zcash_client_backend::data_api::wallet::input_selection::Proposal::sapling_inputs` now returns type `Option<&SaplingInputs>`. - `zcash_client_backend::data_api::wallet::input_selection::Proposal::min_anchor_height` has been removed in favor of storing this value in `SaplingInputs`. - `zcash_client_backend::data_api::wallet::input_selection::GreedyInputSelector` now has relaxed requirements for its `InputSource` associated type. Removed ------- - `zcash_client_backend::data_api::WalletRead::get_spendable_sapling_notes` has been removed without replacement as it was unused, and its functionality will be fully reproduced by `SaplingInputSource::select_spendable_sapling_notes` in a future change.
- Loading branch information
Showing
14 changed files
with
399 additions
and
422 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.