binary wallet functions fix
This commit is contained in:
parent
7cd421e142
commit
9f3f53ca34
|
|
@ -80,6 +80,18 @@ pub fn resolve_local_input_short_address(address: &str) -> Result<String, String
|
||||||
let normalized = Wallet::normalize_to_short_address(address)
|
let normalized = Wallet::normalize_to_short_address(address)
|
||||||
.ok_or_else(|| "Invalid wallet address.".to_string())?;
|
.ok_or_else(|| "Invalid wallet address.".to_string())?;
|
||||||
|
|
||||||
|
let (payload, _) = normalized
|
||||||
|
.rsplit_once('.')
|
||||||
|
.ok_or_else(|| "Invalid wallet address.".to_string())?;
|
||||||
|
|
||||||
|
if payload.len() == Wallet::SHORT_ADDRESS_HASH_BYTES_LENGTH * 2
|
||||||
|
&& payload.chars().all(|ch| ch.is_ascii_hexdigit())
|
||||||
|
{
|
||||||
|
// A normal hex short address does not need local registry access. The
|
||||||
|
// receiving node will enforce registration when the tx is submitted.
|
||||||
|
return Ok(normalized);
|
||||||
|
}
|
||||||
|
|
||||||
let (
|
let (
|
||||||
_network_name,
|
_network_name,
|
||||||
_padded_base_coin,
|
_padded_base_coin,
|
||||||
|
|
@ -101,18 +113,6 @@ pub fn resolve_local_input_short_address(address: &str) -> Result<String, String
|
||||||
return Ok(canonical);
|
return Ok(canonical);
|
||||||
}
|
}
|
||||||
|
|
||||||
let (payload, _) = normalized
|
|
||||||
.rsplit_once('.')
|
|
||||||
.ok_or_else(|| "Invalid wallet address.".to_string())?;
|
|
||||||
|
|
||||||
if payload.len() == Wallet::SHORT_ADDRESS_HASH_BYTES_LENGTH * 2
|
|
||||||
&& payload.chars().all(|ch| ch.is_ascii_hexdigit())
|
|
||||||
{
|
|
||||||
// A normal hex short address can be used even if the local wallet
|
|
||||||
// registry has not learned it yet.
|
|
||||||
return Ok(normalized);
|
|
||||||
}
|
|
||||||
|
|
||||||
Err("Vanity address could not be resolved to a canonical short address.".to_string())
|
Err("Vanity address could not be resolved to a canonical short address.".to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue