From 7760a8afbf6101c1a18bd713d85ae91f6777de6d Mon Sep 17 00:00:00 2001 From: Michael Tinker Date: Thu, 14 Sep 2023 14:12:16 -0500 Subject: [PATCH] Fix JRS queryable payer record issue (#8618) Signed-off-by: Michael Tinker --- .../mono/state/expiry/ExpiryManager.java | 12 +++++++++--- .../state/logic/AwareNodeDiligenceScreen.java | 19 ------------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/state/expiry/ExpiryManager.java b/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/state/expiry/ExpiryManager.java index 7e0b3d0bb603..b74d985678c9 100644 --- a/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/state/expiry/ExpiryManager.java +++ b/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/state/expiry/ExpiryManager.java @@ -16,8 +16,8 @@ package com.hedera.node.app.service.mono.state.expiry; -import static com.hedera.node.app.service.mono.state.logic.AwareNodeDiligenceScreen.DUE_DILIGENCE_FAILURE_STATUSES; import static com.hedera.node.app.service.mono.utils.EntityNum.MISSING_NUM; +import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_PAYER_SIGNATURE; import static java.util.Comparator.comparing; import static java.util.Objects.requireNonNull; @@ -103,7 +103,7 @@ public void reviewExistingPayerRecords() { requireNonNull(savedRecords.getRecords()).forEach(savedRecord -> { stage(savedRecord); EntityNum queryableAccountNum = MISSING_NUM; - if (DUE_DILIGENCE_FAILURE_STATUSES.contains(savedRecord.getEnumStatus())) { + if (nodeAccountWasPayer(savedRecord)) { final var nodeId = savedRecord.getSubmittingMember(); try { queryableAccountNum = nodeInfo.accountKeyOf(nodeId); @@ -148,7 +148,7 @@ private void purgeExpiredRecordsFromConsolidatedStorageAt(final long now) { } curRecords.poll(); purgeHistoryFor(nextRecord, now); - if (DUE_DILIGENCE_FAILURE_STATUSES.contains(nextRecord.getEnumStatus())) { + if (nodeAccountWasPayer(nextRecord)) { try { final var nodeNum = nodeInfo.accountKeyOf(nextRecord.getSubmittingMember()); purgeQueryableRecord(nodeNum, nextRecord, curQueryableRecords); @@ -239,4 +239,10 @@ private StorageStrategy storageStrategy() { } return strategyInUse; } + + private boolean nodeAccountWasPayer(final ExpirableTxnRecord expirableTxnRecord) { + return INVALID_PAYER_SIGNATURE + .name() + .equals(expirableTxnRecord.getReceipt().getStatus()); + } } diff --git a/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/state/logic/AwareNodeDiligenceScreen.java b/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/state/logic/AwareNodeDiligenceScreen.java index 2ce13fcce1dd..eaadd4100f89 100644 --- a/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/state/logic/AwareNodeDiligenceScreen.java +++ b/hedera-node/hedera-mono-service/src/main/java/com/hedera/node/app/service/mono/state/logic/AwareNodeDiligenceScreen.java @@ -23,12 +23,8 @@ import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_NODE_ACCOUNT; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_PAYER_SIGNATURE; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_TRANSACTION_DURATION; -import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_TRANSACTION_START; -import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_ZERO_BYTE_IN_STRING; -import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.MEMO_TOO_LONG; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.OK; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.PAYER_ACCOUNT_DELETED; -import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TRANSACTION_EXPIRED; import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TRANSACTION_HAS_UNKNOWN_FIELDS; import com.hedera.node.app.service.mono.context.TransactionContext; @@ -38,9 +34,6 @@ import com.hedera.node.app.service.mono.txns.validation.OptionValidator; import com.hedera.node.app.service.mono.utils.accessors.TxnAccessor; import com.hederahashgraph.api.proto.java.AccountID; -import com.hederahashgraph.api.proto.java.ResponseCodeEnum; -import java.util.EnumSet; -import java.util.Set; import javax.inject.Inject; import javax.inject.Singleton; import org.apache.logging.log4j.LogManager; @@ -48,18 +41,6 @@ @Singleton public final class AwareNodeDiligenceScreen { - public static final Set DUE_DILIGENCE_FAILURE_STATUSES = EnumSet.of( - TRANSACTION_HAS_UNKNOWN_FIELDS, - INVALID_NODE_ACCOUNT, - ACCOUNT_ID_DOES_NOT_EXIST, - PAYER_ACCOUNT_DELETED, - INVALID_PAYER_SIGNATURE, - DUPLICATE_TRANSACTION, - INVALID_TRANSACTION_DURATION, - TRANSACTION_EXPIRED, - INVALID_TRANSACTION_START, - MEMO_TOO_LONG, - INVALID_ZERO_BYTE_IN_STRING); private static final Logger log = LogManager.getLogger(AwareNodeDiligenceScreen.class); private static final String WRONG_NODE_LOG_TPL =