mirror of
https://github.com/Qortal/qortal.git
synced 2025-07-22 20:26:50 +00:00
Added tests to cover validity checks on group min/max block delay values
This commit is contained in:
@@ -77,6 +77,16 @@ public class CreateGroupTransaction extends Transaction {
|
||||
if (createGroupTransactionData.getApprovalThreshold() == null)
|
||||
return ValidationResult.INVALID_GROUP_APPROVAL_THRESHOLD;
|
||||
|
||||
// Check min/max block delay values
|
||||
if (createGroupTransactionData.getMinimumBlockDelay() < 0)
|
||||
return ValidationResult.INVALID_GROUP_BLOCK_DELAY;
|
||||
|
||||
if (createGroupTransactionData.getMaximumBlockDelay() < 1)
|
||||
return ValidationResult.INVALID_GROUP_BLOCK_DELAY;
|
||||
|
||||
if (createGroupTransactionData.getMaximumBlockDelay() < createGroupTransactionData.getMinimumBlockDelay())
|
||||
return ValidationResult.INVALID_GROUP_BLOCK_DELAY;
|
||||
|
||||
// Check group name size bounds
|
||||
int groupNameLength = Utf8.encodedLength(createGroupTransactionData.getGroupName());
|
||||
if (groupNameLength < 1 || groupNameLength > Group.MAX_NAME_SIZE)
|
||||
|
@@ -242,6 +242,7 @@ public abstract class Transaction {
|
||||
ACCOUNT_CANNOT_REWARD_SHARE(90),
|
||||
SELF_SHARE_EXISTS(91),
|
||||
ACCOUNT_ALREADY_EXISTS(92),
|
||||
INVALID_GROUP_BLOCK_DELAY(93),
|
||||
NOT_YET_RELEASED(1000);
|
||||
|
||||
public final int value;
|
||||
|
@@ -83,6 +83,16 @@ public class UpdateGroupTransaction extends Transaction {
|
||||
if (updateGroupTransactionData.getNewApprovalThreshold() == null)
|
||||
return ValidationResult.INVALID_GROUP_APPROVAL_THRESHOLD;
|
||||
|
||||
// Check min/max block delay values
|
||||
if (updateGroupTransactionData.getNewMinimumBlockDelay() < 0)
|
||||
return ValidationResult.INVALID_GROUP_BLOCK_DELAY;
|
||||
|
||||
if (updateGroupTransactionData.getNewMaximumBlockDelay() < 1)
|
||||
return ValidationResult.INVALID_GROUP_BLOCK_DELAY;
|
||||
|
||||
if (updateGroupTransactionData.getNewMaximumBlockDelay() < updateGroupTransactionData.getNewMinimumBlockDelay())
|
||||
return ValidationResult.INVALID_GROUP_BLOCK_DELAY;
|
||||
|
||||
// Check new description size bounds
|
||||
int newDescriptionLength = Utf8.encodedLength(updateGroupTransactionData.getNewDescription());
|
||||
if (newDescriptionLength < 1 || newDescriptionLength > Group.MAX_DESCRIPTION_SIZE)
|
||||
|
Reference in New Issue
Block a user