Exclude RAW_DATA arbitrary transactions from various arbitrary data controller methods.

This commit is contained in:
CalDescent 2021-12-28 12:01:03 +00:00
parent 1f9f949a8c
commit 302428f1d1

View File

@ -112,6 +112,11 @@ public class ArbitraryDataStorageManager extends Thread {
public boolean canStoreData(ArbitraryTransactionData arbitraryTransactionData) {
String name = arbitraryTransactionData.getName();
// We already have RAW_DATA on chain, so we only need to store data associated with hashes
if (arbitraryTransactionData.getDataType() != ArbitraryTransactionData.DataType.DATA_HASH) {
return false;
}
// Don't store data unless it's an allowed type (public/private)
if (!this.isDataTypeAllowed(arbitraryTransactionData)) {
return false;
@ -148,6 +153,11 @@ public class ArbitraryDataStorageManager extends Thread {
public boolean shouldPreFetchData(Repository repository, ArbitraryTransactionData arbitraryTransactionData) {
String name = arbitraryTransactionData.getName();
// Only fetch data associated with hashes, as we already have RAW_DATA
if (arbitraryTransactionData.getDataType() != ArbitraryTransactionData.DataType.DATA_HASH) {
return false;
}
// Don't fetch anything more if we're (nearly) out of space
// Make sure to keep STORAGE_FULL_THRESHOLD considerably less than 1, to
// avoid a fetch/delete loop