Skip to content

Commit 8747ab0

Browse files
committed
update ABI search func
1 parent ff4ab00 commit 8747ab0

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/main/java/org/tron/common/runtime/vm/LogInfoTriggerParser.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ public List<ContractTrigger> parseLogInfos(List<LogInfo> logInfos, Deposit depos
5050

5151
byte[] contractAddress = logInfo.getAddress();
5252
String strContractAddr = ArrayUtils.isEmpty(contractAddress) ? "" : Wallet.encode58Check(contractAddress);
53-
ABI abi = abiMap.get(contractAddress);
54-
if (abi == null) {
55-
abi = deposit.getContract(contractAddress).getInstance().getAbi();
56-
abiMap.put(contractAddress, abi);
57-
}
58-
// calculate the sha3 of the event signature first.
59-
if (abi != null && abi.getEntrysCount() > 0) {
60-
for (ABI.Entry entry : abi.getEntrysList()) {
61-
if (entry.getType() != ABI.Entry.EntryType.Event || entry.getAnonymous()) {
62-
continue;
53+
if (signMap.get(strContractAddr) == null) {
54+
ABI abi = deposit.getContract(contractAddress).getInstance().getAbi();
55+
signMap.put(strContractAddr, "1"); // mark as found.
56+
57+
// calculate the sha3 of the event signature first.
58+
if (abi != null && abi.getEntrysCount() > 0) {
59+
for (ABI.Entry entry : abi.getEntrysList()) {
60+
if (entry.getType() != ABI.Entry.EntryType.Event || entry.getAnonymous()) {
61+
continue;
62+
}
63+
String signature = getEntrySignature(entry);
64+
String sha3 = Hex.toHexString(Hash.sha3(signature.getBytes()));
65+
fullMap.put(strContractAddr + "_" + sha3, entry);
66+
signMap.put(strContractAddr + "_" + sha3, signature);
6367
}
64-
String signature = getEntrySignature(entry);
65-
String sha3 = Hex.toHexString(Hash.sha3(signature.getBytes()));
66-
fullMap.put(strContractAddr + "_" + sha3, entry);
67-
signMap.put(strContractAddr + "_" + sha3, signature);
6868
}
6969
}
7070
}

0 commit comments

Comments
 (0)