|
@@ -216,12 +216,24 @@ impl BtcClient {
|
|
|
|
|
|
|
|
let status = client.script_subscribe(&script)?;
|
|
let status = client.script_subscribe(&script)?;
|
|
|
|
|
|
|
|
|
|
+ let iter_interval = 5;
|
|
|
|
|
+ let mut sub_iter = 0;
|
|
|
|
|
+
|
|
|
loop {
|
|
loop {
|
|
|
|
|
+ if sub_iter > 60 * 10 {
|
|
|
|
|
+ // 10 minutes
|
|
|
|
|
+ return Err(BtcFailed::ElectrumError(format!(
|
|
|
|
|
+ "Deposit for {:?} expired",
|
|
|
|
|
+ script
|
|
|
|
|
+ )));
|
|
|
|
|
+ }
|
|
|
|
|
+ sub_iter += iter_interval;
|
|
|
|
|
+
|
|
|
let current_status = client.script_pop(&script)?;
|
|
let current_status = client.script_pop(&script)?;
|
|
|
debug!(target: "BTC BRIDGE", "script status: {:?}", status);
|
|
debug!(target: "BTC BRIDGE", "script status: {:?}", status);
|
|
|
debug!(target: "BTC BRIDGE", "current_script status: {:?}", current_status);
|
|
debug!(target: "BTC BRIDGE", "current_script status: {:?}", current_status);
|
|
|
if current_status == status {
|
|
if current_status == status {
|
|
|
- async_std::task::sleep(Duration::from_secs(5)).await;
|
|
|
|
|
|
|
+ async_std::task::sleep(Duration::from_secs(iter_interval)).await;
|
|
|
debug!(
|
|
debug!(
|
|
|
target: "BTC BRIDGE",
|
|
target: "BTC BRIDGE",
|
|
|
"ScriptPubKey status has not changed, amtucfd: {}, amtcfd: {}",
|
|
"ScriptPubKey status has not changed, amtucfd: {}, amtcfd: {}",
|