Skip to content
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

simplified broadcast fn #1381

Merged
merged 4 commits into from
Sep 11, 2024
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
2 changes: 1 addition & 1 deletion darkside-tests/src/chain_generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub(crate) mod conduct_chain {
//! known issues include
//! - transparent sends do not work
//! - txids are regenerated randomly. zingo can optionally accept_server_txid
//! these tests cannot portray the full range of network weather.
//! - these tests cannot portray the full range of network weather.

use zingolib::lightclient::LightClient;
use zingolib::testutils::chain_generics::conduct_chain::ConductChain;
Expand Down
7 changes: 1 addition & 6 deletions zingolib/src/lightclient/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,7 @@ pub mod send_with_proposal {
.send_to_addresses_inner(
build_result.transaction(),
submission_height,
|transaction_bytes| {
crate::grpc_connector::send_transaction(
self.get_server_uri(),
transaction_bytes,
)
},
self.get_server_uri(),
)
.await
.map_err(CompleteAndBroadcastError::Broadcast)
Expand Down
14 changes: 5 additions & 9 deletions zingolib/src/wallet/send.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//! This mod contains pieces of the impl LightWallet that are invoked during a send.
use crate::wallet::now;

use futures::Future;

use hdwallet::traits::Deserialize as _;
use http::Uri;
use log::error;
use zcash_client_backend::proposal::Proposal;
use zcash_keys::keys::UnifiedSpendingKey;
Expand Down Expand Up @@ -193,16 +192,13 @@ impl LightWallet {
)
}

pub(crate) async fn send_to_addresses_inner<F, Fut>(
pub(crate) async fn send_to_addresses_inner(
&self,
transaction: &Transaction,
submission_height: BlockHeight,
broadcast_fn: F,
server_uri: Uri,
) -> Result<TxId, String>
where
F: Fn(Box<[u8]>) -> Fut,
Fut: Future<Output = Result<String, String>>,
{
where {
{
self.send_progress.write().await.is_send_in_progress = false;
}
Expand All @@ -212,7 +208,7 @@ impl LightWallet {
transaction.write(&mut raw_transaction).unwrap();

let serverz_transaction_id =
broadcast_fn(raw_transaction.clone().into_boxed_slice()).await?;
crate::grpc_connector::send_transaction(server_uri, raw_transaction.into()).await?;

{
let price = self.price.read().await.clone();
Expand Down
Loading