Skip to content

Commit

Permalink
Merge pull request #1179 from zancas/remove_inconsistent_method
Browse files Browse the repository at this point in the history
Remove inconsistent method
  • Loading branch information
zancas authored Jun 3, 2024
2 parents 3366bc6 + 5575045 commit e381498
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
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

0 comments on commit e381498

Please sign in to comment.