Skip to content

Commit

Permalink
Merge pull request #86 from smartcontractkit/sish/tw-fix
Browse files Browse the repository at this point in the history
Fixed the error log
  • Loading branch information
stackman27 authored Jul 9, 2024
2 parents e25cdbd + 59eb355 commit 77cbe71
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions pkg/timelock/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ import (
// - The operation is ready to be executed
// Otherwise the operation will throw an info log and wait for a future tick.
func (tw *Worker) execute(ctx context.Context, op []*contract.TimelockCallScheduled) {
if !isReady(ctx, tw.contract, op[0].Id) {
tw.logger.Info().Msgf("skipping operation %x: not ready", op[0].Id)
}

tw.logger.Debug().Msgf("execute operation %x", op[0].Id)
tx, err := tw.executeCallSchedule(ctx, &tw.executeContract.TimelockTransactor, op, tw.privateKey)
if err != nil || tx == nil {
tw.logger.Error().Msgf("execute operation %x error: %s", op[0].Id, err.Error())
} else {
tw.logger.Info().Msgf("execute operation %x success: %s", op[0].Id, tx.Hash())
if isReady(ctx, tw.contract, op[0].Id) {
tw.logger.Debug().Msgf("execute operation %x", op[0].Id)

if _, err = bind.WaitMined(ctx, tw.ethClient, tx); err != nil {
tx, err := tw.executeCallSchedule(ctx, &tw.executeContract.TimelockTransactor, op, tw.privateKey)
if err != nil || tx == nil {
tw.logger.Error().Msgf("execute operation %x error: %s", op[0].Id, err.Error())
} else {
tw.logger.Info().Msgf("execute operation %x success: %s", op[0].Id, tx.Hash())

if _, err = bind.WaitMined(ctx, tw.ethClient, tx); err != nil {
tw.logger.Error().Msgf("execute operation %x error: %s", op[0].Id, err.Error())
}
}
} else {
tw.logger.Info().Msgf("skipping operation %x: not ready", op[0].Id)
}
}

Expand Down

0 comments on commit 77cbe71

Please sign in to comment.