aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.h
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2017-01-17 18:06:16 -0500
committerMatt Corallo <git@bluematt.me>2017-10-13 19:29:54 -0400
commit5ee31726360cbe343f5a1a50a5e440db736da5b7 (patch)
treed6e3cab34961e1875957bbec38742feccd01f778 /src/wallet/wallet.h
parent0b2f42d7376c5f7c1ba1ac5d17a30691989d9159 (diff)
downloadbitcoin-5ee31726360cbe343f5a1a50a5e440db736da5b7.tar.xz
Add CWallet::BlockUntilSyncedToCurrentChain()
This blocks until the wallet has synced up to the current height.
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r--src/wallet/wallet.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 8315bbf3da..91029ee462 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -722,6 +722,18 @@ private:
std::unique_ptr<CWalletDBWrapper> dbw;
+ /**
+ * The following is used to keep track of how far behind the wallet is
+ * from the chain sync, and to allow clients to block on us being caught up.
+ *
+ * Note that this is *not* how far we've processed, we may need some rescan
+ * to have seen all transactions in the chain, but is only used to track
+ * live BlockConnected callbacks.
+ *
+ * Protected by cs_main (see BlockUntilSyncedToCurrentChain)
+ */
+ const CBlockIndex* m_last_block_processed;
+
public:
/*
* Main wallet lock.
@@ -1106,6 +1118,14 @@ public:
caller must ensure the current wallet version is correct before calling
this function). */
bool SetHDMasterKey(const CPubKey& key);
+
+ /**
+ * Blocks until the wallet state is up-to-date to /at least/ the current
+ * chain at the time this function is entered
+ * Obviously holding cs_main/cs_wallet when going into this call may cause
+ * deadlock
+ */
+ void BlockUntilSyncedToCurrentChain();
};
/** A key allocated from the key pool. */