@@ -2770,15 +2770,13 @@ public static void performCleanup()
27702770
27712771 public static void processPendingTransactions ( )
27722772 {
2773- // TODO TODO this has to be refactored and moved to PendingTransactions
27742773 ulong last_block_height = IxianHandler . getLastBlockHeight ( ) ;
27752774 lock ( stateLock ) // this lock must be here to prevent deadlocks TODO: improve this at some point
27762775 {
27772776 lock ( PendingTransactions . pendingTransactions )
27782777 {
27792778 long cur_time = Clock . getTimestamp ( ) ;
2780- List < PendingTransaction > tmp_pending_transactions = new List < PendingTransaction > ( PendingTransactions . pendingTransactions ) ;
2781- int idx = 0 ;
2779+ List < PendingTransaction > tmp_pending_transactions = new ( PendingTransactions . pendingTransactions ) ;
27822780 foreach ( var entry in tmp_pending_transactions )
27832781 {
27842782 Transaction t = entry . transaction ;
@@ -2791,8 +2789,10 @@ public static void processPendingTransactions()
27912789 }
27922790
27932791 // if transaction expired, remove it from pending transactions
2794- if ( last_block_height > ConsensusConfig . getRedactedWindowSize ( ) && t . blockHeight < last_block_height - ConsensusConfig . getRedactedWindowSize ( ) )
2792+ if ( last_block_height > ConsensusConfig . getRedactedWindowSize ( )
2793+ && t . blockHeight < last_block_height - ConsensusConfig . getRedactedWindowSize ( ) )
27952794 {
2795+ Logging . error ( "Error sending the transaction {0}, expired" , t . getTxIdString ( ) ) ;
27962796 Node . activityStorage . updateStatus ( t . id , ActivityStatus . Error , 0 ) ;
27972797 PendingTransactions . pendingTransactions . RemoveAll ( x => x . transaction . id . SequenceEqual ( t . id ) ) ;
27982798 continue ;
@@ -2822,29 +2822,15 @@ public static void processPendingTransactions()
28222822 }
28232823 }
28242824
2825- if ( ( int ) entry . confirmedNodeList . Count ( ) > 3 ) // already received 3+ feedback
2826- {
2827- continue ;
2828- }
2829-
2830- if ( cur_time - tx_time > 40 ) // if the transaction is pending for over 40 seconds, resend
2825+ if ( cur_time - tx_time > 60 ) // if the transaction is pending for over 60 seconds, resend
28312826 {
2827+ Logging . warn ( "Transaction {0} pending for a while, resending" , t . getTxIdString ( ) ) ;
28322828 CoreProtocolMessage . broadcastProtocolMessage ( new char [ ] { 'M' , 'H' } , ProtocolMessageCode . transactionData2 , t . getBytes ( true , true ) , null ) ;
2829+
28332830 entry . addedTimestamp = cur_time ;
28342831 entry . confirmedNodeList . Clear ( ) ;
2832+ entry . rejectedNodeList . Clear ( ) ;
28352833 }
2836-
2837- if ( entry . confirmedNodeList . Count ( ) > 3 ) // already received 3+ feedback
2838- {
2839- continue ;
2840- }
2841-
2842- if ( cur_time - tx_time > 20 ) // if the transaction is pending for over 20 seconds, send inquiry
2843- {
2844- CoreProtocolMessage . broadcastGetTransaction ( t . id , 0 , null , false ) ;
2845- }
2846-
2847- idx ++ ;
28482834 }
28492835 }
28502836 }
0 commit comments