diff --git a/src/main/java/node/type/models/conducts/Honest.java b/src/main/java/node/type/models/conducts/Honest.java index 2b94d25..7442119 100644 --- a/src/main/java/node/type/models/conducts/Honest.java +++ b/src/main/java/node/type/models/conducts/Honest.java @@ -1,14 +1,15 @@ package node.type.models.conducts; + // TODO: Corrigir package em todas as classes. import dlt.client.tangle.hornet.enums.TransactionType; import dlt.client.tangle.hornet.model.transactions.Evaluation; +import dlt.client.tangle.hornet.model.transactions.IndexTransaction; import dlt.client.tangle.hornet.model.transactions.Transaction; +import java.util.logging.Logger; import node.type.enums.ConductType; import node.type.models.tangle.LedgerConnector; -import java.util.logging.Logger; - public class Honest extends Conduct { private static final Logger logger = Logger.getLogger(Honest.class.getName()); @@ -63,6 +64,7 @@ public void evaluateDevice(String deviceId, int value) ); // Adicionando avaliação na Tangle. - this.getLedgerConnector().put(transactionEvaluation); + this.getLedgerConnector() + .put(new IndexTransaction(deviceId, transactionEvaluation)); } } diff --git a/src/main/java/node/type/models/conducts/Malicious.java b/src/main/java/node/type/models/conducts/Malicious.java index 436e56f..7babaed 100644 --- a/src/main/java/node/type/models/conducts/Malicious.java +++ b/src/main/java/node/type/models/conducts/Malicious.java @@ -2,12 +2,12 @@ import dlt.client.tangle.hornet.enums.TransactionType; import dlt.client.tangle.hornet.model.transactions.Evaluation; +import dlt.client.tangle.hornet.model.transactions.IndexTransaction; import dlt.client.tangle.hornet.model.transactions.Transaction; -import node.type.enums.ConductType; -import node.type.models.tangle.LedgerConnector; - import java.util.Random; import java.util.logging.Logger; +import node.type.enums.ConductType; +import node.type.models.tangle.LedgerConnector; public class Malicious extends Conduct { @@ -100,7 +100,8 @@ public void evaluateDevice(String deviceId, int value) ); // Adicionando avaliação na Tangle. - this.getLedgerConnector().put(transactionEvaluation); + this.getLedgerConnector() + .put(new IndexTransaction(deviceId, transactionEvaluation)); } public float getHonestyRate() { diff --git a/src/main/java/node/type/models/tangle/LedgerConnector.java b/src/main/java/node/type/models/tangle/LedgerConnector.java index 3151fe0..d3a20e7 100644 --- a/src/main/java/node/type/models/tangle/LedgerConnector.java +++ b/src/main/java/node/type/models/tangle/LedgerConnector.java @@ -1,5 +1,6 @@ package node.type.models.tangle; +import dlt.client.tangle.hornet.model.transactions.IndexTransaction; import dlt.client.tangle.hornet.model.transactions.Transaction; import dlt.client.tangle.hornet.services.ILedgerReader; import dlt.client.tangle.hornet.services.ILedgerSubscriber; @@ -36,11 +37,13 @@ public void unsubscribe(String topic, ILedgerSubscriber iLedgerSubscriber) { /** * Põe uma transação para ser publicada na Tangle. * - * @param transaction Transaction - Transação que será publicada. + * @param indexTransaction IndexTransaction - Transação que será publicada, + * juntamente com seu índice. * @throws InterruptedException */ - public void put(Transaction transaction) throws InterruptedException { - this.ledgerWriter.put(transaction); + public void put(IndexTransaction indexTransaction) + throws InterruptedException { + this.ledgerWriter.put(indexTransaction); } /**