Skip to content

zcash_client_backend: Fix tor::Client::create argument #1703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions zcash_client_backend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ and this library adheres to Rust's notion of
- Migrated to `bip32 =0.6.0-pre.1`, `nonempty 0.11`, `incrementalmerkletree 0.8`,
`shardtree 0.6`.
- `zcash_client_backend::tor`:
- `tor::Client::create` now takes an optional `with_permissions` argument for
configuring `fs_mistrust::Mistrust`.
- `tor::Client::create` now takes a `with_permissions` argument for configuring
`fs_mistrust::Mistrust`. If you don't need to configure it, pass `|_| ()`
(the empty closure).
- `zcash_client_backend::wallet::Recipient` has changed:
- The `Recipient::External` variant is now a structured variant.
- The `Recipient::EphemeralTransparent` variant is now only available if
Expand Down
13 changes: 6 additions & 7 deletions zcash_client_backend/src/tor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ impl Client {
/// Preserving the contents of this directory will speed up subsequent calls to
/// `Client::create`.
///
/// If `with_permissions` is `None`, the default from [`arti_client`] will be used
/// (enable permissions checks unless the `ARTI_FS_DISABLE_PERMISSION_CHECKS` env
/// variable is set).
/// If the `with_permissions` closure does not make any changes (e.g. is
/// passed as `|_| {}`), the default from [`arti_client`] will be used.
/// This default will enable permissions checks unless the
/// `ARTI_FS_DISABLE_PERMISSION_CHECKS` env variable is set.
///
/// Returns an error if `tor_dir` does not exist, or if bootstrapping fails.
pub async fn create(
tor_dir: &Path,
with_permissions: Option<impl FnOnce(&mut fs_mistrust::MistrustBuilder)>,
with_permissions: impl FnOnce(&mut fs_mistrust::MistrustBuilder),
) -> Result<Self, Error> {
let runtime = PreferredRuntime::current()?;

Expand All @@ -44,9 +45,7 @@ impl Client {
tor_dir.join("arti-cache"),
);

if let Some(f) = with_permissions {
f(config_builder.storage().permissions());
}
with_permissions(config_builder.storage().permissions());

let config = config_builder
.build()
Expand Down
Loading