From bac92f35286da6688b36a1cb969a337717af5d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceyhun=20=C5=9Een?= Date: Mon, 10 Jun 2024 16:53:47 +0300 Subject: [PATCH] ledger-rpc_api: Add underscore prefix for unused functions. --- src/client/rpc_api.rs | 4 ++-- src/ledger/mod.rs | 2 +- src/ledger/transactions.rs | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/client/rpc_api.rs b/src/client/rpc_api.rs index a0ac035..a3fb2ea 100644 --- a/src/client/rpc_api.rs +++ b/src/client/rpc_api.rs @@ -316,7 +316,7 @@ mod tests { assert!(!address.is_valid_for_network(Network::Testnet)); assert!(!address.is_valid_for_network(Network::Signet)); assert!(!address.is_valid_for_network(Network::Bitcoin)); - assert_eq!(*rpc.ledger.get_addresses()[0].as_unchecked(), address); + assert_eq!(*rpc.ledger._get_addresses()[0].as_unchecked(), address); const ADDRESS_COUNT: usize = 100; let mut prev = address; @@ -328,7 +328,7 @@ mod tests { assert!(!curr.is_valid_for_network(Network::Testnet)); assert!(!curr.is_valid_for_network(Network::Signet)); assert!(!curr.is_valid_for_network(Network::Bitcoin)); - assert_eq!(*rpc.ledger.get_addresses()[i + 1].as_unchecked(), curr); + assert_eq!(*rpc.ledger._get_addresses()[i + 1].as_unchecked(), curr); prev = curr; } diff --git a/src/ledger/mod.rs b/src/ledger/mod.rs index 1a7050a..39e8f44 100644 --- a/src/ledger/mod.rs +++ b/src/ledger/mod.rs @@ -67,7 +67,7 @@ impl Ledger { add_item!(self.addresses, address); } /// Returns addresses of the user. - pub fn get_addresses(&self) -> Vec
{ + pub fn _get_addresses(&self) -> Vec
{ get_item!(self.addresses); } } diff --git a/src/ledger/transactions.rs b/src/ledger/transactions.rs index 5339ee5..7f0a8c0 100644 --- a/src/ledger/transactions.rs +++ b/src/ledger/transactions.rs @@ -10,7 +10,7 @@ impl Ledger { add_item!(self.utxos, utxo); } /// Returns UTXO's of the user. - pub fn get_utxos(&self) -> Vec { + pub fn _get_utxos(&self) -> Vec { get_item!(self.utxos); } @@ -33,7 +33,7 @@ impl Ledger { .unwrap() } /// Returns user's list of transactions. - pub fn get_transactions(&self) -> Vec { + pub fn _get_transactions(&self) -> Vec { get_item!(self.transactions); } /// Checks if a transaction is OK or not. @@ -61,8 +61,8 @@ mod tests { fn add_utxo() { let ledger = Ledger::new(); - assert_eq!(ledger.get_utxos().len(), 0); - assert_eq!(ledger.get_addresses().len(), 0); + assert_eq!(ledger._get_utxos().len(), 0); + assert_eq!(ledger._get_addresses().len(), 0); // Generate a random address. let secp = Secp256k1::new(); @@ -74,16 +74,16 @@ mod tests { .unwrap(); let address = Address::p2tr(&secp, xonly_public_key, None, Network::Regtest); ledger.add_address(address); - assert_eq!(ledger.get_addresses().len(), 1); + assert_eq!(ledger._get_addresses().len(), 1); // Insert a dummy UTXO. let utxo = TxOut { value: Amount::from_sat(0x45), - script_pubkey: ledger.get_addresses()[0].script_pubkey(), + script_pubkey: ledger._get_addresses()[0].script_pubkey(), }; ledger.add_utxo(utxo); - assert_eq!(ledger.get_utxos().len(), 1); - assert_eq!(ledger.get_utxos()[0].value, Amount::from_sat(0x45)); + assert_eq!(ledger._get_utxos().len(), 1); + assert_eq!(ledger._get_utxos()[0].value, Amount::from_sat(0x45)); } }