Skip to content

Commit ac2de04

Browse files
feat: not allowing selfish nodes to provide services
1 parent 48566b1 commit ac2de04

File tree

1 file changed

+6
-3
lines changed
  • src/main/java/reputation/node/models

1 file changed

+6
-3
lines changed

src/main/java/reputation/node/models/Node.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import br.uefs.larsid.extended.mapping.devices.services.IDevicePropertiesManager;
44
import br.ufba.dcc.wiser.soft_iot.entities.Device;
55
import br.ufba.dcc.wiser.soft_iot.entities.Sensor;
6-
76
import com.google.gson.JsonElement;
87
import com.google.gson.JsonObject;
98
import dlt.client.tangle.hornet.enums.TransactionType;
@@ -188,8 +187,12 @@ public void requestDataFromRandomDevice() {
188187
* @throws InterruptedException
189188
*/
190189
private void publishNodeServices(String serviceType, String target) {
191-
/* Só responde se tiver pelo menos um dispositivo conectado ao nó. */
192-
if (this.amountDevices > 0) {
190+
/* Só responde se tiver pelo menos um dispositivo conectado ao nó, e não
191+
seja um nó do tipo Egoísta. */
192+
if (
193+
this.amountDevices > 0 &&
194+
!this.getNodeType().getType().toString().equals("SELFISH")
195+
) {
193196
logger.info("Requested service type: " + serviceType);
194197

195198
Transaction transaction = null;

0 commit comments

Comments
 (0)