Remove max coin supply aspects

Maximum amount/price for selling a name limited to 10 billion,
with 8 decimal prices, so encoding fits within 8 bytes.
This commit is contained in:
catbref 2019-10-02 13:24:17 +01:00
parent 4062bdb7bb
commit a0be1273c7
3 changed files with 4 additions and 21 deletions

View File

@ -1397,17 +1397,4 @@ public class Block {
atRepository.deleteATStates(this.blockData.getHeight());
}
/**
* Return Qora balance adjusted to within min/max limits.
*/
public static BigDecimal minMaxBalance(BigDecimal balance) {
if (balance.compareTo(Block.MIN_BALANCE) < 0)
return Block.MIN_BALANCE;
if (balance.compareTo(BlockChain.getInstance().getMaxBalance()) > 0)
return BlockChain.getInstance().getMaxBalance();
return balance;
}
}

View File

@ -51,8 +51,6 @@ public class BlockChain {
// Properties
private boolean isTestChain = false;
/** Maximum coin supply. */
private BigDecimal maxBalance;
/** Transaction expiry period, starting from transaction's timestamp, in milliseconds. */
private long transactionExpiryPeriod;
@ -242,10 +240,6 @@ public class BlockChain {
return this.minFeePerByte;
}
public BigDecimal getMaxBalance() {
return this.maxBalance;
}
public long getTransactionExpiryPeriod() {
return this.transactionExpiryPeriod;
}

View File

@ -7,7 +7,6 @@ import java.util.List;
import org.qora.account.Account;
import org.qora.account.PublicKeyAccount;
import org.qora.asset.Asset;
import org.qora.block.BlockChain;
import org.qora.data.naming.NameData;
import org.qora.data.transaction.SellNameTransactionData;
import org.qora.data.transaction.TransactionData;
@ -19,6 +18,9 @@ import com.google.common.base.Utf8;
public class SellNameTransaction extends Transaction {
/** Maximum amount/price for selling a name. Chosen so value, including 8 decimal places, encodes into 8 bytes or fewer. */
private static final BigDecimal MAX_AMOUNT = BigDecimal.valueOf(10_000_000_000L);
// Properties
private SellNameTransactionData sellNameTransactionData;
@ -97,7 +99,7 @@ public class SellNameTransaction extends Transaction {
return ValidationResult.NEGATIVE_AMOUNT;
// Check amount within bounds
if (sellNameTransactionData.getAmount().compareTo(BlockChain.getInstance().getMaxBalance()) > 0)
if (sellNameTransactionData.getAmount().compareTo(MAX_AMOUNT) >= 0)
return ValidationResult.INVALID_AMOUNT;
// Check fee is positive