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

Remove inconsistent method #1179

Merged
merged 3 commits into from
Jun 3, 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: 2 additions & 0 deletions zingolib/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `do_save_to_buffer`
- `do_save_to_buffer_sync`
- `fix_spent_at_height`
- `TransactionRecord::net_spent`
- `TransactionRecord::get_transparent_value_spent()`
2 changes: 1 addition & 1 deletion zingolib/src/lightclient/deprecated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl LightClient {

// Get the total transparent value received in this transaction
// Again we see the assumption that utxos are incoming.
let net_transparent_value = total_transparent_received as i64 - wallet_transaction.get_transparent_value_spent() as i64;
let net_transparent_value = total_transparent_received as i64 - wallet_transaction.total_transparent_value_spent as i64;
let address = wallet_transaction.transparent_outputs.iter().map(|utxo| utxo.address.clone()).collect::<Vec<String>>().join(",");
if net_transparent_value > 0 {
if let Some(transaction) = consumer_notes_by_tx.iter_mut().find(|transaction| transaction["txid"] == txid.to_string()) {
Expand Down
16 changes: 2 additions & 14 deletions zingolib/src/wallet/transaction_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,6 @@ impl TransactionRecord {
self.query_sum_value(OutputQuery::any())
}

/// TODO: Add Doc Comment Here!
pub fn get_transparent_value_spent(&self) -> u64 {
self.total_transparent_value_spent
}

/// TODO: Add Doc Comment Here!
#[deprecated(
note = "replaced by `calculate_transaction_fee` method for [`crate::wallet::transaction_records_by_id::TransactionRecordsById`]"
Expand Down Expand Up @@ -270,13 +265,6 @@ impl TransactionRecord {
|| !self.transparent_outputs.is_empty()
}

/// TODO: Add Doc Comment Here!
#[deprecated(note = "unused function with misleading name")]
pub fn net_spent(&self) -> u64 {
assert!(self.is_outgoing_transaction());
self.total_value_spent() - self.total_change_returned()
}

/// TODO: Add Doc Comment Here!
fn pool_change_returned<D: DomainWalletExt>(&self) -> u64
where
Expand Down Expand Up @@ -307,7 +295,7 @@ impl TransactionRecord {
/// TODO: Add Doc Comment Here!
pub fn value_spent_by_pool(&self) -> [u64; 3] {
[
self.get_transparent_value_spent(),
self.total_transparent_value_spent,
self.total_sapling_value_spent,
self.total_orchard_value_spent,
]
Expand Down Expand Up @@ -803,7 +791,7 @@ mod tests {
#[test]
pub fn blank_record() {
let new = TransactionRecordBuilder::default().build();
assert_eq!(new.get_transparent_value_spent(), 0);
assert_eq!(new.total_transparent_value_spent, 0);
assert!(!new.is_outgoing_transaction());
assert!(!new.is_incoming_transaction());
// assert_eq!(new.net_spent(), 0);
Expand Down
Loading