mirror of
https://github.com/Qortal/qortal.git
synced 2025-04-23 19:37:51 +00:00
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_DESCRIPTION_SIZE = 4000;
|
||||||
public static final int MAX_DATA_SIZE = 400000;
|
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_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;
|
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
private Repository repository;
|
private Repository repository;
|
||||||
|
@ -95,9 +95,8 @@ public class IssueAssetTransaction extends Transaction {
|
|||||||
if (assetDescriptionlength < 1 || assetDescriptionlength > Asset.MAX_DESCRIPTION_SIZE)
|
if (assetDescriptionlength < 1 || assetDescriptionlength > Asset.MAX_DESCRIPTION_SIZE)
|
||||||
return ValidationResult.INVALID_DESCRIPTION_LENGTH;
|
return ValidationResult.INVALID_DESCRIPTION_LENGTH;
|
||||||
|
|
||||||
// Check quantity - either 10 billion or if that's not enough: a billion billion!
|
// Check quantity
|
||||||
long maxQuantity = issueAssetTransactionData.getIsDivisible() ? Asset.MAX_DIVISIBLE_QUANTITY : Asset.MAX_INDIVISIBLE_QUANTITY;
|
if (issueAssetTransactionData.getQuantity() < 1 || issueAssetTransactionData.getQuantity() > Asset.MAX_QUANTITY)
|
||||||
if (issueAssetTransactionData.getQuantity() < 1 || issueAssetTransactionData.getQuantity() > maxQuantity)
|
|
||||||
return ValidationResult.INVALID_QUANTITY;
|
return ValidationResult.INVALID_QUANTITY;
|
||||||
|
|
||||||
// Check fee is positive
|
// Check fee is positive
|
||||||
|
Loading…
x
Reference in New Issue
Block a user