test: Remove python3.4 workaround in feature_dbcrash

This commit is contained in:
MarcoFalke 2019-03-04 18:21:51 -05:00
parent dddd1d05d3
commit fa2797808e
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers # Copyright (c) 2017-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying # Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test recovery from a crash during chainstate writing. """Test recovery from a crash during chainstate writing.
@ -28,18 +28,12 @@
import errno import errno
import http.client import http.client
import random import random
import sys
import time import time
from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut, ToHex from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut, ToHex
from test_framework.test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, create_confirmed_utxos, hex_str_to_bytes from test_framework.util import assert_equal, create_confirmed_utxos, hex_str_to_bytes
HTTP_DISCONNECT_ERRORS = [http.client.CannotSendRequest]
try:
HTTP_DISCONNECT_ERRORS.append(http.client.RemoteDisconnected)
except AttributeError:
pass
class ChainstateWriteCrashTest(BitcoinTestFramework): class ChainstateWriteCrashTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
@ -110,14 +104,7 @@ class ChainstateWriteCrashTest(BitcoinTestFramework):
try: try:
self.nodes[node_index].submitblock(block) self.nodes[node_index].submitblock(block)
return True return True
except http.client.BadStatusLine as e: except (http.client.CannotSendRequest, http.client.RemoteDisconnected) as e:
# Prior to 3.5 BadStatusLine('') was raised for a remote disconnect error.
if sys.version_info[0] == 3 and sys.version_info[1] < 5 and e.line == "''":
self.log.debug("node %d submitblock raised exception: %s", node_index, e)
return False
else:
raise
except tuple(HTTP_DISCONNECT_ERRORS) as e:
self.log.debug("node %d submitblock raised exception: %s", node_index, e) self.log.debug("node %d submitblock raised exception: %s", node_index, e)
return False return False
except OSError as e: except OSError as e: