fix crash/lockup on KMD with mining pools when an old utxo makes IsFinalTx fail in TestBlockValidity.

This commit is contained in:
blackjok3r
2019-06-18 21:49:56 +08:00
parent ba20fdc252
commit eca62bb4f3
2 changed files with 4 additions and 2 deletions

View File

@@ -819,7 +819,8 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
LEAVE_CRITICAL_SECTION(cs_main); LEAVE_CRITICAL_SECTION(cs_main);
LEAVE_CRITICAL_SECTION(mempool.cs); LEAVE_CRITICAL_SECTION(mempool.cs);
} }
throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); //throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed"); // crashes the node, moved to GetBlockTemplate and issue return.
return(0);
} }
//fprintf(stderr,"valid\n"); //fprintf(stderr,"valid\n");
} }

View File

@@ -745,7 +745,8 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
#endif #endif
ENTER_CRITICAL_SECTION(cs_main); 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 std::runtime_error("CreateNewBlock(): create block failed");
//throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory or no available utxo for staking");
// Need to update only after we know CreateNewBlockWithKey succeeded // Need to update only after we know CreateNewBlockWithKey succeeded
pindexPrev = pindexPrevNew; pindexPrev = pindexPrevNew;