From aed1a17f1f014be52b951359cd76142ec0aa55d8 Mon Sep 17 00:00:00 2001 From: ghassmo Date: Mon, 27 Sep 2021 16:16:57 +0300 Subject: [PATCH] BtcClient: minor changes --- src/service/btc.rs | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/src/service/btc.rs b/src/service/btc.rs index 4d56dbfb3..f56cb0010 100644 --- a/src/service/btc.rs +++ b/src/service/btc.rs @@ -136,44 +136,6 @@ impl BtcClient { })) } - // pub async fn start_subscribe(self: Arc) -> BtcResult<(Txid, u64)> { - // debug!(target: "BTC CLIENT", "Subscribe to scriptpubkey"); - // let client = &self.btc_client; - // // Check if script is already subscribed - // if let Some(status_start) = client.script_subscribe(&self.script)? { - // loop { - // match client.script_pop(&self.script)? { - // Some(status) => { - // // Script has a notification update - // if status != status_start { - // let balance = client.script_get_balance(&self.script)?; - // if balance.confirmed > 0 { - // debug!(target: "BTC CLIENT", "BTC Balance: Confirmed!"); - // let history = client.script_get_history(&self.script)?; - // //return tx_hash of latest tx that created balance - // return Ok((history[0].tx_hash, balance.confirmed)); - // } else { - // debug!(target: "BTC CLIENT", "BTC Balance: Unconfirmed!"); - // continue; - // } - // } else { - // debug!(target: "BTC CLIENT", "ScriptPubKey status has not changed"); - // continue; - // } - // } - // None => { - // debug!(target: "BTC CLIENT", "Scriptpubkey does not yet exist in script notifications!"); - // continue; - // } - // }; - // } // Endloop - // } else { - // return Err(BtcFailed::ElectrumError( - // "Did not subscribe to scriptpubkey".to_string(), - // )); - // } - // } - async fn handle_subscribe_request(self: Arc, keypair: Arc) -> Result<()> { debug!( target: "BTC BRIDGE", @@ -195,7 +157,7 @@ impl BtcClient { impl NetworkClient for BtcClient { async fn subscribe(self: Arc) -> Result { // Generate bitcoin keys - let btc_keys = BitcoinKeys::new(Network::Testnet)?; + let btc_keys = BitcoinKeys::new(self.network)?; let btc_privkey = btc_keys.clone(); let btc_privkey = btc_privkey.btc_privkey(); let btc_pubkey = btc_keys.clone();