Rename Network::address to Network::external_address

Improves clarity since we now have 4 addresses.
This commit is contained in:
Luke Parker
2023-11-09 14:31:40 -05:00
parent 42e8f2c8d8
commit 52a0c56016
7 changed files with 13 additions and 13 deletions

View File

@@ -538,23 +538,23 @@ impl Network for Bitcoin {
scanner(keys.group_key());
}
fn address(key: ProjectivePoint) -> Address {
fn external_address(key: ProjectivePoint) -> Address {
Address(BAddress::<NetworkChecked>::new(BNetwork::Bitcoin, address_payload(key).unwrap()))
}
fn branch_address(key: ProjectivePoint) -> Address {
let (_, offsets, _) = scanner(key);
Self::address(key + (ProjectivePoint::GENERATOR * offsets[&OutputType::Branch]))
Self::external_address(key + (ProjectivePoint::GENERATOR * offsets[&OutputType::Branch]))
}
fn change_address(key: ProjectivePoint) -> Address {
let (_, offsets, _) = scanner(key);
Self::address(key + (ProjectivePoint::GENERATOR * offsets[&OutputType::Change]))
Self::external_address(key + (ProjectivePoint::GENERATOR * offsets[&OutputType::Change]))
}
fn forward_address(key: ProjectivePoint) -> Address {
let (_, offsets, _) = scanner(key);
Self::address(key + (ProjectivePoint::GENERATOR * offsets[&OutputType::Forwarded]))
Self::external_address(key + (ProjectivePoint::GENERATOR * offsets[&OutputType::Forwarded]))
}
async fn get_latest_block_number(&self) -> Result<usize, NetworkError> {

View File

@@ -293,7 +293,7 @@ pub trait Network: 'static + Send + Sync + Clone + PartialEq + Eq + Debug {
fn tweak_keys(key: &mut ThresholdKeys<Self::Curve>);
/// Address for the given group key to receive external coins to.
fn address(key: <Self::Curve as Ciphersuite>::G) -> Self::Address;
fn external_address(key: <Self::Curve as Ciphersuite>::G) -> Self::Address;
/// Address for the given group key to use for scheduled branches.
fn branch_address(key: <Self::Curve as Ciphersuite>::G) -> Self::Address;
/// Address for the given group key to use for change.

View File

@@ -475,7 +475,7 @@ impl Network for Monero {
// Monero doesn't require/benefit from tweaking
fn tweak_keys(_: &mut ThresholdKeys<Self::Curve>) {}
fn address(key: EdwardsPoint) -> Address {
fn external_address(key: EdwardsPoint) -> Address {
Self::address_internal(key, EXTERNAL_SUBADDRESS)
}