Просмотр исходного кода

Use btc genesis coinbase as token identifier

Janus 4 лет назад
Родитель
Сommit
46de83801e
3 измененных файлов с 9 добавлено и 4 удалено
  1. 2 2
      src/bin/cashierd.rs
  2. 3 1
      src/bin/darkfid.rs
  3. 4 1
      src/util/parse.rs

+ 2 - 2
src/bin/cashierd.rs

@@ -253,7 +253,7 @@ impl Cashierd {
             let drk_pub_key = bs58::decode(&drk_pub_key).into_vec()?;
             let drk_pub_key = bs58::decode(&drk_pub_key).into_vec()?;
             let drk_pub_key: jubjub::SubgroupPoint = deserialize(&drk_pub_key)?;
             let drk_pub_key: jubjub::SubgroupPoint = deserialize(&drk_pub_key)?;
 
 
-            // check if the drk public key is already exist
+            // check if the drk public key already exist
             let check = self
             let check = self
                 .cashier_wallet
                 .cashier_wallet
                 .get_deposit_token_keys_by_dkey_public(&drk_pub_key, &network)?;
                 .get_deposit_token_keys_by_dkey_public(&drk_pub_key, &network)?;
@@ -452,7 +452,7 @@ impl Cashierd {
             #[cfg(feature = "btc")]
             #[cfg(feature = "btc")]
             NetworkName::Bitcoin => {
             NetworkName::Bitcoin => {
                 // Handle bitcoin address here if needed
                 // Handle bitcoin address here if needed
-                Ok(None)
+                Ok(Some("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa".to_string()))
             }
             }
 
 
             _ => Err(Error::NotSupportedNetwork),
             _ => Err(Error::NotSupportedNetwork),

+ 3 - 1
src/bin/darkfid.rs

@@ -193,7 +193,9 @@ impl Darkfid {
                 }
                 }
                 #[cfg(feature = "btc")]
                 #[cfg(feature = "btc")]
                 NetworkName::Bitcoin => {
                 NetworkName::Bitcoin => {
-                    return Err(Error::NotSupportedToken);
+                    //hardcoded genesis coinbase address
+                    let token_id = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa".to_string();
+                    Ok(json!(token_id))
                 }
                 }
                 _ => Err(Error::NotSupportedNetwork),
                 _ => Err(Error::NotSupportedNetwork),
             }
             }

+ 4 - 1
src/util/parse.rs

@@ -57,7 +57,10 @@ pub fn assign_id(network: &str, token: &str, _tokenlist: &SolTokenList) -> Resul
             Ok(id)
             Ok(id)
         }
         }
         #[cfg(feature = "btc")]
         #[cfg(feature = "btc")]
-        NetworkName::Bitcoin => Err(Error::NotSupportedToken),
+        NetworkName::Bitcoin => {
+            let id = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa".to_string();
+            Ok(id)
+        },
         _ => Err(Error::NotSupportedNetwork),
         _ => Err(Error::NotSupportedNetwork),
     }
     }
 }
 }