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

update name from do_list_txsummaries to list_txsummaries #1144

Merged
merged 1 commit into from
May 27, 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
40 changes: 20 additions & 20 deletions darkside-tests/tests/advanced_reorg_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async fn reorg_changes_incoming_tx_height() {
}
);

let before_reorg_transactions = light_client.do_list_txsummaries().await;
let before_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(before_reorg_transactions.len(), 1);
assert_eq!(
Expand Down Expand Up @@ -91,7 +91,7 @@ async fn reorg_changes_incoming_tx_height() {
}
);

let after_reorg_transactions = light_client.do_list_txsummaries().await;
let after_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(after_reorg_transactions.len(), 1);
assert_eq!(
Expand Down Expand Up @@ -211,7 +211,7 @@ async fn reorg_changes_incoming_tx_index() {
}
);

let before_reorg_transactions = light_client.do_list_txsummaries().await;
let before_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(before_reorg_transactions.len(), 1);
assert_eq!(
Expand Down Expand Up @@ -246,7 +246,7 @@ async fn reorg_changes_incoming_tx_index() {
}
);

let after_reorg_transactions = light_client.do_list_txsummaries().await;
let after_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(after_reorg_transactions.len(), 1);
assert_eq!(
Expand Down Expand Up @@ -366,7 +366,7 @@ async fn reorg_expires_incoming_tx() {
}
);

let before_reorg_transactions = light_client.do_list_txsummaries().await;
let before_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(before_reorg_transactions.len(), 1);
assert_eq!(
Expand Down Expand Up @@ -401,7 +401,7 @@ async fn reorg_expires_incoming_tx() {
}
);

let after_reorg_transactions = light_client.do_list_txsummaries().await;
let after_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(after_reorg_transactions.len(), 0);
}
Expand Down Expand Up @@ -543,7 +543,7 @@ async fn reorg_changes_outgoing_tx_height() {
}
);

let before_reorg_transactions = light_client.do_list_txsummaries().await;
let before_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(before_reorg_transactions.len(), 1);
assert_eq!(
Expand Down Expand Up @@ -592,11 +592,11 @@ async fn reorg_changes_outgoing_tx_height() {
// check that the outgoing transaction has the correct height before
// the reorg is triggered

println!("{:?}", light_client.do_list_txsummaries().await);
println!("{:?}", light_client.list_txsummaries().await);

assert_eq!(
light_client
.do_list_txsummaries()
.list_txsummaries()
.await
.into_iter()
.find_map(|v| match v.kind {
Expand Down Expand Up @@ -652,11 +652,11 @@ async fn reorg_changes_outgoing_tx_height() {
expected_after_reorg_balance
);

let after_reorg_transactions = light_client.do_list_txsummaries().await;
let after_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(after_reorg_transactions.len(), 3);

println!("{:?}", light_client.do_list_txsummaries().await);
println!("{:?}", light_client.list_txsummaries().await);

// FIXME: This test is broken because if this issue
// https://github.com/zingolabs/zingolib/issues/622
Expand Down Expand Up @@ -778,7 +778,7 @@ async fn reorg_expires_outgoing_tx_height() {
light_client.do_sync(true).await.unwrap();
assert_eq!(light_client.do_balance().await, expected_initial_balance);

let before_reorg_transactions = light_client.do_list_txsummaries().await;
let before_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(before_reorg_transactions.len(), 1);
assert_eq!(
Expand Down Expand Up @@ -820,11 +820,11 @@ async fn reorg_expires_outgoing_tx_height() {
// check that the outgoing transaction has the correct height before
// the reorg is triggered

println!("{:?}", light_client.do_list_txsummaries().await);
println!("{:?}", light_client.list_txsummaries().await);

assert_eq!(
light_client
.do_list_txsummaries()
.list_txsummaries()
.await
.into_iter()
.find_map(|v| match v.kind {
Expand Down Expand Up @@ -863,11 +863,11 @@ async fn reorg_expires_outgoing_tx_height() {
// sent transaction was never mined and has expired.
assert_eq!(light_client.do_balance().await, expected_initial_balance);

let after_reorg_transactions = light_client.do_list_txsummaries().await;
let after_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(after_reorg_transactions.len(), 1);

println!("{:?}", light_client.do_list_txsummaries().await);
println!("{:?}", light_client.list_txsummaries().await);

// FIXME: This test is broken because if this issue
// https://github.com/zingolabs/zingolib/issues/622
Expand Down Expand Up @@ -955,7 +955,7 @@ async fn reorg_changes_outgoing_tx_index() {
}
);

let before_reorg_transactions = light_client.do_list_txsummaries().await;
let before_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(before_reorg_transactions.len(), 1);
assert_eq!(
Expand Down Expand Up @@ -1004,11 +1004,11 @@ async fn reorg_changes_outgoing_tx_index() {
// check that the outgoing transaction has the correct height before
// the reorg is triggered

println!("{:?}", light_client.do_list_txsummaries().await);
println!("{:?}", light_client.list_txsummaries().await);

assert_eq!(
light_client
.do_list_txsummaries()
.list_txsummaries()
.await
.into_iter()
.find_map(|v| match v.kind {
Expand Down Expand Up @@ -1070,7 +1070,7 @@ async fn reorg_changes_outgoing_tx_index() {
expected_after_reorg_balance
);

let after_reorg_transactions = light_client.do_list_txsummaries().await;
let after_reorg_transactions = light_client.list_txsummaries().await;

assert_eq!(after_reorg_transactions.len(), 3);

Expand Down
4 changes: 2 additions & 2 deletions darkside-tests/tests/network_interruption_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async fn shielded_note_marked_as_change_test() {
json::stringify_pretty(scenario.get_lightclient(0).do_list_notes(true).await, 4)
);
println!("do list tx summaries:");
dbg!(scenario.get_lightclient(0).do_list_txsummaries().await);
dbg!(scenario.get_lightclient(0).list_txsummaries().await);

// assert the balance is correct
assert_eq!(
Expand All @@ -222,7 +222,7 @@ async fn shielded_note_marked_as_change_test() {
}
}
// assert all fees are 10000 zats
let value_transfers = scenario.get_lightclient(0).do_list_txsummaries().await;
let value_transfers = scenario.get_lightclient(0).list_txsummaries().await;
for value_transfer in &value_transfers {
if let ValueTransferKind::Fee { amount } = value_transfer.kind {
assert_eq!(amount, 10_000)
Expand Down
12 changes: 6 additions & 6 deletions integration-tests/tests/libtonode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ mod slow {
);
println!(
"{}",
JsonValue::from(recipient.do_list_txsummaries().await).pretty(4)
JsonValue::from(recipient.list_txsummaries().await).pretty(4)
);
}
#[tokio::test]
Expand Down Expand Up @@ -1299,7 +1299,7 @@ mod slow {
"{}",
JsonValue::from(
recipient
.do_list_txsummaries()
.list_txsummaries()
.await
.into_iter()
.map(JsonValue::from)
Expand All @@ -1317,7 +1317,7 @@ mod slow {
"{}",
JsonValue::from(
recipient
.do_list_txsummaries()
.list_txsummaries()
.await
.into_iter()
.map(JsonValue::from)
Expand Down Expand Up @@ -1703,7 +1703,7 @@ mod slow {

println!(
"{}",
JsonValue::from(faucet.do_list_txsummaries().await).pretty(4)
JsonValue::from(faucet.list_txsummaries().await).pretty(4)
);
println!(
"{}",
Expand Down Expand Up @@ -2461,10 +2461,10 @@ mod slow {
.await
.unwrap();
let pre_rescan_transactions = recipient.do_list_transactions().await;
let pre_rescan_summaries = recipient.do_list_txsummaries().await;
let pre_rescan_summaries = recipient.list_txsummaries().await;
recipient.do_rescan().await.unwrap();
let post_rescan_transactions = recipient.do_list_transactions().await;
let post_rescan_summaries = recipient.do_list_txsummaries().await;
let post_rescan_summaries = recipient.list_txsummaries().await;
assert_eq!(pre_rescan_transactions, post_rescan_transactions);
assert_eq!(pre_rescan_summaries, post_rescan_summaries);
let mut outgoing_metadata = pre_rescan_transactions
Expand Down
6 changes: 3 additions & 3 deletions zingo-testutils/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ macro_rules! check_client_balances {
($client:ident, o: $orchard:tt s: $sapling:tt t: $transparent:tt) => {
let balance = $client.do_balance().await;
let tx_summary_balance = $client
.do_list_txsummaries()
.list_txsummaries()
.await
.iter()
.map(|transfer| transfer.balance_delta())
Expand All @@ -36,8 +36,8 @@ macro_rules! check_client_balances {
+ balance.transparent_balance.unwrap_or(0)) as i64,
tx_summary_balance,
"tx_summaries follow: {}\ndo_list_transactions follow: {}",
::json::JsonValue::from($client.do_list_txsummaries().await).pretty(4),
::json::JsonValue::from($client.do_list_txsummaries().await).pretty(4)
::json::JsonValue::from($client.list_txsummaries().await).pretty(4),
::json::JsonValue::from($client.do_list_transactions().await).pretty(4)
);
assert_eq!(
balance.orchard_balance.unwrap(),
Expand Down
1 change: 1 addition & 0 deletions zingolib/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `lightclient::LightClient`:
- `do_send` inputs from `Vec<(&str, u64, Option<MemoBytes>)>` to `Vec<(Address, NonNegativeAmount, Option<MemoBytes>)>`
- `do_shield` inputs from `Option<String>` to `Option<Address>`
- `do_list_txsummaries` --> `list_txsummaries`

- `TxMapAndMaybeTrees::A --> TransactionRecordsById::A` where A:
- add_new_note<D>
Expand Down
6 changes: 3 additions & 3 deletions zingolib/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1285,9 +1285,9 @@ impl Command for ValueTxSummariesCommand {
return format!("Didn't understand arguments\n{}", self.help());
}

RT.block_on(async move {
json::JsonValue::from(lightclient.do_list_txsummaries().await).pretty(2)
})
RT.block_on(
async move { json::JsonValue::from(lightclient.list_txsummaries().await).pretty(2) },
)
}
}

Expand Down
6 changes: 3 additions & 3 deletions zingolib/src/lightclient/describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl LightClient {
}

/// TODO: Add Doc Comment Here!
pub async fn do_list_txsummaries(&self) -> Vec<ValueTransfer> {
pub async fn list_txsummaries(&self) -> Vec<ValueTransfer> {
let mut summaries: Vec<ValueTransfer> = Vec::new();
let transaction_records_by_id = &self
.wallet
Expand Down Expand Up @@ -304,7 +304,7 @@ impl LightClient {

/// TODO: Add Doc Comment Here!
pub async fn do_total_memobytes_to_address(&self) -> finsight::TotalMemoBytesToAddress {
let summaries = self.do_list_txsummaries().await;
let summaries = self.list_txsummaries().await;
let mut memobytes_by_address = HashMap::new();
for summary in summaries {
use ValueTransferKind::*;
Expand Down Expand Up @@ -682,7 +682,7 @@ impl LightClient {
}

async fn value_transfer_by_to_address(&self) -> finsight::ValuesSentToAddress {
let summaries = self.do_list_txsummaries().await;
let summaries = self.list_txsummaries().await;
let mut amount_by_address = HashMap::new();
for summary in summaries {
use ValueTransferKind::*;
Expand Down
Loading