From 8adeec3877b6a1e02bedf8a1226f0fd9f5a6c13f Mon Sep 17 00:00:00 2001 From: j75689 Date: Fri, 12 Jan 2024 09:24:46 +0800 Subject: [PATCH] fix: should not count the failed refund delegation --- x/stake/endblock.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/x/stake/endblock.go b/x/stake/endblock.go index c0342311d..1a8120edf 100644 --- a/x/stake/endblock.go +++ b/x/stake/endblock.go @@ -303,6 +303,19 @@ func handleRefundStake(ctx sdk.Context, sideChainPrefix []byte, k keeper.Keeper) Amount: sdk.NewCoin(boundDenom, delegation.GetShares().RawInt()), SideChainId: bscSideChainId, }, k) + if !result.IsOK() { + // If the delegator has another unbounding delegation, + // the refund will be processed after the unbounding delegation is completed. + ctx.Logger().Error("handleRefundStake failed", + "delegator", delegation.DelegatorAddr.String(), + "validator", delegation.ValidatorAddr.String(), + "amount", delegation.GetShares().String(), + "sideChainId", bscSideChainId, + "result", fmt.Sprintf("%+v", result), + ) + continue + } + refundEvents = refundEvents.AppendEvents(result.Events) ctx.Logger().Info("handleRefundStake after SecondSunsetFork",