mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
tests: Remove unused testing code
This commit is contained in:
parent
e8d490f27e
commit
590a57fdec
6 changed files with 6 additions and 14 deletions
|
@ -25,7 +25,6 @@ CLTV_HEIGHT = 1351
|
||||||
|
|
||||||
# Reject codes that we might receive in this test
|
# Reject codes that we might receive in this test
|
||||||
REJECT_INVALID = 16
|
REJECT_INVALID = 16
|
||||||
REJECT_OBSOLETE = 17
|
|
||||||
REJECT_NONSTANDARD = 64
|
REJECT_NONSTANDARD = 64
|
||||||
|
|
||||||
def cltv_invalidate(tx):
|
def cltv_invalidate(tx):
|
||||||
|
|
|
@ -22,7 +22,6 @@ DERSIG_HEIGHT = 1251
|
||||||
|
|
||||||
# Reject codes that we might receive in this test
|
# Reject codes that we might receive in this test
|
||||||
REJECT_INVALID = 16
|
REJECT_INVALID = 16
|
||||||
REJECT_OBSOLETE = 17
|
|
||||||
REJECT_NONSTANDARD = 64
|
REJECT_NONSTANDARD = 64
|
||||||
|
|
||||||
# A canonical signature consists of:
|
# A canonical signature consists of:
|
||||||
|
|
|
@ -35,7 +35,6 @@ MY_VERSION = 70014 # past bip-31 for ping/pong
|
||||||
MY_SUBVERSION = b"/python-mininode-tester:0.0.3/"
|
MY_SUBVERSION = b"/python-mininode-tester:0.0.3/"
|
||||||
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)
|
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)
|
||||||
|
|
||||||
MAX_INV_SZ = 50000
|
|
||||||
MAX_LOCATOR_SZ = 101
|
MAX_LOCATOR_SZ = 101
|
||||||
MAX_BLOCK_BASE_SIZE = 1000000
|
MAX_BLOCK_BASE_SIZE = 1000000
|
||||||
|
|
||||||
|
@ -58,9 +57,6 @@ MSG_TYPE_MASK = 0xffffffff >> 2
|
||||||
def sha256(s):
|
def sha256(s):
|
||||||
return hashlib.new('sha256', s).digest()
|
return hashlib.new('sha256', s).digest()
|
||||||
|
|
||||||
def ripemd160(s):
|
|
||||||
return hashlib.new('ripemd160', s).digest()
|
|
||||||
|
|
||||||
def hash256(s):
|
def hash256(s):
|
||||||
return sha256(sha256(s))
|
return sha256(sha256(s))
|
||||||
|
|
||||||
|
@ -887,13 +883,12 @@ class BlockTransactions:
|
||||||
|
|
||||||
|
|
||||||
class CPartialMerkleTree:
|
class CPartialMerkleTree:
|
||||||
__slots__ = ("fBad", "nTransactions", "vBits", "vHash")
|
__slots__ = ("nTransactions", "vBits", "vHash")
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.nTransactions = 0
|
self.nTransactions = 0
|
||||||
self.vHash = []
|
self.vHash = []
|
||||||
self.vBits = []
|
self.vBits = []
|
||||||
self.fBad = False
|
|
||||||
|
|
||||||
def deserialize(self, f):
|
def deserialize(self, f):
|
||||||
self.nTransactions = struct.unpack("<i", f.read(4))[0]
|
self.nTransactions = struct.unpack("<i", f.read(4))[0]
|
||||||
|
|
|
@ -349,7 +349,7 @@ class P2PInterface(P2PConnection):
|
||||||
self.send_message(msg_pong(message.nonce))
|
self.send_message(msg_pong(message.nonce))
|
||||||
|
|
||||||
def on_verack(self, message):
|
def on_verack(self, message):
|
||||||
self.verack_received = True
|
pass
|
||||||
|
|
||||||
def on_version(self, message):
|
def on_version(self, message):
|
||||||
assert message.nVersion >= MIN_VERSION_SUPPORTED, "Version {} received. Test framework only supports versions greater than {}".format(message.nVersion, MIN_VERSION_SUPPORTED)
|
assert message.nVersion >= MIN_VERSION_SUPPORTED, "Version {} received. Test framework only supports versions greater than {}".format(message.nVersion, MIN_VERSION_SUPPORTED)
|
||||||
|
|
|
@ -54,10 +54,9 @@ class Socks5Command():
|
||||||
return 'Socks5Command(%s,%s,%s,%s,%s,%s)' % (self.cmd, self.atyp, self.addr, self.port, self.username, self.password)
|
return 'Socks5Command(%s,%s,%s,%s,%s,%s)' % (self.cmd, self.atyp, self.addr, self.port, self.username, self.password)
|
||||||
|
|
||||||
class Socks5Connection():
|
class Socks5Connection():
|
||||||
def __init__(self, serv, conn, peer):
|
def __init__(self, serv, conn):
|
||||||
self.serv = serv
|
self.serv = serv
|
||||||
self.conn = conn
|
self.conn = conn
|
||||||
self.peer = peer
|
|
||||||
|
|
||||||
def handle(self):
|
def handle(self):
|
||||||
"""Handle socks5 request according to RFC192."""
|
"""Handle socks5 request according to RFC192."""
|
||||||
|
@ -137,9 +136,9 @@ class Socks5Server():
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
while self.running:
|
while self.running:
|
||||||
(sockconn, peer) = self.s.accept()
|
(sockconn, _) = self.s.accept()
|
||||||
if self.running:
|
if self.running:
|
||||||
conn = Socks5Connection(self, sockconn, peer)
|
conn = Socks5Connection(self, sockconn)
|
||||||
thread = threading.Thread(None, conn.handle)
|
thread = threading.Thread(None, conn.handle)
|
||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
|
@ -635,7 +635,7 @@ class RPCCoverage():
|
||||||
with open(coverage_ref_filename, 'r', encoding="utf8") as coverage_ref_file:
|
with open(coverage_ref_filename, 'r', encoding="utf8") as coverage_ref_file:
|
||||||
all_cmds.update([line.strip() for line in coverage_ref_file.readlines()])
|
all_cmds.update([line.strip() for line in coverage_ref_file.readlines()])
|
||||||
|
|
||||||
for root, dirs, files in os.walk(self.dir):
|
for root, _, files in os.walk(self.dir):
|
||||||
for filename in files:
|
for filename in files:
|
||||||
if filename.startswith(coverage_file_prefix):
|
if filename.startswith(coverage_file_prefix):
|
||||||
coverage_filenames.add(os.path.join(root, filename))
|
coverage_filenames.add(os.path.join(root, filename))
|
||||||
|
|
Loading…
Add table
Reference in a new issue