diff --git a/Cargo.toml b/Cargo.toml index 71fcd37..0ad2275 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,8 @@ [package] -name = "sync" -version = "0.1.0" +name = "zcash-warpsync" +version = "1.2.15" authors = ["Hanh "] -edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +edition = "2021" [[bench]] name = "scan_all" diff --git a/src/api/payment_uri.rs b/src/api/payment_uri.rs index aafda25..a4af5fb 100644 --- a/src/api/payment_uri.rs +++ b/src/api/payment_uri.rs @@ -31,10 +31,12 @@ pub fn make_payment_uri(address: &str, amount: u64, memo: &str) -> anyhow::Resul pub fn parse_payment_uri(uri: &str) -> anyhow::Result { let c = CoinConfig::get_active(); - if uri[..5].ne(c.chain.ticker()) { + let scheme = c.chain.ticker(); + let scheme_len = scheme.len(); + if uri[..scheme_len].ne(scheme) { anyhow::bail!("Invalid Payment URI: Invalid scheme"); } - let uri = format!("zcash{}", &uri[5..]); // hack to replace the URI scheme + let uri = format!("zcash{}", &uri[scheme_len..]); // hack to replace the URI scheme let treq = TransactionRequest::from_uri(c.chain.network(), &uri) .map_err(|e| anyhow::anyhow!("Invalid Payment URI: {:?}", e))?; if treq.payments.len() != 1 {