Skip to content

Commit

Permalink
feat: not allowing selfish nodes to provide services
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanCapistrano committed Mar 16, 2024
1 parent 48566b1 commit ac2de04
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/reputation/node/models/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import br.uefs.larsid.extended.mapping.devices.services.IDevicePropertiesManager;
import br.ufba.dcc.wiser.soft_iot.entities.Device;
import br.ufba.dcc.wiser.soft_iot.entities.Sensor;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import dlt.client.tangle.hornet.enums.TransactionType;
Expand Down Expand Up @@ -188,8 +187,12 @@ public void requestDataFromRandomDevice() {
* @throws InterruptedException
*/
private void publishNodeServices(String serviceType, String target) {
/* Só responde se tiver pelo menos um dispositivo conectado ao nó. */
if (this.amountDevices > 0) {
/* Só responde se tiver pelo menos um dispositivo conectado ao nó, e não
seja um nó do tipo Egoísta. */
if (
this.amountDevices > 0 &&
!this.getNodeType().getType().toString().equals("SELFISH")
) {
logger.info("Requested service type: " + serviceType);

Transaction transaction = null;
Expand Down

0 comments on commit ac2de04

Please sign in to comment.