File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -1101,6 +1101,9 @@ void CWallet::ReacceptWalletTransactions()
1101
1101
if (!fBroadcastTransactions )
1102
1102
return ;
1103
1103
LOCK2 (cs_main, cs_wallet);
1104
+ std::map<int64_t , CWalletTx*> mapSorted;
1105
+
1106
+ // Sort pending wallet transactions based on their initial wallet insertion order
1104
1107
BOOST_FOREACH (PAIRTYPE (const uint256, CWalletTx)& item, mapWallet)
1105
1108
{
1106
1109
const uint256& wtxid = item.first ;
@@ -1109,13 +1112,19 @@ void CWallet::ReacceptWalletTransactions()
1109
1112
1110
1113
int nDepth = wtx.GetDepthInMainChain ();
1111
1114
1112
- if (!wtx.IsCoinBase () && nDepth < 0 )
1113
- {
1114
- // Try to add to memory pool
1115
- LOCK (mempool.cs );
1116
- wtx.AcceptToMemoryPool (false );
1115
+ if (!wtx.IsCoinBase () && nDepth < 0 ) {
1116
+ mapSorted.insert (std::make_pair (wtx.nOrderPos , &wtx));
1117
1117
}
1118
1118
}
1119
+
1120
+ // Try to add wallet transactions to memory pool
1121
+ BOOST_FOREACH (PAIRTYPE (const int64_t , CWalletTx*)& item, mapSorted)
1122
+ {
1123
+ CWalletTx& wtx = *(item.second );
1124
+
1125
+ LOCK (mempool.cs );
1126
+ wtx.AcceptToMemoryPool (false );
1127
+ }
1119
1128
}
1120
1129
1121
1130
bool CWalletTx::RelayWalletTransaction ()
You can’t perform that action at this time.
0 commit comments