From 859e15216af7c506ec4a4345198e343722167e85 Mon Sep 17 00:00:00 2001 From: Valentin Staykov Date: Thu, 26 May 2022 11:53:10 +0000 Subject: [PATCH] error for no unbatched transactions --- module/x/gravity/keeper/batch.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/module/x/gravity/keeper/batch.go b/module/x/gravity/keeper/batch.go index 487788b9f..70318fa72 100644 --- a/module/x/gravity/keeper/batch.go +++ b/module/x/gravity/keeper/batch.go @@ -48,9 +48,15 @@ func (k Keeper) BuildOutgoingTXBatch( } selectedTx, err := k.pickUnbatchedTX(ctx, contract, maxElements) - if len(selectedTx) == 0 || err != nil { + + if err != nil { return nil, err } + + if len(selectedTx) == 0 { + return nil, sdkerrors.Wrap(types.ErrEmpty, "there are no unbatched transactions for that denom") + } + nextID := k.autoIncrementID(ctx, types.KeyLastOutgoingBatchID) batch, err := types.NewInternalOutgingTxBatch(nextID, k.getBatchTimeoutHeight(ctx), selectedTx, contract, 0) if err != nil {