aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2019-04-02 13:25:21 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2019-04-02 14:02:06 +0200
commit32ec900850446f60d13c8421c4a91f4fff912d13 (patch)
tree7a35f91f61d67cc9295daf467edb52071741552c /src/wallet/wallet.cpp
parent7bcf90cb01aa964a54e3450ec5515e67db7088b7 (diff)
parent95faffed264cf54a3b3041db2471c10f5011aabe (diff)
Merge #15691: 0.18: rc3 backportsv0.18.0rc3
95faffed264cf54a3b3041db2471c10f5011aabe qa: Check unconfirmed balance after loadwallet (João Barbosa) 59716ec395daaf914924fe5c1a4fbeb5d5031907 wallet: Update transactions with current mempool after load (João Barbosa) ed0498af2827ccf033c9a7c4f46b82424e411083 interfaces: Add Chain::requestMempoolTransactions (João Barbosa) ebf65666c26b7e2dff1b35b17d8fc466c3f347a6 wallet: Move CWallet::ReacceptWalletTransactions locks to callers (João Barbosa) a90db2f175f86b78d8edc5c03b7bb351c8f43e5e [tests] Add test for wallet rebroadcasts (John Newbery) 50c56f2fcf00385dbe8f91588af3ee1a89a9d2d0 Interrupt orphan processing after every transaction (Pieter Wuille) bb60121da1eb3484ecf20c5d1130d9e2f6f8f8c8 [MOVEONLY] Move processing of orphan queue to ProcessOrphanTx (Pieter Wuille) 6355214fd70ce7b44739acb8d546aaaf243f90b3 Simplify orphan processing in preparation for interruptibility (Pieter Wuille) Pull request description: Remaining backports for rc3 ACKs for commit 95faff: promag: ACK 95faffe, well done in ed0498af2827ccf033c9a7c4f46b82424e411083 - verified all cherry picks. Tree-SHA512: 597ee45493ac04e8c3149628a357c3238169d4b4f78158f22a3531e5f66289c228ecd6582f99026698883216f1ee7934d6315d19c99fc5f4f33dd1bed4300186
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 388422bec8..b1b2a63166 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1859,13 +1859,11 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
return result;
}
-void CWallet::ReacceptWalletTransactions()
+void CWallet::ReacceptWalletTransactions(interfaces::Chain::Lock& locked_chain)
{
// If transactions aren't being broadcasted, don't let them into local mempool either
if (!fBroadcastTransactions)
return;
- auto locked_chain = chain().lock();
- LOCK(cs_wallet);
std::map<int64_t, CWalletTx*> mapSorted;
// Sort pending wallet transactions based on their initial wallet insertion order
@@ -1875,7 +1873,7 @@ void CWallet::ReacceptWalletTransactions()
CWalletTx& wtx = item.second;
assert(wtx.GetHash() == wtxid);
- int nDepth = wtx.GetDepthInMainChain(*locked_chain);
+ int nDepth = wtx.GetDepthInMainChain(locked_chain);
if (!wtx.IsCoinBase() && (nDepth == 0 && !wtx.isAbandoned())) {
mapSorted.insert(std::make_pair(wtx.nOrderPos, &wtx));
@@ -1886,7 +1884,7 @@ void CWallet::ReacceptWalletTransactions()
for (const std::pair<const int64_t, CWalletTx*>& item : mapSorted) {
CWalletTx& wtx = *(item.second);
CValidationState state;
- wtx.AcceptToMemoryPool(*locked_chain, maxTxFee, state);
+ wtx.AcceptToMemoryPool(locked_chain, maxTxFee, state);
}
}
@@ -4425,9 +4423,15 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
void CWallet::postInitProcess()
{
+ auto locked_chain = chain().lock();
+ LOCK(cs_wallet);
+
// Add wallet transactions that aren't already in a block to mempool
// Do this here as mempool requires genesis block to be loaded
- ReacceptWalletTransactions();
+ ReacceptWalletTransactions(*locked_chain);
+
+ // Update wallet transactions with current mempool transactions.
+ chain().requestMempoolTransactions([this](const CTransactionRef& tx) { TransactionAddedToMempool(tx); });
}
bool CWallet::BackupWallet(const std::string& strDest)