From 4bc05dab9dee810c2754385732d1fe9db0bf0e24 Mon Sep 17 00:00:00 2001 From: Jiri Date: Wed, 9 Oct 2024 17:39:51 +0200 Subject: [PATCH] Review changes --- app/upgrade_cudos.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/upgrade_cudos.go b/app/upgrade_cudos.go index 3ceeae62..03cbe1b7 100644 --- a/app/upgrade_cudos.go +++ b/app/upgrade_cudos.go @@ -2009,14 +2009,14 @@ func DoGenesisAccountMovements(genesisData *GenesisData, cudosCfg *CudosMergeCon } // Handle delegations movement - remainingAmountToMove := accountMovement.Amount + remainingAmountToMove := sdk.NewIntFromBigInt(accountMovement.Amount.BigInt()) if sourceDelegations, exists := genesisData.delegations.Get(accountMovement.SourceAddress); exists { for i := range sourceDelegations.Iterate() { validatorAddr, delegatedAmount := i.Key, i.Value - if delegatedAmount.GTE(*remainingAmountToMove) { + if delegatedAmount.GTE(remainingAmountToMove) { // Split delegation - err := moveGenesisDelegation(genesisData, accountMovement.SourceAddress, accountMovement.DestinationAddress, validatorAddr, *remainingAmountToMove, manifest, "") + err := moveGenesisDelegation(genesisData, accountMovement.SourceAddress, accountMovement.DestinationAddress, validatorAddr, remainingAmountToMove, manifest, "") if err != nil { return fmt.Errorf("failed to move delegated amount %s of %s from %s to %s: %w", delegatedAmount, validatorAddr, accountMovement.SourceAddress, accountMovement.DestinationAddress, err) } @@ -2029,8 +2029,7 @@ func DoGenesisAccountMovements(genesisData *GenesisData, cudosCfg *CudosMergeCon return fmt.Errorf("failed to move delegated amount %s of %s from %s to %s: %w", delegatedAmount, validatorAddr, accountMovement.SourceAddress, accountMovement.DestinationAddress, err) } } - newBalance := remainingAmountToMove.Sub(delegatedAmount) - remainingAmountToMove = &newBalance + remainingAmountToMove = remainingAmountToMove.Sub(delegatedAmount) } } }