mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge pull request #5511
e9c3215
[Wallet] sort pending wallet transactions before reaccepting (dexX7)
This commit is contained in:
commit
23c998d811
@ -1101,6 +1101,9 @@ void CWallet::ReacceptWalletTransactions()
|
|||||||
if (!fBroadcastTransactions)
|
if (!fBroadcastTransactions)
|
||||||
return;
|
return;
|
||||||
LOCK2(cs_main, cs_wallet);
|
LOCK2(cs_main, cs_wallet);
|
||||||
|
std::map<int64_t, CWalletTx*> mapSorted;
|
||||||
|
|
||||||
|
// Sort pending wallet transactions based on their initial wallet insertion order
|
||||||
BOOST_FOREACH(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet)
|
BOOST_FOREACH(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet)
|
||||||
{
|
{
|
||||||
const uint256& wtxid = item.first;
|
const uint256& wtxid = item.first;
|
||||||
@ -1109,13 +1112,19 @@ void CWallet::ReacceptWalletTransactions()
|
|||||||
|
|
||||||
int nDepth = wtx.GetDepthInMainChain();
|
int nDepth = wtx.GetDepthInMainChain();
|
||||||
|
|
||||||
if (!wtx.IsCoinBase() && nDepth < 0)
|
if (!wtx.IsCoinBase() && nDepth < 0) {
|
||||||
{
|
mapSorted.insert(std::make_pair(wtx.nOrderPos, &wtx));
|
||||||
// Try to add to memory pool
|
|
||||||
LOCK(mempool.cs);
|
|
||||||
wtx.AcceptToMemoryPool(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to add wallet transactions to memory pool
|
||||||
|
BOOST_FOREACH(PAIRTYPE(const int64_t, CWalletTx*)& item, mapSorted)
|
||||||
|
{
|
||||||
|
CWalletTx& wtx = *(item.second);
|
||||||
|
|
||||||
|
LOCK(mempool.cs);
|
||||||
|
wtx.AcceptToMemoryPool(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWalletTx::RelayWalletTransaction()
|
bool CWalletTx::RelayWalletTransaction()
|
||||||
|
Loading…
Reference in New Issue
Block a user