From 08d0b73ce3ac221f04019f103b6549d5f86ebe96 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 26 Feb 2017 14:26:00 +0200 Subject: [PATCH] Test --- src/miner.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 58a96d300..6dc5ec03b 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -424,6 +424,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) { fprintf(stderr,"warning: testblockvalidity failed\n"); + return(0); //throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); } } @@ -606,8 +607,13 @@ void static BitcoinMiner(CWallet *pwallet) } if ( ASSETCHAINS_SYMBOL[0] != 0 ) fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height); - - unique_ptr pblocktemplate(CreateNewBlockWithKey(reservekey)); + CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey); + if ( ptr == 0 ) + { + fprintf(stderr,"created illegal block, retry\n"); + continue; + } + unique_ptr pblocktemplate(ptr); if (!pblocktemplate.get()) { LogPrintf("Error in KomodoMiner: Keypool ran out, please call keypoolrefill before restarting the mining thread\n");