aboutsummaryrefslogtreecommitdiff
path: root/src/miner.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2015-08-19 15:02:40 +0200
committerWladimir J. van der Laan <[email protected]>2015-08-19 15:07:38 +0200
commit0f0f323c9a58437b33ba4fa9a67e1edf5fc6cc88 (patch)
tree56692e75f44ad30ef55eaa42764e46f0643b35b1 /src/miner.cpp
parentMerge pull request #6553 (diff)
parentFix crash when mining with empty keypool. (diff)
downloaddiscoin-0f0f323c9a58437b33ba4fa9a67e1edf5fc6cc88.tar.xz
discoin-0f0f323c9a58437b33ba4fa9a67e1edf5fc6cc88.zip
Merge pull request #6567
2016576 Fix crash when mining with empty keypool. (Daniel Kraft)
Diffstat (limited to 'src/miner.cpp')
-rw-r--r--src/miner.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/miner.cpp b/src/miner.cpp
index 417226606..9dd1d459b 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -444,8 +444,10 @@ void static BitcoinMiner(const CChainParams& chainparams)
GetMainSignals().ScriptForMining(coinbaseScript);
try {
- //throw an error if no script was provided
- if (!coinbaseScript->reserveScript.size())
+ // Throw an error if no script was provided. This can happen
+ // due to some internal error but also if the keypool is empty.
+ // In the latter case, already the pointer is NULL.
+ if (!coinbaseScript || coinbaseScript->reserveScript.empty())
throw std::runtime_error("No coinbase script available (mining requires a wallet)");
while (true) {