aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/validation.cpp2
-rw-r--r--src/validation.h3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 3fef0e2934..ec9f9c6100 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -220,6 +220,8 @@ private:
void EraseBlockData(CBlockIndex* index) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
} g_chainstate;
+CChain& ChainActive() { return g_chainstate.m_chain; }
+
/**
* Mutex to guard access to validation specific variables, such as reading
* or changing the chainstate.
diff --git a/src/validation.h b/src/validation.h
index 7ab6adaf33..cec6c7d003 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -438,6 +438,9 @@ void ResetBlockFailureFlags(CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_mai
/** The currently-connected chain of blocks (protected by cs_main). */
extern CChain& chainActive;
+/** @returns the most-work chain. */
+CChain& ChainActive();
+
/** Global variable that points to the coins database (protected by cs_main) */
extern std::unique_ptr<CCoinsViewDB> pcoinsdbview;