Skip to content

Commit

Permalink
Update to better logic
Browse files Browse the repository at this point in the history
  • Loading branch information
p0p3yee committed Feb 28, 2024
1 parent 5fc1a44 commit 3317621
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions x/pep/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ func (am AppModule) processFailedEncryptedTx(ctx sdk.Context, tx types.Encrypted
),
)

am.keeper.SetEncryptedTxProcessedHeight(ctx, tx.TargetHeight, tx.Index, uint64(ctx.BlockHeight()))

creatorAddr, err := sdk.AccAddressFromBech32(tx.Creator)
if err != nil {
am.keeper.Logger(ctx).Error("error while trying to parse tx creator address when processing failed encrypted tx")
Expand Down Expand Up @@ -346,6 +344,7 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {

for _, eachTx := range arr.EncryptedTx {
startConsumedGas := ctx.GasMeter().GasConsumed()
am.keeper.SetEncryptedTxProcessedHeight(ctx, eachTx.TargetHeight, eachTx.Index, uint64(ctx.BlockHeight()))
if currentNonce, found := am.keeper.GetPepNonce(ctx, eachTx.Creator); found && currentNonce.Nonce == math.MaxUint64 {
am.processFailedEncryptedTx(ctx, eachTx, "invalid pep nonce", startConsumedGas)
continue
Expand Down Expand Up @@ -573,7 +572,6 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
eventStrArrJson, _ := json.Marshal(underlyingTxEvents)

am.keeper.Logger(ctx).Info("! Encrypted Tx Decrypted & Decoded & Executed successfully !")
am.keeper.SetEncryptedTxProcessedHeight(ctx, eachTx.TargetHeight, eachTx.Index, uint64(ctx.BlockHeight()))

ctx.EventManager().EmitEvent(
sdk.NewEvent(types.EncryptedTxExecutedEventType,
Expand Down

0 comments on commit 3317621

Please sign in to comment.