Skip to content

Commit 50ca8cf

Browse files
committed
refactor: remove CKey overload for Create{,AndProcess}Block()
1 parent 9e23b11 commit 50ca8cf

File tree

6 files changed

+48
-66
lines changed

6 files changed

+48
-66
lines changed

src/test/block_reward_reallocation_tests.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
149149
auto& dmnman = *Assert(m_node.dmnman);
150150
const auto& consensus_params = Params().GetConsensus();
151151

152-
CScript coinbasePubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
152+
CScript coinbasePubKey = GetScriptForRawPubKey(coinbaseKey.GetPubKey());
153153

154154
BOOST_REQUIRE(DeploymentDIP0003Enforced(WITH_LOCK(cs_main, return m_node.chainman->ActiveChain().Height()),
155155
consensus_params));
@@ -160,7 +160,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
160160
auto utxos = BuildSimpleUtxoMap(m_coinbase_txns);
161161
auto tx = CreateProRegTx(m_node.chainman->ActiveChain(), *m_node.mempool, utxos, 1, GenerateRandomAddress(), coinbaseKey, ownerKey, operatorKey);
162162

163-
CreateAndProcessBlock({tx}, coinbaseKey);
163+
CreateAndProcessBlock({tx}, coinbasePubKey);
164164

165165
{
166166
LOCK(cs_main);
@@ -173,7 +173,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
173173
BOOST_CHECK(tip->nHeight < Params().GetConsensus().BRRHeight);
174174
}
175175

176-
CreateAndProcessBlock({}, coinbaseKey);
176+
CreateAndProcessBlock({}, coinbasePubKey);
177177

178178
{
179179
LOCK(cs_main);
@@ -186,12 +186,12 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
186186
const auto pblocktemplate = BlockAssembler(m_node.chainman->ActiveChainstate(), m_node, m_node.mempool.get(), Params()).CreateNewBlock(coinbasePubKey);
187187
}
188188
for ([[maybe_unused]] auto _ : irange::range(499)) {
189-
CreateAndProcessBlock({}, coinbaseKey);
189+
CreateAndProcessBlock({}, coinbasePubKey);
190190
LOCK(cs_main);
191191
dmnman.UpdatedBlockTip(m_node.chainman->ActiveChain().Tip());
192192
}
193193
BOOST_CHECK(m_node.chainman->ActiveChain().Height() < Params().GetConsensus().BRRHeight);
194-
CreateAndProcessBlock({}, coinbaseKey);
194+
CreateAndProcessBlock({}, coinbasePubKey);
195195

196196
{
197197
// Advance to ACTIVE at height = (BRRHeight - 1)
@@ -218,7 +218,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
218218
}
219219

220220
for ([[maybe_unused]] auto _ : irange::range(consensus_params.nSuperblockCycle - 1)) {
221-
CreateAndProcessBlock({}, coinbaseKey);
221+
CreateAndProcessBlock({}, coinbasePubKey);
222222
}
223223

224224
{
@@ -237,7 +237,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
237237
for ([[maybe_unused]] auto i : irange::range(19)) {
238238
for ([[maybe_unused]] auto j : irange::range(3)) {
239239
for ([[maybe_unused]] auto k : irange::range(consensus_params.nSuperblockCycle)) {
240-
CreateAndProcessBlock({}, coinbaseKey);
240+
CreateAndProcessBlock({}, coinbasePubKey);
241241
}
242242
LOCK(cs_main);
243243
const CBlockIndex* const tip{m_node.chainman->ActiveChain().Tip()};
@@ -274,7 +274,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS
274274
// check 10 next superblocks
275275
for ([[maybe_unused]] auto i : irange::range(10)) {
276276
for ([[maybe_unused]] auto k : irange::range(consensus_params.nSuperblockCycle)) {
277-
CreateAndProcessBlock({}, coinbaseKey);
277+
CreateAndProcessBlock({}, coinbasePubKey);
278278
}
279279
LOCK(cs_main);
280280
const CBlockIndex* const tip{m_node.chainman->ActiveChain().Tip()};

src/test/dynamic_activation_thresholds_tests.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ struct TestChainDATSetup : public TestChainSetup
3535
void signal(int num_blocks, bool expected_lockin)
3636
{
3737
const auto& consensus_params = Params().GetConsensus();
38+
CScript coinbasePubKey = GetScriptForRawPubKey(coinbaseKey.GetPubKey());
3839
// Mine non-signalling blocks
3940
gArgs.ForceSetArg("-blockversion", "536870912");
4041
for (int i = 0; i < window - num_blocks; ++i) {
41-
CreateAndProcessBlock({}, coinbaseKey);
42+
CreateAndProcessBlock({}, coinbasePubKey);
4243
}
4344
gArgs.ForceRemoveArg("blockversion");
4445
if (num_blocks > 0) {
4546
// Mine signalling blocks
4647
for (int i = 0; i < num_blocks; ++i) {
47-
CreateAndProcessBlock({}, coinbaseKey);
48+
CreateAndProcessBlock({}, coinbasePubKey);
4849
}
4950
}
5051
LOCK(cs_main);
@@ -58,15 +59,15 @@ struct TestChainDATSetup : public TestChainSetup
5859
void test(int activation_index, bool check_activation_at_min)
5960
{
6061
const auto& consensus_params = Params().GetConsensus();
61-
CScript coinbasePubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
62+
CScript coinbasePubKey = GetScriptForRawPubKey(coinbaseKey.GetPubKey());
6263

6364
{
6465
LOCK(cs_main);
6566
BOOST_CHECK_EQUAL(m_node.chainman->ActiveChain().Height(), window - 2);
6667
BOOST_CHECK_EQUAL(g_versionbitscache.State(m_node.chainman->ActiveChain().Tip(), consensus_params, deployment_id), ThresholdState::DEFINED);
6768
}
6869

69-
CreateAndProcessBlock({}, coinbaseKey);
70+
CreateAndProcessBlock({}, coinbasePubKey);
7071

7172
{
7273
LOCK(cs_main);
@@ -105,7 +106,7 @@ struct TestChainDATSetup : public TestChainSetup
105106
// activate
106107
signal(threshold(activation_index), true);
107108
for (int i = 0; i < window; ++i) {
108-
CreateAndProcessBlock({}, coinbaseKey);
109+
CreateAndProcessBlock({}, coinbasePubKey);
109110
}
110111
{
111112
LOCK(cs_main);

src/test/evo_assetlocks_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ SetupDummyInputs(FillableSigningProvider& keystoreRet, CCoinsViewCache& coinsRet
4545
// Create some dummy input transactions
4646
dummyTransactions[0].vout.resize(2);
4747
dummyTransactions[0].vout[0].nValue = 11*CENT;
48-
dummyTransactions[0].vout[0].scriptPubKey << ToByteVector(key[0].GetPubKey()) << OP_CHECKSIG;
48+
dummyTransactions[0].vout[0].scriptPubKey = GetScriptForRawPubKey(key[0].GetPubKey());
4949
dummyTransactions[0].vout[1].nValue = 50*CENT;
50-
dummyTransactions[0].vout[1].scriptPubKey << ToByteVector(key[1].GetPubKey()) << OP_CHECKSIG;
50+
dummyTransactions[0].vout[1].scriptPubKey = GetScriptForRawPubKey(key[1].GetPubKey());
5151
AddCoins(coinsRet, CTransaction(dummyTransactions[0]), 0);
5252

5353
dummyTransactions[1].vout.resize(2);

0 commit comments

Comments
 (0)