mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
scripted-diff: replace chainActive -> ::ChainActive()
Though at the moment ChainActive() simply references `g_chainstate.m_chain`,
doing this change now clears the way for multiple chainstate usage and allows
us to script the diff.
-BEGIN VERIFY SCRIPT-
git grep -l "chainActive" | grep -E '(h|cpp)$' | xargs sed -i '/chainActive =/b; /extern CChain& chainActive/b; s/\(::\)\{0,1\}chainActive/::ChainActive()/g'
-END VERIFY SCRIPT-
This commit is contained in:
@@ -66,18 +66,18 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup)
|
||||
|
||||
// Test 1: block with both of those transactions should be rejected.
|
||||
block = CreateAndProcessBlock(spends, scriptPubKey);
|
||||
BOOST_CHECK(chainActive.Tip()->GetBlockHash() != block.GetHash());
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() != block.GetHash());
|
||||
|
||||
// Test 2: ... and should be rejected if spend1 is in the memory pool
|
||||
BOOST_CHECK(ToMemPool(spends[0]));
|
||||
block = CreateAndProcessBlock(spends, scriptPubKey);
|
||||
BOOST_CHECK(chainActive.Tip()->GetBlockHash() != block.GetHash());
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() != block.GetHash());
|
||||
mempool.clear();
|
||||
|
||||
// Test 3: ... and should be rejected if spend2 is in the memory pool
|
||||
BOOST_CHECK(ToMemPool(spends[1]));
|
||||
block = CreateAndProcessBlock(spends, scriptPubKey);
|
||||
BOOST_CHECK(chainActive.Tip()->GetBlockHash() != block.GetHash());
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() != block.GetHash());
|
||||
mempool.clear();
|
||||
|
||||
// Final sanity test: first spend in mempool, second in block, that's OK:
|
||||
@@ -85,7 +85,7 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup)
|
||||
oneSpend.push_back(spends[0]);
|
||||
BOOST_CHECK(ToMemPool(spends[1]));
|
||||
block = CreateAndProcessBlock(oneSpend, scriptPubKey);
|
||||
BOOST_CHECK(chainActive.Tip()->GetBlockHash() == block.GetHash());
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() == block.GetHash());
|
||||
// spends[1] should have been removed from the mempool when the
|
||||
// block with spends[0] is accepted:
|
||||
BOOST_CHECK_EQUAL(mempool.size(), 0U);
|
||||
@@ -220,7 +220,7 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup)
|
||||
|
||||
block = CreateAndProcessBlock({spend_tx}, p2pk_scriptPubKey);
|
||||
LOCK(cs_main);
|
||||
BOOST_CHECK(chainActive.Tip()->GetBlockHash() == block.GetHash());
|
||||
BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() == block.GetHash());
|
||||
BOOST_CHECK(pcoinsTip->GetBestBlock() == block.GetHash());
|
||||
|
||||
// Test P2SH: construct a transaction that is valid without P2SH, and
|
||||
|
||||
Reference in New Issue
Block a user