Skip to content

Commit cfe0d55

Browse files
committed
mdf trx msg
1 parent b4de313 commit cfe0d55

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/org/tron/core/net/message/TransactionMessage.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
package org.tron.core.net.message;
22

3+
import org.tron.common.utils.Sha256Hash;
34
import org.tron.core.capsule.TransactionCapsule;
45
import org.tron.protos.Protocol;
56
import org.tron.protos.Protocol.Transaction;
67

78
public class TransactionMessage extends TronMessage {
89

910
private Transaction trx;
11+
private TransactionCapsule transactionCapsule;
1012

1113
public TransactionMessage(byte[] data) throws Exception {
1214
this.type = MessageTypes.TRX.asByte();
1315
this.data = data;
1416
this.trx = Protocol.Transaction.parseFrom(data);
17+
this.transactionCapsule = new TransactionCapsule(this.trx);
1518
}
1619

1720
public TransactionMessage(Transaction trx) {
1821
this.trx = trx;
22+
this.transactionCapsule = new TransactionCapsule(this.trx);
1923
this.type = MessageTypes.TRX.asByte();
2024
this.data = trx.toByteArray();
2125
}
@@ -26,6 +30,11 @@ public String toString() {
2630
.append("messageId: ").append(super.getMessageId()).toString();
2731
}
2832

33+
@Override
34+
public Sha256Hash getMessageId() {
35+
return this.transactionCapsule.getTransactionId();
36+
}
37+
2938
@Override
3039
public Class<?> getAnswerMessage() {
3140
return null;
@@ -36,7 +45,7 @@ public Transaction getTransaction() {
3645
}
3746

3847
public TransactionCapsule getTransactionCapsule() {
39-
return new TransactionCapsule(getTransaction());
48+
return this.transactionCapsule;
4049
}
4150

4251
}

0 commit comments

Comments
 (0)