From 80a8414b8364d9d105d2b4f8d9c9b864392ec819 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 26 Jan 2019 14:37:11 +0800 Subject: [PATCH] fix lock up with staker when trying to startum mine and stake. --- src/miner.cpp | 2 -- src/rpc/mining.cpp | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 0aede35bb..3814abbca 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -843,8 +843,6 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight, } if ( ASSETCHAINS_MARMARA != 0 && nHeight > 0 && (nHeight & 1) == 0 ) scriptPubKey = Marmara_scriptPubKey(nHeight,pubkey); - if ( ASSETCHAINS_STAKED != 0 && KOMODO_MININGTHREADS == 0 ) - isStake = true; return CreateNewBlock(pubkey, scriptPubKey, gpucount, isStake); } diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 6bf1397ad..71c5aefa4 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -717,10 +717,12 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) } #ifdef ENABLE_WALLET 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 pblocktemplate = CreateNewBlockWithKey(); #endif + ENTER_CRITICAL_SECTION(cs_main); if (!pblocktemplate) throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory or no available utxo for staking");