Updated group transactions (owner check)

This commit is contained in:
AlphaX-Projects 2024-06-29 12:58:58 +02:00
parent ea1d4dd962
commit a140805c36
4 changed files with 16 additions and 0 deletions

View File

@ -70,6 +70,10 @@ public class CancelGroupBanTransaction extends Transaction {
if (!this.repository.getGroupRepository().adminExists(groupId, admin.getAddress()))
return ValidationResult.NOT_GROUP_ADMIN;
// Can't unban if not group's current owner
if (!admin.getAddress().equals(groupData.getOwner()))
return ValidationResult.INVALID_GROUP_OWNER;
Account member = getMember();
// Check ban actually exists

View File

@ -70,6 +70,10 @@ public class GroupBanTransaction extends Transaction {
if (!this.repository.getGroupRepository().adminExists(groupId, admin.getAddress()))
return ValidationResult.NOT_GROUP_ADMIN;
// Can't ban if not group's current owner
if (!admin.getAddress().equals(groupData.getOwner()))
return ValidationResult.INVALID_GROUP_OWNER;
Account offender = getOffender();
// Can't ban group owner

View File

@ -82,6 +82,10 @@ public class GroupKickTransaction extends Transaction {
if (!admin.getAddress().equals(groupData.getOwner()) && groupRepository.adminExists(groupId, member.getAddress()))
return ValidationResult.INVALID_GROUP_OWNER;
// Can't kick if not group's current owner
if (!admin.getAddress().equals(groupData.getOwner()))
return ValidationResult.INVALID_GROUP_OWNER;
// Check creator has enough funds
if (admin.getConfirmedBalance(Asset.QORT) < this.groupKickTransactionData.getFee())
return ValidationResult.NO_BALANCE;

View File

@ -83,6 +83,10 @@ public class UpdateGroupTransaction extends Transaction {
Account owner = getOwner();
// Check creator is group's current owner
if (!owner.getAddress().equals(groupData.getOwner()))
return ValidationResult.INVALID_GROUP_OWNER;
// Check creator has enough funds
if (owner.getConfirmedBalance(Asset.QORT) < this.updateGroupTransactionData.getFee())
return ValidationResult.NO_BALANCE;