Skip to content

Commit

Permalink
transaction result status optimization, clear return the expired desc…
Browse files Browse the repository at this point in the history
…ription
  • Loading branch information
JimAelf committed Nov 13, 2024
1 parent 88d4e10 commit 1e7c987
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions protobuf/aelf/core.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ enum TransactionResultStatus {
PENDING_VALIDATION = 5;
// Transaction validation failed.
NODE_VALIDATION_FAILED = 6;
// Transaction is expired and will never succeed
EXPIRED = 7;
}

message TransactionResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,16 @@ await _transactionResultProxyService.InvalidTransactionResultService.GetInvalidT
return output;
}
}

return output;

switch (output.BlockNumber - output.Transaction.RefBlockNumber)
{
case > KernelConstants.ReferenceBlockValidPeriod:
output.Status = TransactionResultStatus.Expired.ToString().ToUpper();
output.Error = TransactionErrorResolver.TakeErrorMessage(TransactionResultStatus.Expired.ToString(), _webAppOptions.IsDebugMode);
return output;
default:
return output;
}
}

/// <summary>
Expand Down

0 comments on commit 1e7c987

Please sign in to comment.