Skip to content

Commit 77cbe71

Browse files
authored
Merge pull request #86 from smartcontractkit/sish/tw-fix
Fixed the error log
2 parents e25cdbd + 59eb355 commit 77cbe71

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

pkg/timelock/operations.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@ import (
1919
// - The operation is ready to be executed
2020
// Otherwise the operation will throw an info log and wait for a future tick.
2121
func (tw *Worker) execute(ctx context.Context, op []*contract.TimelockCallScheduled) {
22-
if !isReady(ctx, tw.contract, op[0].Id) {
23-
tw.logger.Info().Msgf("skipping operation %x: not ready", op[0].Id)
24-
}
25-
26-
tw.logger.Debug().Msgf("execute operation %x", op[0].Id)
27-
tx, err := tw.executeCallSchedule(ctx, &tw.executeContract.TimelockTransactor, op, tw.privateKey)
28-
if err != nil || tx == nil {
29-
tw.logger.Error().Msgf("execute operation %x error: %s", op[0].Id, err.Error())
30-
} else {
31-
tw.logger.Info().Msgf("execute operation %x success: %s", op[0].Id, tx.Hash())
22+
if isReady(ctx, tw.contract, op[0].Id) {
23+
tw.logger.Debug().Msgf("execute operation %x", op[0].Id)
3224

33-
if _, err = bind.WaitMined(ctx, tw.ethClient, tx); err != nil {
25+
tx, err := tw.executeCallSchedule(ctx, &tw.executeContract.TimelockTransactor, op, tw.privateKey)
26+
if err != nil || tx == nil {
3427
tw.logger.Error().Msgf("execute operation %x error: %s", op[0].Id, err.Error())
28+
} else {
29+
tw.logger.Info().Msgf("execute operation %x success: %s", op[0].Id, tx.Hash())
30+
31+
if _, err = bind.WaitMined(ctx, tw.ethClient, tx); err != nil {
32+
tw.logger.Error().Msgf("execute operation %x error: %s", op[0].Id, err.Error())
33+
}
3534
}
35+
} else {
36+
tw.logger.Info().Msgf("skipping operation %x: not ready", op[0].Id)
3637
}
3738
}
3839

0 commit comments

Comments
 (0)