Major upgrade of arbitrary transactions

- Adds support for files up 500MiB per transaction (at 2MiB chunk sizes). Previously, the max data size was 4000 bytes.
- Adds a nonce, giving us the option to remove the transaction fees altogether on the data chain.

These features become enabled in version 5 of arbitrary transactions.
This commit is contained in:
CalDescent
2021-07-03 17:40:02 +01:00
parent 7cc2c4f621
commit 5f4649ee2b
7 changed files with 347 additions and 102 deletions

View File

@@ -18,6 +18,9 @@ public class ArbitraryTestTransaction extends TestTransaction {
public static TransactionData randomTransaction(Repository repository, PrivateKeyAccount account, boolean wantValid) throws DataException {
final int version = 4;
final int service = 123;
final int nonce = 0; // Version 4 doesn't need a nonce
final int size = 0; // Version 4 doesn't need a size
final byte[] chunkHashes = null; // Version 4 doesn't use chunk hashes
byte[] data = new byte[1024];
random.nextBytes(data);
@@ -31,7 +34,7 @@ public class ArbitraryTestTransaction extends TestTransaction {
List<PaymentData> payments = new ArrayList<>();
payments.add(new PaymentData(recipient, assetId, amount));
return new ArbitraryTransactionData(generateBase(account), version, service, data, dataType, payments);
return new ArbitraryTransactionData(generateBase(account), version, service, nonce, size, data, dataType, chunkHashes, payments);
}
}