forked from Qortal/qortal
Don't respond with a file list for a transaction that is outside of our storage policy, even if we do have a copy of the file at the time of the request.
This commit is contained in:
parent
5e82de667e
commit
e50fd786da
@ -587,6 +587,9 @@ public class ArbitraryDataManager extends Thread {
|
|||||||
ArbitraryTransactionData transactionData = (ArbitraryTransactionData)repository.getTransactionRepository().fromSignature(signature);
|
ArbitraryTransactionData transactionData = (ArbitraryTransactionData)repository.getTransactionRepository().fromSignature(signature);
|
||||||
if (transactionData instanceof ArbitraryTransactionData) {
|
if (transactionData instanceof ArbitraryTransactionData) {
|
||||||
|
|
||||||
|
// Check if we're even allowed to serve data for this transaction
|
||||||
|
if (ArbitraryDataStorageManager.getInstance().shouldStoreDataForName(transactionData.getName())) {
|
||||||
|
|
||||||
byte[] hash = transactionData.getData();
|
byte[] hash = transactionData.getData();
|
||||||
byte[] chunkHashes = transactionData.getChunkHashes();
|
byte[] chunkHashes = transactionData.getChunkHashes();
|
||||||
|
|
||||||
@ -598,19 +601,18 @@ public class ArbitraryDataManager extends Thread {
|
|||||||
if (chunk.exists()) {
|
if (chunk.exists()) {
|
||||||
hashes.add(chunk.getHash());
|
hashes.add(chunk.getHash());
|
||||||
//LOGGER.info("Added hash {}", chunk.getHash58());
|
//LOGGER.info("Added hash {}", chunk.getHash58());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
LOGGER.info("Couldn't add hash {} because it doesn't exist", chunk.getHash58());
|
LOGGER.info("Couldn't add hash {} because it doesn't exist", chunk.getHash58());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// This transaction has no chunks, so include the complete file if we have it
|
// This transaction has no chunks, so include the complete file if we have it
|
||||||
if (arbitraryDataFile.exists()) {
|
if (arbitraryDataFile.exists()) {
|
||||||
hashes.add(arbitraryDataFile.getHash());
|
hashes.add(arbitraryDataFile.getHash());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
LOGGER.error(String.format("Repository issue while fetching arbitrary file list for peer %s", peer), e);
|
LOGGER.error(String.format("Repository issue while fetching arbitrary file list for peer %s", peer), e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user