# How to check if work has been done?

**URL:** <https://forum.openzeppelin.com/t/how-to-check-if-work-has-been-done/4947>\
**Category:** Defender\
**Tags:** keep3r-network\
**Created:** [December 6, 2020, 4:32am UTC](https://forum.openzeppelin.com/t/how-to-check-if-work-has-been-done/4947 "2020-12-06T04:32:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bolo](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/bolo/32/3369_2.png) [@Bolo](https://forum.openzeppelin.com/u/Bolo)\
**Post date:** [December 6, 2020, 4:32am UTC](https://forum.openzeppelin.com/t/how-to-check-if-work-has-been-done/4947/1 "2020-12-06T04:32:07Z")

</div>

there is no way to check if the previous block has checked the method workable and returns true.

With while demo code, I have got 6 tx who failed because I am calling 6 times because workable return true.

 ![Capture d’écran 2020-12-06 à 00.24.25](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/3/3bbf6afbbcf4350ecff9223a0b45d02b5130d21e.png)

> **[Contract Address 0xb1ace96072654e3a2564a90d64be99dd3ac195f4 | Etherscan](https://etherscan.io/address/0xb1ace96072654e3a2564a90d64be99dd3ac195f4)**
>
> The Contract Address 0xb1ace96072654e3a2564a90d64be99dd3ac195f4 page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on...

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [December 8, 2020, 12:50am UTC](https://forum.openzeppelin.com/t/how-to-check-if-work-has-been-done/4947/2 "2020-12-08T00:50:08Z")

</div>

Hi @Bolo,

If I understand correctly, there was work to be done, the script then created a transaction, and repeated this 6 times. So need to get the first transaction mined faster (so subsequent checks show that there isn’t work to be done) and have a way to flag in the script that a transaction has been sent (so subsequent checks show that we have attempted to do work).

---

<div class="post-metadata">

**Author:** ![Bolo](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/bolo/32/3369_2.png) [@Bolo](https://forum.openzeppelin.com/u/Bolo)\
**Post date:** [December 8, 2020, 6:53pm UTC](https://forum.openzeppelin.com/t/how-to-check-if-work-has-been-done/4947/3 "2020-12-08T18:53:59Z")

</div>

> [@abcoathup](#):
>
> So need to get the first transaction mined faster (so subsequent checks show that there isn’t work to be done) and have a way to flag in the script that a transaction has been sent

how do you suggest to do that?

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [December 9, 2020, 6:52am UTC](https://forum.openzeppelin.com/t/how-to-check-if-work-has-been-done/4947/4 "2020-12-09T06:52:45Z")

</div>

> [@Bolo](#):
>
> how do you suggest to do that?

Coming up in Defender will be the option to **set a fixed `gasPrice` and a `validUntil` timestamp** for your Relayer transactions which should help with this.

You may also want to modify your script so that you flag (e.g. set a variable) if you have already sent a transaction to do the work so you don't send another transaction for that same work.

---

<div class="post-metadata">

**Author:** ![Bolo](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/bolo/32/3369_2.png) [@Bolo](https://forum.openzeppelin.com/u/Bolo)\
**Post date:** [December 9, 2020, 11:49am UTC](https://forum.openzeppelin.com/t/how-to-check-if-work-has-been-done/4947/5 "2020-12-09T11:49:17Z")

</div>

> You may also want to modify your script so that you flag (e.g. set a variable) if you have already sent a transaction to do the work so you don’t send another transaction for that same work.

I did that with a hash

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [December 14, 2020, 2:15am UTC](https://forum.openzeppelin.com/t/how-to-check-if-work-has-been-done/4947/6 "2020-12-14T02:15:03Z")

</div>

Hi @Bolo,

> [@abcoathup](#):
>
> Coming up in Defender will be the option to **set a fixed `gasPrice` and a `validUntil` timestamp** for your Relayer transactions which should help with this.

These were added last week: [Defender Release 2020W50: Webhook Support, Fixed Gas Price & Valid Until](https://forum.openzeppelin.com/t/defender-release-2020w50-webhook-support-fixed-gas-price-valid-until/4959)
