Skip to content

Commit

Permalink
ledger-rpc_api: Add underscore prefix for unused functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhunsen committed Jun 10, 2024
1 parent 0d0c1da commit bac92f3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/client/rpc_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ledger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Ledger {
add_item!(self.addresses, address);
}
/// Returns addresses of the user.
pub fn get_addresses(&self) -> Vec<Address> {
pub fn _get_addresses(&self) -> Vec<Address> {
get_item!(self.addresses);
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/ledger/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ impl Ledger {
add_item!(self.utxos, utxo);
}
/// Returns UTXO's of the user.
pub fn get_utxos(&self) -> Vec<TxOut> {
pub fn _get_utxos(&self) -> Vec<TxOut> {
get_item!(self.utxos);
}

Expand All @@ -33,7 +33,7 @@ impl Ledger {
.unwrap()
}
/// Returns user's list of transactions.
pub fn get_transactions(&self) -> Vec<Transaction> {
pub fn _get_transactions(&self) -> Vec<Transaction> {
get_item!(self.transactions);
}
/// Checks if a transaction is OK or not.
Expand Down Expand Up @@ -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();
Expand All @@ -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));
}
}

0 comments on commit bac92f3

Please sign in to comment.