18 lines
775 B
Rust
18 lines
775 B
Rust
use super::*;
|
|
|
|
pub fn get_registered_pubkey(db: &Db, short_address: &[u8]) -> sled::Result<Option<Vec<u8>>> {
|
|
// The primary registry maps canonical short-address bytes to long public keys.
|
|
let tree = db.open_tree(WALLET_REGISTRY_TREE)?;
|
|
Ok(tree.get(short_address)?.map(|value| value.to_vec()))
|
|
}
|
|
|
|
pub fn is_registered_short_address(db: &Db, short_address: &str) -> sled::Result<bool> {
|
|
// Vanity aliases are resolved first, so callers can ask about either form.
|
|
Ok(resolve_canonical_registered_short_address(db, short_address)?.is_some())
|
|
}
|
|
|
|
pub fn short_address_exists(db: &Db, short_address: &[u8]) -> sled::Result<bool> {
|
|
// Raw-byte checks only look at the canonical registry tree.
|
|
Ok(get_registered_pubkey(db, short_address)?.is_some())
|
|
}
|