mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Merge 4ad5c71adb into merged_master (Bitcoin PR bitcoin/bitcoin#28051)
This commit is contained in:
commit
a41762b512
44 changed files with 167 additions and 194 deletions
|
|
@ -29,7 +29,6 @@
|
|||
#include <script/descriptor.h>
|
||||
#include <script/script.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <shutdown.h>
|
||||
#include <timedata.h>
|
||||
#include <txmempool.h>
|
||||
#include <univalue.h>
|
||||
|
|
@ -139,11 +138,11 @@ static bool GenerateBlock(ChainstateManager& chainman, CBlock& block, uint64_t&
|
|||
|
||||
// Signed blocks have no PoW requirements, but merkle root computed above
|
||||
if (!g_signed_blocks) {
|
||||
while (max_tries > 0 && block.nNonce < std::numeric_limits<uint32_t>::max() && !CheckProofOfWork(block.GetHash(), block.nBits, chainman.GetConsensus()) && !ShutdownRequested()) {
|
||||
while (max_tries > 0 && block.nNonce < std::numeric_limits<uint32_t>::max() && !CheckProofOfWork(block.GetHash(), block.nBits, chainman.GetConsensus()) && !chainman.m_interrupt) {
|
||||
++block.nNonce;
|
||||
--max_tries;
|
||||
}
|
||||
if (max_tries == 0 || ShutdownRequested()) {
|
||||
if (max_tries == 0 || chainman.m_interrupt) {
|
||||
return false;
|
||||
}
|
||||
if (block.nNonce == std::numeric_limits<uint32_t>::max()) {
|
||||
|
|
@ -174,7 +173,7 @@ static bool GenerateBlock(ChainstateManager& chainman, CBlock& block, uint64_t&
|
|||
static UniValue generateBlocks(ChainstateManager& chainman, const CTxMemPool& mempool, const CScript& coinbase_script, int nGenerate, uint64_t nMaxTries)
|
||||
{
|
||||
UniValue blockHashes(UniValue::VARR);
|
||||
while (nGenerate > 0 && !ShutdownRequested()) {
|
||||
while (nGenerate > 0 && !chainman.m_interrupt) {
|
||||
std::unique_ptr<CBlockTemplate> pblocktemplate(BlockAssembler{chainman.ActiveChainstate(), &mempool}.CreateNewBlock(coinbase_script));
|
||||
if (!pblocktemplate.get())
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue