forked from Qortal/qortal
Slightly optimized logic in fetchArbitraryDataFiles()
This commit is contained in:
parent
fa447ccded
commit
9ec4e24ef6
@ -170,22 +170,23 @@ public class ArbitraryDataFileManager extends Thread {
|
|||||||
|
|
||||||
// Invalidate the hosted transactions cache as we are now hosting something new
|
// Invalidate the hosted transactions cache as we are now hosting something new
|
||||||
ArbitraryDataStorageManager.getInstance().invalidateHostedTransactionsCache();
|
ArbitraryDataStorageManager.getInstance().invalidateHostedTransactionsCache();
|
||||||
}
|
|
||||||
|
|
||||||
// Check if we have all the files we need for this transaction
|
// Check if we have all the files we need for this transaction
|
||||||
if (arbitraryDataFile.allFilesExist()) {
|
if (arbitraryDataFile.allFilesExist()) {
|
||||||
|
|
||||||
// We have all the chunks for this transaction, so we should invalidate the transaction's name's
|
// We have all the chunks for this transaction, so we should invalidate the transaction's name's
|
||||||
// data cache so that it is rebuilt the next time we serve it
|
// data cache so that it is rebuilt the next time we serve it
|
||||||
ArbitraryDataManager.getInstance().invalidateCache(arbitraryTransactionData);
|
ArbitraryDataManager.getInstance().invalidateCache(arbitraryTransactionData);
|
||||||
|
|
||||||
// We may also need to broadcast to the network that we are now hosting files for this transaction,
|
// We may also need to broadcast to the network that we are now hosting files for this transaction,
|
||||||
// but only if these files are in accordance with our storage policy
|
// but only if these files are in accordance with our storage policy
|
||||||
if (ArbitraryDataStorageManager.getInstance().canStoreData(arbitraryTransactionData)) {
|
if (ArbitraryDataStorageManager.getInstance().canStoreData(arbitraryTransactionData)) {
|
||||||
// Use a null peer address to indicate our own
|
// Use a null peer address to indicate our own
|
||||||
Message newArbitrarySignatureMessage = new ArbitrarySignaturesMessage(null, 0, Arrays.asList(signature));
|
Message newArbitrarySignatureMessage = new ArbitrarySignaturesMessage(null, 0, Arrays.asList(signature));
|
||||||
Network.getInstance().broadcast(broadcastPeer -> newArbitrarySignatureMessage);
|
Network.getInstance().broadcast(broadcastPeer -> newArbitrarySignatureMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return receivedAtLeastOneFile;
|
return receivedAtLeastOneFile;
|
||||||
|
Loading…
Reference in New Issue
Block a user