Skip to content

Commit

Permalink
Merge bitcoin#9077: [qa] Increase wallet-dump RPC timeout
Browse files Browse the repository at this point in the history
e89614b [qa] Add more helpful RPC timeout message (Russell Yanofsky)
8463aaa [qa] Increase wallet-dump RPC timeout (Russell Yanofsky)
  • Loading branch information
MarcoFalke committed Nov 7, 2016
2 parents 78cdd64 + e89614b commit 1253f86
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
11 changes: 10 additions & 1 deletion qa/rpc-tests/test_framework/authproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import decimal
import json
import logging
import socket
try:
import urllib.parse as urlparse
except ImportError:
Expand Down Expand Up @@ -161,7 +162,15 @@ def _batch(self, rpc_call_list):
return self._request('POST', self.__url.path, postdata.encode('utf-8'))

def _get_response(self):
http_response = self.__conn.getresponse()
try:
http_response = self.__conn.getresponse()
except socket.timeout as e:
raise JSONRPCException({
'code': -344,
'message': '%r RPC took longer than %f seconds. Consider '
'using larger timeout for calls that take '
'longer to return.' % (self._service_name,
self.__conn.timeout)})
if http_response is None:
raise JSONRPCException({
'code': -342, 'message': 'missing HTTP response from server'})
Expand Down
4 changes: 2 additions & 2 deletions qa/rpc-tests/test_framework/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=

return proxy

def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None, binary=None):
def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None, timewait=None, binary=None):
"""
Start multiple bitcoinds, return RPC connections to them
"""
Expand All @@ -350,7 +350,7 @@ def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None, binary=None):
rpcs = []
try:
for i in range(num_nodes):
rpcs.append(start_node(i, dirname, extra_args[i], rpchost, binary=binary[i]))
rpcs.append(start_node(i, dirname, extra_args[i], rpchost, timewait=timewait, binary=binary[i]))
except: # If one node failed to start, stop the others
stop_nodes(rpcs)
raise
Expand Down
6 changes: 5 additions & 1 deletion qa/rpc-tests/wallet-dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ def __init__(self):
self.extra_args = [["-keypool=90"]]

def setup_network(self, split=False):
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, self.extra_args)
# Use 1 minute timeout because the initial getnewaddress RPC can take
# longer than the default 30 seconds due to an expensive
# CWallet::TopUpKeyPool call, and the encryptwallet RPC made later in
# the test often takes even longer.
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, self.extra_args, timewait=60)

def run_test (self):
tmpdir = self.options.tmpdir
Expand Down

0 comments on commit 1253f86

Please sign in to comment.