mirror of
https://github.com/Qortal/qortal.git
synced 2025-07-23 04:36:50 +00:00
Implemented automatic PUT/PATCH detection
When using POST /arbitrary/{service}/{name}... it will now automatically decide which method to use (PUT/PATCH) based on a few factors: - If there are already 10 or more layers, use PUT to reset back to a single layer - If the next layer's patch is more than 20% of the total resource file size, use PUT - If the next layer modifies more than 50% of the total file count, use PUT - Otherwise, use PATCH The PUT method causes a new base layer to be created and all previous update history for that resource becomes obsolete. The PATCH method adds a small delta layer on top of the existing layer(s). The idea is to wipe the slate clean with a new base layer once the patches start to get demanding for the network to apply. Nodes which view the content will ultimately have build timeouts to prevent someone from deploying a resource with hundreds of complex layers for example, so this approach is there to maximize the chances of the resource being buildable. The constants above (10 layers, 20% total size, 50% file count) will most likely need tweaking once we have some real world data.
This commit is contained in:
@@ -370,7 +370,8 @@ public class ArbitraryDataTests extends Common {
|
||||
ArbitraryDataTransactionBuilder txnBuilder = new ArbitraryDataTransactionBuilder(
|
||||
publicKey58, path, name, method, service, identifier);
|
||||
|
||||
ArbitraryTransactionData transactionData = txnBuilder.build();
|
||||
txnBuilder.build();
|
||||
ArbitraryTransactionData transactionData = txnBuilder.getArbitraryTransactionData();
|
||||
Transaction.ValidationResult result = TransactionUtils.signAndImport(repository, transactionData, account);
|
||||
assertEquals(Transaction.ValidationResult.OK, result);
|
||||
BlockUtils.mintBlock(repository);
|
||||
|
Reference in New Issue
Block a user