Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MissingNO57 committed Oct 9, 2024
1 parent 6159442 commit 4bc05da
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/upgrade_cudos.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
}
}
Expand Down

0 comments on commit 4bc05da

Please sign in to comment.