Skip to content

Commit e381498

Browse files
authored
Merge pull request #1179 from zancas/remove_inconsistent_method
Remove inconsistent method
2 parents 3366bc6 + 5575045 commit e381498

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

zingolib/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6464
- `do_save_to_buffer`
6565
- `do_save_to_buffer_sync`
6666
- `fix_spent_at_height`
67+
- `TransactionRecord::net_spent`
68+
- `TransactionRecord::get_transparent_value_spent()`

zingolib/src/lightclient/deprecated.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl LightClient {
138138

139139
// Get the total transparent value received in this transaction
140140
// Again we see the assumption that utxos are incoming.
141-
let net_transparent_value = total_transparent_received as i64 - wallet_transaction.get_transparent_value_spent() as i64;
141+
let net_transparent_value = total_transparent_received as i64 - wallet_transaction.total_transparent_value_spent as i64;
142142
let address = wallet_transaction.transparent_outputs.iter().map(|utxo| utxo.address.clone()).collect::<Vec<String>>().join(",");
143143
if net_transparent_value > 0 {
144144
if let Some(transaction) = consumer_notes_by_tx.iter_mut().find(|transaction| transaction["txid"] == txid.to_string()) {

zingolib/src/wallet/transaction_record.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,6 @@ impl TransactionRecord {
224224
self.query_sum_value(OutputQuery::any())
225225
}
226226

227-
/// TODO: Add Doc Comment Here!
228-
pub fn get_transparent_value_spent(&self) -> u64 {
229-
self.total_transparent_value_spent
230-
}
231-
232227
/// TODO: Add Doc Comment Here!
233228
#[deprecated(
234229
note = "replaced by `calculate_transaction_fee` method for [`crate::wallet::transaction_records_by_id::TransactionRecordsById`]"
@@ -270,13 +265,6 @@ impl TransactionRecord {
270265
|| !self.transparent_outputs.is_empty()
271266
}
272267

273-
/// TODO: Add Doc Comment Here!
274-
#[deprecated(note = "unused function with misleading name")]
275-
pub fn net_spent(&self) -> u64 {
276-
assert!(self.is_outgoing_transaction());
277-
self.total_value_spent() - self.total_change_returned()
278-
}
279-
280268
/// TODO: Add Doc Comment Here!
281269
fn pool_change_returned<D: DomainWalletExt>(&self) -> u64
282270
where
@@ -307,7 +295,7 @@ impl TransactionRecord {
307295
/// TODO: Add Doc Comment Here!
308296
pub fn value_spent_by_pool(&self) -> [u64; 3] {
309297
[
310-
self.get_transparent_value_spent(),
298+
self.total_transparent_value_spent,
311299
self.total_sapling_value_spent,
312300
self.total_orchard_value_spent,
313301
]
@@ -803,7 +791,7 @@ mod tests {
803791
#[test]
804792
pub fn blank_record() {
805793
let new = TransactionRecordBuilder::default().build();
806-
assert_eq!(new.get_transparent_value_spent(), 0);
794+
assert_eq!(new.total_transparent_value_spent, 0);
807795
assert!(!new.is_outgoing_transaction());
808796
assert!(!new.is_incoming_transaction());
809797
// assert_eq!(new.net_spent(), 0);

0 commit comments

Comments
 (0)