Skip to content

Commit fa27978

Browse files
author
MarcoFalke
committed
test: Remove python3.4 workaround in feature_dbcrash
1 parent dddd1d0 commit fa27978

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

test/functional/feature_dbcrash.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright (c) 2017-2018 The Bitcoin Core developers
2+
# Copyright (c) 2017-2019 The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test recovery from a crash during chainstate writing.
@@ -28,18 +28,12 @@
2828
import errno
2929
import http.client
3030
import random
31-
import sys
3231
import time
3332

3433
from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut, ToHex
3534
from test_framework.test_framework import BitcoinTestFramework
3635
from test_framework.util import assert_equal, create_confirmed_utxos, hex_str_to_bytes
3736

38-
HTTP_DISCONNECT_ERRORS = [http.client.CannotSendRequest]
39-
try:
40-
HTTP_DISCONNECT_ERRORS.append(http.client.RemoteDisconnected)
41-
except AttributeError:
42-
pass
4337

4438
class ChainstateWriteCrashTest(BitcoinTestFramework):
4539
def set_test_params(self):
@@ -110,14 +104,7 @@ def submit_block_catch_error(self, node_index, block):
110104
try:
111105
self.nodes[node_index].submitblock(block)
112106
return True
113-
except http.client.BadStatusLine as e:
114-
# Prior to 3.5 BadStatusLine('') was raised for a remote disconnect error.
115-
if sys.version_info[0] == 3 and sys.version_info[1] < 5 and e.line == "''":
116-
self.log.debug("node %d submitblock raised exception: %s", node_index, e)
117-
return False
118-
else:
119-
raise
120-
except tuple(HTTP_DISCONNECT_ERRORS) as e:
107+
except (http.client.CannotSendRequest, http.client.RemoteDisconnected) as e:
121108
self.log.debug("node %d submitblock raised exception: %s", node_index, e)
122109
return False
123110
except OSError as e:

0 commit comments

Comments
 (0)