From 5e82de667ecfc4ffff5fb51fd31c31b1acb75eea Mon Sep 17 00:00:00 2001 From: CalDescent Date: Wed, 3 Nov 2021 21:40:15 +0000 Subject: [PATCH] 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. --- .../controller/arbitrary/ArbitraryDataManager.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/qortal/controller/arbitrary/ArbitraryDataManager.java b/src/main/java/org/qortal/controller/arbitrary/ArbitraryDataManager.java index 0f88149c..33e104c5 100644 --- a/src/main/java/org/qortal/controller/arbitrary/ArbitraryDataManager.java +++ b/src/main/java/org/qortal/controller/arbitrary/ArbitraryDataManager.java @@ -514,10 +514,13 @@ public class ArbitraryDataManager extends Thread { // data cache so that it is rebuilt the next time we serve it invalidateCache(arbitraryTransactionData); - // We 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 - Message newArbitrarySignatureMessage = new ArbitrarySignaturesMessage(null, Arrays.asList(signature)); - Network.getInstance().broadcast(broadcastPeer -> newArbitrarySignatureMessage); + // 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 (we may have requested them for viewing only) + if (ArbitraryDataStorageManager.getInstance().shouldStoreDataForName(arbitraryTransactionData.getName())) { + // 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) {