fix lock up with staker when trying to startum mine and stake.

This commit is contained in:
blackjok3r
2019-01-26 14:37:11 +08:00
parent 304de9777d
commit 80a8414b83
2 changed files with 3 additions and 3 deletions

View File

@@ -843,8 +843,6 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight,
} }
if ( ASSETCHAINS_MARMARA != 0 && nHeight > 0 && (nHeight & 1) == 0 ) if ( ASSETCHAINS_MARMARA != 0 && nHeight > 0 && (nHeight & 1) == 0 )
scriptPubKey = Marmara_scriptPubKey(nHeight,pubkey); scriptPubKey = Marmara_scriptPubKey(nHeight,pubkey);
if ( ASSETCHAINS_STAKED != 0 && KOMODO_MININGTHREADS == 0 )
isStake = true;
return CreateNewBlock(pubkey, scriptPubKey, gpucount, isStake); return CreateNewBlock(pubkey, scriptPubKey, gpucount, isStake);
} }

View File

@@ -717,10 +717,12 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
} }
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
CReserveKey reservekey(pwalletMain); CReserveKey reservekey(pwalletMain);
pblocktemplate = CreateNewBlockWithKey(reservekey,chainActive.LastTip()->GetHeight()+1,KOMODO_MAXGPUCOUNT,false); LEAVE_CRITICAL_SECTION(cs_main);
pblocktemplate = CreateNewBlockWithKey(reservekey,pindexPrevNew->GetHeight()+1,KOMODO_MAXGPUCOUNT,false);
#else #else
pblocktemplate = CreateNewBlockWithKey(); pblocktemplate = CreateNewBlockWithKey();
#endif #endif
ENTER_CRITICAL_SECTION(cs_main);
if (!pblocktemplate) if (!pblocktemplate)
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory or no available utxo for staking"); throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory or no available utxo for staking");