diff options
author | Daniel Kraft <d@domob.eu> | 2015-08-18 09:07:33 +0200 |
---|---|---|
committer | Daniel Kraft <d@domob.eu> | 2015-08-18 09:07:33 +0200 |
commit | 20165769989ed5aa744af2b73dfcf9d5a5cf7aa0 (patch) | |
tree | 56692e75f44ad30ef55eaa42764e46f0643b35b1 /qa | |
parent | 1e92b275406e3fbc7ab59d2ada1c882ca15fb36f (diff) |
Fix crash when mining with empty keypool.
Since the introduction of the ScriptForMining callback, the mining
functions (setgenerate and generate) crash with an assertion failure
(due to a NULL pointer script returned) if the keypool is empty. Fix
this by giving a proper error.
Diffstat (limited to 'qa')
-rwxr-xr-x | qa/rpc-tests/keypool.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/qa/rpc-tests/keypool.py b/qa/rpc-tests/keypool.py index aee29a596a..5a67220021 100755 --- a/qa/rpc-tests/keypool.py +++ b/qa/rpc-tests/keypool.py @@ -73,6 +73,21 @@ def run_test(nodes, tmpdir): except JSONRPCException,e: assert(e.error['code']==-12) + # refill keypool with three new addresses + nodes[0].walletpassphrase('test', 12000) + nodes[0].keypoolrefill(3) + nodes[0].walletlock() + + # drain them by mining + nodes[0].generate(1) + nodes[0].generate(1) + nodes[0].generate(1) + nodes[0].generate(1) + try: + nodes[0].generate(1) + raise AssertionError('Keypool should be exhausted after three addesses') + except JSONRPCException,e: + assert(e.error['code']==-12) def main(): import optparse |