forked from Qortal/qortal
Limit both divisible & indivisible asset quantites to 1e10 (with 8dp) to fit into 8byte long
This commit is contained in:
parent
ac15dfe789
commit
2602bb01e1
@ -25,8 +25,7 @@ public class Asset {
|
||||
public static final int MAX_DESCRIPTION_SIZE = 4000;
|
||||
public static final int MAX_DATA_SIZE = 400000;
|
||||
|
||||
public static final long MAX_DIVISIBLE_QUANTITY = 10_000_000_000L; // but also to 8 decimal places
|
||||
public static final long MAX_INDIVISIBLE_QUANTITY = 1_000_000_000_000_000_000L;
|
||||
public static final long MAX_QUANTITY = 10_000_000_000L; // but also to 8 decimal places
|
||||
|
||||
// Properties
|
||||
private Repository repository;
|
||||
|
@ -95,9 +95,8 @@ public class IssueAssetTransaction extends Transaction {
|
||||
if (assetDescriptionlength < 1 || assetDescriptionlength > Asset.MAX_DESCRIPTION_SIZE)
|
||||
return ValidationResult.INVALID_DESCRIPTION_LENGTH;
|
||||
|
||||
// Check quantity - either 10 billion or if that's not enough: a billion billion!
|
||||
long maxQuantity = issueAssetTransactionData.getIsDivisible() ? Asset.MAX_DIVISIBLE_QUANTITY : Asset.MAX_INDIVISIBLE_QUANTITY;
|
||||
if (issueAssetTransactionData.getQuantity() < 1 || issueAssetTransactionData.getQuantity() > maxQuantity)
|
||||
// Check quantity
|
||||
if (issueAssetTransactionData.getQuantity() < 1 || issueAssetTransactionData.getQuantity() > Asset.MAX_QUANTITY)
|
||||
return ValidationResult.INVALID_QUANTITY;
|
||||
|
||||
// Check fee is positive
|
||||
|
Loading…
x
Reference in New Issue
Block a user