Don't broadcast that we are holding files for a transaction unless it's within the scope of our storage policy.

We may need to temporarily hold files for the purpose of viewing, but restrictions need to be in place to avoid these being served to peers of stored for longer than they are needed.
This commit is contained in:
CalDescent 2021-11-03 21:40:15 +00:00
parent d7ddcda9da
commit 5e82de667e

View File

@ -514,10 +514,13 @@ public class ArbitraryDataManager extends Thread {
// 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
invalidateCache(arbitraryTransactionData); invalidateCache(arbitraryTransactionData);
// We 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,
// Use a null peer address to indicate our own // but only if these files are in accordance with our storage policy (we may have requested them for viewing only)
Message newArbitrarySignatureMessage = new ArbitrarySignaturesMessage(null, Arrays.asList(signature)); if (ArbitraryDataStorageManager.getInstance().shouldStoreDataForName(arbitraryTransactionData.getName())) {
Network.getInstance().broadcast(broadcastPeer -> newArbitrarySignatureMessage); // Use a null peer address to indicate our own
Message newArbitrarySignatureMessage = new ArbitrarySignaturesMessage(null, Arrays.asList(signature));
Network.getInstance().broadcast(broadcastPeer -> newArbitrarySignatureMessage);
}
} }
} catch (DataException | InterruptedException e) { } catch (DataException | InterruptedException e) {