mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user