File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed
src/AElf.WebApp.Application.Chain/Services
test/AElf.WebApp.Application.Chain.Tests Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,14 @@ public async Task<TransactionResultDto> GetTransactionResultV2Async(string trans
152152 output . Transaction = _objectMapper . Map < Transaction , TransactionDto > ( transaction ) ;
153153 output . TransactionSize = transaction ? . CalculateSize ( ) ?? 0 ;
154154
155+ var chain = await _blockchainService . GetChainAsync ( ) ;
156+ if ( transactionResult . Status == TransactionResultStatus . Pending &&
157+ chain . BestChainHeight - output . Transaction ? . RefBlockNumber > KernelConstants . ReferenceBlockValidPeriod )
158+ {
159+ output . StatusV2 = TransactionResultStatus . Expired . ToString ( ) . ToUpper ( ) ;
160+ return output ;
161+ }
162+
155163 if ( transactionResult . Status != TransactionResultStatus . NotExisted )
156164 {
157165 await FormatTransactionParamsAsync ( output . Transaction , transaction . Params ) ;
@@ -179,14 +187,6 @@ await _transactionResultProxyService.InvalidTransactionResultService.GetInvalidT
179187 return output ;
180188 }
181189 }
182-
183- var chain = await _blockchainService . GetChainAsync ( ) ;
184- if ( chain . BestChainHeight - output . Transaction ? . RefBlockNumber > KernelConstants . ReferenceBlockValidPeriod
185- && transactionResult . Status == TransactionResultStatus . NotExisted )
186- {
187- output . StatusV2 = TransactionResultStatus . Expired . ToString ( ) . ToUpper ( ) ;
188- return output ;
189- }
190190
191191 return output ;
192192 }
Original file line number Diff line number Diff line change @@ -698,14 +698,11 @@ public async Task Get_TransactionResultV2_Expired_Test()
698698
699699 // Broadcast expired transaction
700700 await _osTestHelper . BroadcastTransactions ( new List < Transaction > { transaction } ) ;
701-
702- // Try to package this transaction
703- await _osTestHelper . MinedOneBlock ( ) ;
704701
705702 // Check transaction status
706703 var response = await GetResponseAsObjectAsync < TransactionResultDto > (
707704 $ "/api/blockChain/transactionResultV2?transactionId={ transactionHex } ") ;
708- // response.StatusV2.ShouldBe(TransactionResultStatus.Expired.ToString());
705+ response . StatusV2 . ShouldBe ( TransactionResultStatus . Expired . ToString ( ) . ToUpper ( ) ) ;
709706 }
710707
711708 private async Task MineSomeBlocks ( int blockNumber )
You can’t perform that action at this time.
0 commit comments