Selaa lähdekoodia

mmproxy: Decode monero address using from_str()

parazyd 2 vuotta sitten
vanhempi
sitoutus
5eba43ce98
1 muutettua tiedostoa jossa 1 lisäystä ja 13 poistoa
  1. 1 13
      bin/darkfi-mmproxy/src/stratum.rs

+ 1 - 13
bin/darkfi-mmproxy/src/stratum.rs

@@ -423,19 +423,7 @@ impl MiningProxy {
         // Check valid login. We will parse the username as a Monero
         // Check valid login. We will parse the username as a Monero
         // address, and validate that it corresponds to the network
         // address, and validate that it corresponds to the network
         // we're mining on.
         // we're mining on.
-        let addr_bytes = match bs58::decode(login).into_vec() {
-            Ok(v) => v,
-            Err(e) => {
-                return JsonError::new(
-                    RpcError::InvalidWorkerLogin.into(),
-                    Some(format!("Invalid Monero address login: {}", e)),
-                    id,
-                )
-                .into()
-            }
-        };
-
-        let addr = match monero::Address::from_bytes(&addr_bytes) {
+        let addr = match monero::Address::from_str(login) {
             Ok(v) => v,
             Ok(v) => v,
             Err(e) => {
             Err(e) => {
                 return JsonError::new(
                 return JsonError::new(