mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-12 18:25:49 +00:00
Prevent arbitrary data transactions being created unless the network supports it (i.e. the hard fork has taken place).
This commit is contained in:
parent
d3862c97ba
commit
b7bcd8da7d
@ -31,6 +31,9 @@ public class ArbitraryDataTransactionBuilder {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(ArbitraryDataTransactionBuilder.class);
|
||||
|
||||
// Min transaction version required
|
||||
private static final int MIN_TRANSACTION_VERSION = 5;
|
||||
|
||||
// Maximum number of PATCH layers allowed
|
||||
private static final int MAX_LAYERS = 10;
|
||||
// Maximum size difference (out of 1) allowed for PATCH transactions
|
||||
@ -132,6 +135,13 @@ public class ArbitraryDataTransactionBuilder {
|
||||
private void createTransaction() throws DataException {
|
||||
ArbitraryDataFile arbitraryDataFile = null;
|
||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||
Long now = NTP.getTime();
|
||||
|
||||
// Ensure that this chain supports transactions necessary for complex arbitrary data
|
||||
int transactionVersion = Transaction.getVersionByTimestamp(now);
|
||||
if (transactionVersion < MIN_TRANSACTION_VERSION) {
|
||||
throw new DataException(String.format("Transaction version unsupported on this blockchain."));
|
||||
}
|
||||
|
||||
if (publicKey58 == null || path == null) {
|
||||
throw new DataException("Missing public key or path");
|
||||
@ -172,7 +182,7 @@ public class ArbitraryDataTransactionBuilder {
|
||||
throw new DataException("Unable to calculate file digest");
|
||||
}
|
||||
|
||||
final BaseTransactionData baseTransactionData = new BaseTransactionData(NTP.getTime(), Group.NO_GROUP,
|
||||
final BaseTransactionData baseTransactionData = new BaseTransactionData(now, Group.NO_GROUP,
|
||||
lastReference, creatorPublicKey, BlockChain.getInstance().getUnitFee(), null);
|
||||
final int size = (int) arbitraryDataFile.size();
|
||||
final int version = 5;
|
||||
|
Loading…
x
Reference in New Issue
Block a user