mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 09:53:47 +01:00
Remove unused g_best_block
This commit is contained in:
parent
e3a560ca68
commit
7942951e3f
@ -303,7 +303,6 @@ void StopRPC(const std::any& context)
|
||||
LogDebug(BCLog::RPC, "Stopping RPC\n");
|
||||
WITH_LOCK(g_deadline_timers_mutex, deadlineTimers.clear());
|
||||
DeleteAuthCookie();
|
||||
g_best_block_cv.notify_all();
|
||||
node::NodeContext& node = EnsureAnyNodeContext(context);
|
||||
// The notifications interface doesn't exist between initialization step 4a and 7.
|
||||
if (node.notifications) node.notifications->m_tip_block_cv.notify_all();
|
||||
|
@ -4,6 +4,7 @@
|
||||
//
|
||||
#include <chainparams.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <node/kernel_notifications.h>
|
||||
#include <random.h>
|
||||
#include <rpc/blockchain.h>
|
||||
#include <sync.h>
|
||||
@ -69,14 +70,14 @@ BOOST_AUTO_TEST_CASE(validation_chainstate_resize_caches)
|
||||
BOOST_FIXTURE_TEST_CASE(chainstate_update_tip, TestChain100Setup)
|
||||
{
|
||||
ChainstateManager& chainman = *Assert(m_node.chainman);
|
||||
uint256 curr_tip = ::g_best_block;
|
||||
uint256 curr_tip = m_node.notifications->m_tip_block;
|
||||
|
||||
// Mine 10 more blocks, putting at us height 110 where a valid assumeutxo value can
|
||||
// be found.
|
||||
mineBlocks(10);
|
||||
|
||||
// After adding some blocks to the tip, best block should have changed.
|
||||
BOOST_CHECK(::g_best_block != curr_tip);
|
||||
BOOST_CHECK(m_node.notifications->m_tip_block != curr_tip);
|
||||
|
||||
// Grab block 1 from disk; we'll add it to the background chain later.
|
||||
std::shared_ptr<CBlock> pblockone = std::make_shared<CBlock>();
|
||||
@ -91,15 +92,15 @@ BOOST_FIXTURE_TEST_CASE(chainstate_update_tip, TestChain100Setup)
|
||||
// Ensure our active chain is the snapshot chainstate.
|
||||
BOOST_CHECK(WITH_LOCK(::cs_main, return chainman.IsSnapshotActive()));
|
||||
|
||||
curr_tip = ::g_best_block;
|
||||
curr_tip = m_node.notifications->m_tip_block;
|
||||
|
||||
// Mine a new block on top of the activated snapshot chainstate.
|
||||
mineBlocks(1); // Defined in TestChain100Setup.
|
||||
|
||||
// After adding some blocks to the snapshot tip, best block should have changed.
|
||||
BOOST_CHECK(::g_best_block != curr_tip);
|
||||
BOOST_CHECK(m_node.notifications->m_tip_block != curr_tip);
|
||||
|
||||
curr_tip = ::g_best_block;
|
||||
curr_tip = m_node.notifications->m_tip_block;
|
||||
|
||||
BOOST_CHECK_EQUAL(chainman.GetAll().size(), 2);
|
||||
|
||||
@ -138,7 +139,7 @@ BOOST_FIXTURE_TEST_CASE(chainstate_update_tip, TestChain100Setup)
|
||||
// g_best_block should be unchanged after adding a block to the background
|
||||
// validation chain.
|
||||
BOOST_CHECK(block_added);
|
||||
BOOST_CHECK_EQUAL(curr_tip, ::g_best_block);
|
||||
BOOST_CHECK_EQUAL(curr_tip, m_node.notifications->m_tip_block);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
@ -108,10 +108,6 @@ const std::vector<std::string> CHECKLEVEL_DOC {
|
||||
* */
|
||||
static constexpr int PRUNE_LOCK_BUFFER{10};
|
||||
|
||||
GlobalMutex g_best_block_mutex;
|
||||
std::condition_variable g_best_block_cv;
|
||||
uint256 g_best_block;
|
||||
|
||||
const CBlockIndex* Chainstate::FindForkInGlobalIndex(const CBlockLocator& locator) const
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
@ -2988,12 +2984,6 @@ void Chainstate::UpdateTip(const CBlockIndex* pindexNew)
|
||||
m_mempool->AddTransactionsUpdated(1);
|
||||
}
|
||||
|
||||
{
|
||||
LOCK(g_best_block_mutex);
|
||||
g_best_block = pindexNew->GetBlockHash();
|
||||
g_best_block_cv.notify_all();
|
||||
}
|
||||
|
||||
std::vector<bilingual_str> warning_messages;
|
||||
if (!m_chainman.IsInitialBlockDownload()) {
|
||||
const CBlockIndex* pindex = pindexNew;
|
||||
|
@ -85,11 +85,6 @@ enum class SynchronizationState {
|
||||
POST_INIT
|
||||
};
|
||||
|
||||
extern GlobalMutex g_best_block_mutex;
|
||||
extern std::condition_variable g_best_block_cv;
|
||||
/** Used to notify getblocktemplate RPC of new tips. */
|
||||
extern uint256 g_best_block;
|
||||
|
||||
/** Documentation for argument 'checklevel'. */
|
||||
extern const std::vector<std::string> CHECKLEVEL_DOC;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user