Skip to content

Commit

Permalink
Fix JRS queryable payer record issue (#8618)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Tinker <[email protected]>
  • Loading branch information
tinker-michaelj authored Sep 14, 2023
1 parent 63defe0 commit 7760a8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -239,4 +239,10 @@ private StorageStrategy storageStrategy() {
}
return strategyInUse;
}

private boolean nodeAccountWasPayer(final ExpirableTxnRecord expirableTxnRecord) {
return INVALID_PAYER_SIGNATURE
.name()
.equals(expirableTxnRecord.getReceipt().getStatus());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,28 +34,13 @@
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;
import org.apache.logging.log4j.Logger;

@Singleton
public final class AwareNodeDiligenceScreen {
public static final Set<ResponseCodeEnum> 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 =
Expand Down

0 comments on commit 7760a8a

Please sign in to comment.