diff options
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r-- | src/wallet/wallet.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 81a9932f36..cb20998d26 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -35,8 +35,8 @@ bool bSpendZeroConfChange = true; bool fSendFreeTransactions = false; bool fPayAtLeastCustomFee = true; -/** - * Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) +/** + * Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) * Override with -mintxfee */ CFeeRate CWallet::minTxFee = CFeeRate(1000); @@ -529,7 +529,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase) delete pwalletdbEncryption; } // We now probably have half of our keys encrypted in memory, and half not... - // die and let the user reload their unencrypted wallet. + // die and let the user reload the unencrypted wallet. assert(false); } @@ -541,7 +541,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase) if (!pwalletdbEncryption->TxnCommit()) { delete pwalletdbEncryption; // We now have keys encrypted in memory, but not on disk... - // die to avoid confusion and let the user reload their unencrypted wallet. + // die to avoid confusion and let the user reload the unencrypted wallet. assert(false); } @@ -1097,10 +1097,13 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate) void CWallet::ReacceptWalletTransactions() { - // If transcations aren't broadcasted, don't let them into local mempool either + // If transactions aren't being broadcasted, don't let them into local mempool either if (!fBroadcastTransactions) return; 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) { const uint256& wtxid = item.first; @@ -1109,13 +1112,19 @@ void CWallet::ReacceptWalletTransactions() int nDepth = wtx.GetDepthInMainChain(); - if (!wtx.IsCoinBase() && nDepth < 0) - { - // Try to add to memory pool - LOCK(mempool.cs); - wtx.AcceptToMemoryPool(false); + if (!wtx.IsCoinBase() && nDepth < 0) { + mapSorted.insert(std::make_pair(wtx.nOrderPos, &wtx)); } } + + // 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() |