Skip to content

Commit 90e80f2

Browse files
committed
finished cleaning up public API
1 parent 07f5bcc commit 90e80f2

33 files changed

+119
-1345
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ enum_dispatch = "0.3"
4848
ff = "0.13"
4949
futures = "0.3"
5050
futures-util = "0.3"
51-
getset = "0.1"
5251
group = "0.13"
5352
hex = "0.4"
5453
http = "1"

libtonode-tests/tests/concrete.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,24 +2224,24 @@ mod slow {
22242224
dbg!(wallet.sync_state.wallet_height());
22252225
dbg!(wallet
22262226
.shard_trees
2227-
.sapling()
2227+
.sapling
22282228
.store()
22292229
.max_checkpoint_id()
22302230
.unwrap());
22312231
dbg!(wallet
22322232
.shard_trees
2233-
.orchard()
2233+
.orchard
22342234
.store()
22352235
.max_checkpoint_id()
22362236
.unwrap());
22372237
dbg!(wallet
22382238
.shard_trees
2239-
.sapling()
2239+
.sapling
22402240
.root_at_checkpoint_id(&3.into())
22412241
.unwrap());
22422242
dbg!(wallet
22432243
.shard_trees
2244-
.orchard()
2244+
.orchard
22452245
.root_at_checkpoint_id(&3.into())
22462246
.unwrap());
22472247
drop(wallet);

zingo-sync/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ memuse.workspace = true
4242
crossbeam-channel.workspace = true
4343
rayon.workspace = true
4444

45-
# Minimise boilerplate
46-
getset.workspace = true
47-
4845
# Error handling
4946
thiserror.workspace = true
5047

zingo-sync/src/client.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ use zcash_primitives::{
1919
transaction::{Transaction, TxId},
2020
};
2121

22-
pub mod fetch;
22+
pub(crate) mod fetch;
2323

2424
/// Fetch requests are created and sent to the [`crate::client::fetch::fetch`] task when a connection to the server is required.
2525
///
2626
/// Each variant includes a [`tokio::sync::oneshot::Sender`] for returning the fetched data to the requester.
2727
#[derive(Debug)]
28-
pub enum FetchRequest {
28+
pub(crate) enum FetchRequest {
2929
/// Gets the height of the blockchain from the server.
3030
ChainTip(oneshot::Sender<BlockId>),
3131
/// Gets the specified range of compact blocks from the server (end exclusive).
@@ -38,6 +38,7 @@ pub enum FetchRequest {
3838
/// Get a full transaction by txid.
3939
Transaction(oneshot::Sender<(Transaction, BlockHeight)>, TxId),
4040
/// Get a list of unspent transparent output metadata for a given list of transparent addresses and start height.
41+
#[allow(dead_code)]
4142
UtxoMetadata(
4243
oneshot::Sender<Vec<GetAddressUtxosReply>>,
4344
(Vec<String>, BlockHeight),
@@ -59,7 +60,7 @@ pub enum FetchRequest {
5960
/// Gets the height of the blockchain from the server.
6061
///
6162
/// Requires [`crate::client::fetch::fetch`] to be running concurrently, connected via the `fetch_request` channel.
62-
pub async fn get_chain_height(
63+
pub(crate) async fn get_chain_height(
6364
fetch_request_sender: UnboundedSender<FetchRequest>,
6465
) -> Result<BlockHeight, ()> {
6566
let (reply_sender, reply_receiver) = oneshot::channel();
@@ -74,7 +75,7 @@ pub async fn get_chain_height(
7475
/// Gets the specified range of compact blocks from the server (end exclusive).
7576
///
7677
/// Requires [`crate::client::fetch::fetch`] to be running concurrently, connected via the `fetch_request` channel.
77-
pub async fn get_compact_block_range(
78+
pub(crate) async fn get_compact_block_range(
7879
fetch_request_sender: UnboundedSender<FetchRequest>,
7980
block_range: Range<BlockHeight>,
8081
) -> Result<tonic::Streaming<CompactBlock>, ()> {
@@ -91,7 +92,7 @@ pub async fn get_compact_block_range(
9192
/// from the server.
9293
///
9394
/// Requires [`crate::client::fetch::fetch`] to be running concurrently, connected via the `fetch_request` channel.
94-
pub async fn get_subtree_roots(
95+
pub(crate) async fn get_subtree_roots(
9596
fetch_request_sender: UnboundedSender<FetchRequest>,
9697
start_index: u32,
9798
shielded_protocol: i32,
@@ -118,7 +119,7 @@ pub async fn get_subtree_roots(
118119
/// Gets the frontiers for a specified block height.
119120
///
120121
/// Requires [`crate::client::fetch::fetch`] to be running concurrently, connected via the `fetch_request` channel.
121-
pub async fn get_frontiers(
122+
pub(crate) async fn get_frontiers(
122123
fetch_request_sender: UnboundedSender<FetchRequest>,
123124
block_height: BlockHeight,
124125
) -> Result<ChainState, ()> {
@@ -135,7 +136,7 @@ pub async fn get_frontiers(
135136
/// Gets a full transaction for a specified txid.
136137
///
137138
/// Requires [`crate::client::fetch::fetch`] to be running concurrently, connected via the `fetch_request` channel.
138-
pub async fn get_transaction_and_block_height(
139+
pub(crate) async fn get_transaction_and_block_height(
139140
fetch_request_sender: UnboundedSender<FetchRequest>,
140141
txid: TxId,
141142
) -> Result<(Transaction, BlockHeight), ()> {
@@ -151,7 +152,8 @@ pub async fn get_transaction_and_block_height(
151152
/// Gets unspent transparent output metadata for a list of `transparent addresses` from the specified `start_height`.
152153
///
153154
/// Requires [`crate::client::fetch::fetch`] to be running concurrently, connected via the `fetch_request` channel.
154-
pub async fn get_utxo_metadata(
155+
#[allow(dead_code)]
156+
pub(crate) async fn get_utxo_metadata(
155157
fetch_request_sender: UnboundedSender<FetchRequest>,
156158
transparent_addresses: Vec<String>,
157159
start_height: BlockHeight,
@@ -175,7 +177,7 @@ pub async fn get_utxo_metadata(
175177
/// Gets transactions relevant to a given `transparent address` in the specified `block_range`.
176178
///
177179
/// Requires [`crate::client::fetch::fetch`] to be running concurrently, connected via the `fetch_request` channel.
178-
pub async fn get_transparent_address_transactions(
180+
pub(crate) async fn get_transparent_address_transactions(
179181
fetch_request_sender: UnboundedSender<FetchRequest>,
180182
transparent_address: String,
181183
block_range: Range<BlockHeight>,
@@ -193,7 +195,7 @@ pub async fn get_transparent_address_transactions(
193195
}
194196

195197
/// Gets stream of mempool transactions until the next block is mined.
196-
pub async fn get_mempool_transaction_stream(
198+
pub(crate) async fn get_mempool_transaction_stream(
197199
client: &mut CompactTxStreamerClient<zingo_netutils::UnderlyingService>,
198200
) -> Result<tonic::Streaming<RawTransaction>, ()> {
199201
tracing::debug!("Fetching mempool stream");

zingo-sync/src/client/fetch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use crate::client::FetchRequest;
2525
///
2626
/// Allows all requests to the server to be handled from a single task for efficiency and also enables
2727
/// request prioritisation for further performance enhancement
28-
pub async fn fetch(
28+
pub(crate) async fn fetch(
2929
mut fetch_request_receiver: UnboundedReceiver<FetchRequest>,
3030
mut client: CompactTxStreamerClient<zingo_netutils::UnderlyingService>,
3131
consensus_parameters: impl consensus::Parameters,

zingo-sync/src/keys.rs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use std::collections::HashMap;
44

5-
use getset::Getters;
65
use incrementalmerkletree::Position;
76
use orchard::{
87
keys::{FullViewingKey, IncomingViewingKey},
@@ -13,6 +12,7 @@ use sapling_crypto::{
1312
};
1413
use zcash_keys::keys::UnifiedFullViewingKey;
1514
use zcash_note_encryption::Domain;
15+
use zcash_primitives::consensus;
1616
use zip32::Scope;
1717

1818
/// Child index for the `address_index` path level in the BIP44 hierarchy.
@@ -135,11 +135,9 @@ impl ScanningKeyOps<OrchardDomain, orchard::note::Nullifier>
135135
}
136136

137137
/// A set of keys to be used in scanning for decryptable transaction outputs.
138-
#[derive(Getters)]
139-
#[getset(get = "pub(crate)")]
140138
pub(crate) struct ScanningKeys {
141-
sapling: HashMap<KeyId, ScanningKey<SaplingIvk, NullifierDerivingKey>>,
142-
orchard: HashMap<KeyId, ScanningKey<IncomingViewingKey, FullViewingKey>>,
139+
pub(crate) sapling: HashMap<KeyId, ScanningKey<SaplingIvk, NullifierDerivingKey>>,
140+
pub(crate) orchard: HashMap<KeyId, ScanningKey<IncomingViewingKey, FullViewingKey>>,
143141
}
144142

145143
impl ScanningKeys {
@@ -188,3 +186,18 @@ impl ScanningKeys {
188186
Self { sapling, orchard }
189187
}
190188
}
189+
190+
pub(crate) fn encode_orchard_receiver(
191+
parameters: &impl consensus::Parameters,
192+
orchard_address: &orchard::Address,
193+
) -> Result<String, ()> {
194+
Ok(zcash_address::unified::Encoding::encode(
195+
&<zcash_address::unified::Address as zcash_address::unified::Encoding>::try_from_items(
196+
vec![zcash_address::unified::Receiver::Orchard(
197+
orchard_address.to_raw_address_bytes(),
198+
)],
199+
)
200+
.unwrap(),
201+
&parameters.network_type(),
202+
))
203+
}

zingo-sync/src/keys/transparent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub struct TransparentAddressId {
2424

2525
impl TransparentAddressId {
2626
/// Construct from parts
27-
pub fn from_parts(
27+
pub fn new(
2828
account_id: zcash_primitives::zip32::AccountId,
2929
scope: TransparentScope,
3030
address_index: AddressIndex,

zingo-sync/src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
//! of the previous sync, before the server is contacted to update the wallet height to the new chain height.
1616
//! Fully scanned height - block height in which the wallet has completed scanning all blocks equal to and below this height.
1717
18-
pub mod client;
18+
pub(crate) mod client;
1919
pub mod error;
2020
pub mod keys;
21-
#[allow(missing_docs)]
22-
pub mod primitives;
2321
pub(crate) mod scan;
2422
pub mod sync;
25-
pub mod traits;
26-
pub(crate) mod utils;
27-
pub mod witness;
23+
pub mod wallet;
24+
pub(crate) mod witness;
2825

2926
pub use sync::scan_pending_transaction;
3027
pub use sync::sync;

0 commit comments

Comments
 (0)