浏览代码

fix: update bal before keeper payment (#2628)

Tejas Badadare 6 月之前
父节点
当前提交
928639193d
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      target_chains/ethereum/contracts/contracts/pulse/Scheduler.sol

+ 4 - 3
target_chains/ethereum/contracts/contracts/pulse/Scheduler.sol

@@ -768,12 +768,13 @@ abstract contract Scheduler is IScheduler, SchedulerState {
             revert InsufficientBalance();
         }
 
-        // Pay keeper and update status if successful
+        status.balanceInWei -= totalKeeperFee;
+        status.totalSpent += totalKeeperFee;
+
+        // Pay keeper and update status
         (bool sent, ) = msg.sender.call{value: totalKeeperFee}("");
         if (!sent) {
             revert KeeperPaymentFailed();
         }
-        status.balanceInWei -= totalKeeperFee;
-        status.totalSpent += totalKeeperFee;
     }
 }