From ab2a20b5c8ce5e0c7f1963528f45831c737d5fcd Mon Sep 17 00:00:00 2001 From: scx1332 Date: Wed, 31 Jul 2024 20:06:39 +0200 Subject: [PATCH] Added trigger payments to API --- crates/erc20_payment_lib/src/runtime.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/erc20_payment_lib/src/runtime.rs b/crates/erc20_payment_lib/src/runtime.rs index 448c1245..b89659bb 100644 --- a/crates/erc20_payment_lib/src/runtime.rs +++ b/crates/erc20_payment_lib/src/runtime.rs @@ -1072,6 +1072,18 @@ impl PaymentRuntime { } } + pub fn trigger_payments(&self, deadline: DateTime, account: &SignerAccount) { + let mut ext_gath_time_guard = account.external_gather_time.lock().unwrap(); + let new_time = ext_gath_time_guard + .map(|t| t.min(deadline)) + .unwrap_or(deadline); + + if Some(new_time) != *ext_gath_time_guard { + *ext_gath_time_guard = Some(new_time); + self.wake.notify_one(); + } + } + pub async fn distribute_gas( &self, chain_name: &str,