@@ -131,7 +131,7 @@ static RPCHelpMan getnetworkhashps()
131
131
};
132
132
}
133
133
134
- static bool GenerateBlock (ChainstateManager& chainman, Mining& miner, CBlock&& block, uint64_t & max_tries, std::shared_ptr<const CBlock>& block_out, bool process_new_block)
134
+ static bool GenerateBlock (ChainstateManager& chainman, CBlock&& block, uint64_t & max_tries, std::shared_ptr<const CBlock>& block_out, bool process_new_block)
135
135
{
136
136
block_out.reset ();
137
137
block.hashMerkleRoot = BlockMerkleRoot (block);
@@ -151,7 +151,7 @@ static bool GenerateBlock(ChainstateManager& chainman, Mining& miner, CBlock&& b
151
151
152
152
if (!process_new_block) return true ;
153
153
154
- if (!miner. processNewBlock (block_out, nullptr )) {
154
+ if (!chainman. ProcessNewBlock (block_out, /* force_processing= */ true , /* min_pow_checked= */ true , nullptr )) {
155
155
throw JSONRPCError (RPC_INTERNAL_ERROR, " ProcessNewBlock, block not accepted" );
156
156
}
157
157
@@ -166,7 +166,7 @@ static UniValue generateBlocks(ChainstateManager& chainman, Mining& miner, const
166
166
CHECK_NONFATAL (block_template);
167
167
168
168
std::shared_ptr<const CBlock> block_out;
169
- if (!GenerateBlock (chainman, miner, block_template->getBlock (), nMaxTries, block_out, /* process_new_block=*/ true )) {
169
+ if (!GenerateBlock (chainman, block_template->getBlock (), nMaxTries, block_out, /* process_new_block=*/ true )) {
170
170
break ;
171
171
}
172
172
@@ -394,7 +394,7 @@ static RPCHelpMan generateblock()
394
394
std::shared_ptr<const CBlock> block_out;
395
395
uint64_t max_tries{DEFAULT_MAX_TRIES};
396
396
397
- if (!GenerateBlock (chainman, miner, std::move (block), max_tries, block_out, process_new_block) || !block_out) {
397
+ if (!GenerateBlock (chainman, std::move (block), max_tries, block_out, process_new_block) || !block_out) {
398
398
throw JSONRPCError (RPC_MISC_ERROR, " Failed to make block." );
399
399
}
400
400
@@ -1034,13 +1034,10 @@ static RPCHelpMan submitblock()
1034
1034
}
1035
1035
}
1036
1036
1037
- NodeContext& node = EnsureAnyNodeContext (request.context );
1038
- Mining& miner = EnsureMining (node);
1039
-
1040
1037
bool new_block;
1041
1038
auto sc = std::make_shared<submitblock_StateCatcher>(block.GetHash ());
1042
1039
CHECK_NONFATAL (chainman.m_options .signals )->RegisterSharedValidationInterface (sc);
1043
- bool accepted = miner. processNewBlock (blockptr, /* new_block=*/ &new_block);
1040
+ bool accepted = chainman. ProcessNewBlock (blockptr, /* force_processing= */ true , /* min_pow_checked= */ true , /* new_block=*/ &new_block);
1044
1041
CHECK_NONFATAL (chainman.m_options .signals )->UnregisterSharedValidationInterface (sc);
1045
1042
if (!new_block && accepted) {
1046
1043
return " duplicate" ;
0 commit comments