|
|
|
@ -138,8 +138,12 @@ UniValue generate(const UniValue& params, bool fHelp)
@@ -138,8 +138,12 @@ UniValue generate(const UniValue& params, bool fHelp)
|
|
|
|
|
boost::shared_ptr<CReserveScript> coinbaseScript; |
|
|
|
|
GetMainSignals().ScriptForMining(coinbaseScript); |
|
|
|
|
|
|
|
|
|
// If the keypool is exhausted, no script is returned at all. Catch this.
|
|
|
|
|
if (!coinbaseScript) |
|
|
|
|
throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first"); |
|
|
|
|
|
|
|
|
|
//throw an error if no script was provided
|
|
|
|
|
if (!coinbaseScript->reserveScript.size()) |
|
|
|
|
if (coinbaseScript->reserveScript.empty()) |
|
|
|
|
throw JSONRPCError(RPC_INTERNAL_ERROR, "No coinbase script available (mining requires a wallet)"); |
|
|
|
|
|
|
|
|
|
{ // Don't keep cs_main locked
|
|
|
|
|