Page MenuHomePhabricator

D13199.id.diff
No OneTemporary

D13199.id.diff

diff --git a/test/functional/combine_logs.py b/test/functional/combine_logs.py
--- a/test/functional/combine_logs.py
+++ b/test/functional/combine_logs.py
@@ -60,7 +60,7 @@
sys.exit(1)
if not args.testdir:
- print("Opening latest test directory: {}".format(testdir),
+ print(f"Opening latest test directory: {testdir}",
file=sys.stderr)
colors = defaultdict(lambda: '')
@@ -100,12 +100,12 @@
# fallback to regtest (should only happen when none exists)
chain = 'regtest'
- files = [("test", "{}/test_framework.log".format(tmp_dir))]
+ files = [("test", f"{tmp_dir}/test_framework.log")]
for i in itertools.count():
- logfile = "{}/node{}/{}/debug.log".format(tmp_dir, i, chain)
+ logfile = f"{tmp_dir}/node{i}/{chain}/debug.log"
if not os.path.isfile(logfile):
break
- files.append(("node{}".format(i), logfile))
+ files.append((f"node{i}", logfile))
return heapq.merge(*[get_log_events(source, f) for source, f in files])
@@ -116,21 +116,20 @@
warnings = []
for stream in ['stdout', 'stderr']:
for i in itertools.count():
- folder = "{}/node{}/{}".format(tmp_dir, i, stream)
+ folder = f"{tmp_dir}/node{i}/{stream}"
if not os.path.isdir(folder):
break
for (_, _, fns) in os.walk(folder):
for fn in fns:
warning = pathlib.Path(
- '{}/{}'.format(folder, fn)).read_text().strip()
+ f'{folder}/{fn}').read_text().strip()
if warning:
- warnings.append(("node{} {}".format(i, stream),
+ warnings.append((f"node{i} {stream}",
warning))
print()
for w in warnings:
- print("{} {} {} {}".format(colors[w[0].split()[0]],
- w[0], w[1], colors["reset"]))
+ print(f"{colors[w[0].split()[0]]} {w[0]} {w[1]} {colors['reset']}")
def find_latest_test_dir():
@@ -185,7 +184,7 @@
else:
# Add the line. Prefix with space equivalent to the source
# + timestamp so log lines are aligned
- event += " " + line
+ event += f" {line}"
# Flush the final event
yield LogEvent(timestamp=timestamp, source=source, event=event.rstrip())
except FileNotFoundError:
@@ -202,8 +201,7 @@
colors["reset"]))
if len(lines) > 1:
for line in lines[1:]:
- print("{0}{1}{2}".format(
- colors[event.source.rstrip()], line, colors["reset"]))
+ print(f"{colors[event.source.rstrip()]}{line}{colors['reset']}")
def print_logs_html(log_events):
diff --git a/test/functional/data/invalid_txs.py b/test/functional/data/invalid_txs.py
--- a/test/functional/data/invalid_txs.py
+++ b/test/functional/data/invalid_txs.py
@@ -245,7 +245,7 @@
tx.calc_sha256()
return tx
- return type('DisabledOpcode_' + str(opcode), (BadTxTemplate,), {
+ return type(f"DisabledOpcode_{str(opcode)}", (BadTxTemplate,), {
'reject_reason': "disabled opcode",
'expect_disconnect': True,
'get_tx': get_tx,
diff --git a/test/functional/test_framework/address.py b/test/functional/test_framework/address.py
--- a/test/functional/test_framework/address.py
+++ b/test/functional/test_framework/address.py
@@ -48,9 +48,9 @@
assert c in chars
digit = chars.index(c)
n += digit
- h = '{:x}'.format(n)
+ h = f'{n:x}'
if len(h) % 2:
- h = '0' + h
+ h = f"0{h}"
res = n.to_bytes((n.bit_length() + 7) // 8, 'big')
pad = 0
for c in s:
diff --git a/test/functional/test_framework/authproxy.py b/test/functional/test_framework/authproxy.py
--- a/test/functional/test_framework/authproxy.py
+++ b/test/functional/test_framework/authproxy.py
@@ -54,7 +54,7 @@
class JSONRPCException(Exception):
def __init__(self, rpc_error, http_status=None):
try:
- errmsg = '{} ({})'.format(rpc_error['message'], rpc_error['code'])
+ errmsg = f"{rpc_error['message']} ({rpc_error['code']})"
except (KeyError, TypeError):
errmsg = ''
super().__init__(errmsg)
@@ -65,7 +65,7 @@
def EncodeDecimal(o):
if isinstance(o, decimal.Decimal):
return str(o)
- raise TypeError(repr(o) + " is not JSON serializable")
+ raise TypeError(f"{repr(o)} is not JSON serializable")
class AuthServiceProxy:
@@ -92,7 +92,7 @@
# Python internal stuff
raise AttributeError
if self._service_name is not None:
- name = "{}.{}".format(self._service_name, name)
+ name = f"{self._service_name}.{name}"
return AuthServiceProxy(
self.__service_url, name, connection=self.__conn)
@@ -173,7 +173,7 @@
def batch(self, rpc_call_list):
postdata = json.dumps(
list(rpc_call_list), default=EncodeDecimal, ensure_ascii=self.ensure_ascii)
- log.debug("--> " + postdata)
+ log.debug(f"--> {postdata}")
response, status = self._request(
'POST', self.__url.path, postdata.encode('utf-8'))
if status != HTTPStatus.OK:
@@ -211,7 +211,7 @@
log.debug("<-{}- [{:.6f}] {}".format(response["id"], elapsed, json.dumps(
response["result"], default=EncodeDecimal, ensure_ascii=self.ensure_ascii)))
else:
- log.debug("<-- [{:.6f}] {}".format(elapsed, responsedata))
+ log.debug(f"<-- [{elapsed:.6f}] {responsedata}")
return response, http_response.status
def __truediv__(self, relative_uri):
diff --git a/test/functional/test_framework/cashaddr.py b/test/functional/test_framework/cashaddr.py
--- a/test/functional/test_framework/cashaddr.py
+++ b/test/functional/test_framework/cashaddr.py
@@ -80,7 +80,7 @@
# invalid size?
if ((len(addr_hash) - 20 * offset) % (4 * offset) != 0
or not 0 <= encoded_size <= 7):
- raise ValueError('invalid address hash size {}'.format(addr_hash))
+ raise ValueError(f'invalid address hash size {addr_hash}')
version_byte |= encoded_size
@@ -100,28 +100,26 @@
"""
lower = addr.lower()
if lower != addr and addr.upper() != addr:
- raise ValueError('mixed case in address: {}'.format(addr))
+ raise ValueError(f'mixed case in address: {addr}')
parts = lower.split(':', 1)
if len(parts) != 2:
- raise ValueError("address missing ':' separator: {}".format(addr))
+ raise ValueError(f"address missing ':' separator: {addr}")
prefix, payload = parts
if not prefix:
- raise ValueError('address prefix is missing: {}'.format(addr))
+ raise ValueError(f'address prefix is missing: {addr}')
if not all(33 <= ord(x) <= 126 for x in prefix):
- raise ValueError('invalid address prefix: {}'.format(prefix))
+ raise ValueError(f'invalid address prefix: {prefix}')
if not (8 <= len(payload) <= 124):
- raise ValueError('address payload has invalid length: {}'
- .format(len(addr)))
+ raise ValueError(f'address payload has invalid length: {len(addr)}')
try:
data = bytes(_CHARSET.find(x) for x in payload)
except ValueError:
- raise ValueError('invalid characters in address: {}'
- .format(payload))
+ raise ValueError(f'invalid characters in address: {payload}')
if _polymod(_prefix_expand(prefix) + data):
- raise ValueError('invalid checksum in address: {}'.format(addr))
+ raise ValueError(f'invalid checksum in address: {addr}')
if lower != addr:
prefix = prefix.upper()
@@ -151,11 +149,11 @@
# Ensure there isn't extra padding
extrabits = len(payload) * 5 % 8
if extrabits >= 5:
- raise ValueError('excess padding in address {}'.format(address))
+ raise ValueError(f'excess padding in address {address}')
# Ensure extrabits are zeros
if payload[-1] & ((1 << extrabits) - 1):
- raise ValueError('non-zero padding in address {}'.format(address))
+ raise ValueError(f'non-zero padding in address {address}')
decoded = _convertbits(payload, 5, 8, False)
version = decoded[0]
@@ -170,7 +168,7 @@
kind = version >> 3
if kind not in (SCRIPT_TYPE, PUBKEY_TYPE):
- raise ValueError('unrecognised address type {}'.format(kind))
+ raise ValueError(f'unrecognised address type {kind}')
return prefix, kind, addr_hash
@@ -184,7 +182,7 @@
raise TypeError('addr_hash must be binary bytes')
if kind not in (SCRIPT_TYPE, PUBKEY_TYPE):
- raise ValueError('unrecognised address type {}'.format(kind))
+ raise ValueError(f'unrecognised address type {kind}')
payload = _pack_addr_data(kind, addr_hash)
checksum = _create_checksum(prefix, payload)
diff --git a/test/functional/test_framework/cdefs.py b/test/functional/test_framework/cdefs.py
--- a/test/functional/test_framework/cdefs.py
+++ b/test/functional/test_framework/cdefs.py
@@ -87,5 +87,5 @@
if __name__ == "__main__":
# Output values if run standalone to verify
- print("DEFAULT_MAX_BLOCK_SIZE = {} (bytes)".format(DEFAULT_MAX_BLOCK_SIZE))
- print("COINBASE_MATURITY = {} (blocks)".format(COINBASE_MATURITY))
+ print(f"DEFAULT_MAX_BLOCK_SIZE = {DEFAULT_MAX_BLOCK_SIZE} (bytes)")
+ print(f"COINBASE_MATURITY = {COINBASE_MATURITY} (blocks)")
diff --git a/test/functional/test_framework/coverage.py b/test/functional/test_framework/coverage.py
--- a/test/functional/test_framework/coverage.py
+++ b/test/functional/test_framework/coverage.py
@@ -53,7 +53,7 @@
if self.coverage_logfile:
with open(self.coverage_logfile, 'a+', encoding='utf8') as f:
- f.write("{}\n".format(rpc_method))
+ f.write(f"{rpc_method}\n")
def __truediv__(self, relative_uri):
return AuthServiceProxyWrapper(self.auth_service_proxy_instance / relative_uri,
@@ -72,7 +72,7 @@
"""
pid = str(os.getpid())
return os.path.join(
- dirname, "coverage.pid{}.node{}.txt".format(pid, str(n_node)))
+ dirname, f"coverage.pid{pid}.node{str(n_node)}.txt")
def write_all_rpc_commands(dirname, node):
@@ -102,7 +102,7 @@
# Ignore blanks and headers
if line and not line.startswith('='):
- commands.add("{}\n".format(line.split()[0]))
+ commands.add(f"{line.split()[0]}\n")
with open(filename, 'w', encoding='utf8') as f:
f.writelines(list(commands))
diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py
--- a/test/functional/test_framework/messages.py
+++ b/test/functional/test_framework/messages.py
@@ -321,8 +321,7 @@
return r
def __repr__(self):
- return "CInv(type={} hash={})".format(
- self.typemap[self.type], uint256_hex(self.hash))
+ return f"CInv(type={self.typemap[self.type]} hash={uint256_hex(self.hash)})"
def __eq__(self, other):
return isinstance(
@@ -348,7 +347,7 @@
return r
def __repr__(self):
- return "CBlockLocator(vHave={})".format(repr(self.vHave))
+ return f"CBlockLocator(vHave={repr(self.vHave)})"
class COutPoint:
@@ -369,7 +368,7 @@
return r
def __repr__(self):
- return "COutPoint(hash={} n={})".format(uint256_hex(self.hash), self.n)
+ return f"COutPoint(hash={uint256_hex(self.hash)} n={self.n})"
class CTxIn:
@@ -648,8 +647,7 @@
return r
def __repr__(self):
- return "PrefilledTransaction(index={}, tx={})".format(
- self.index, repr(self.tx))
+ return f"PrefilledTransaction(index={self.index}, tx={repr(self.tx)})"
# This is what we send on the wire, in a cmpctblock message.
@@ -980,8 +978,7 @@
return r
def __repr__(self):
- return "AvalanchePrefilledProof(index={}, proof={})".format(
- self.index, repr(self.proof))
+ return f"AvalanchePrefilledProof(index={self.index}, proof={repr(self.proof)})"
class AvalanchePoll:
@@ -1002,8 +999,7 @@
return r
def __repr__(self):
- return "AvalanchePoll(round={}, invs={})".format(
- self.round, repr(self.invs))
+ return f"AvalanchePoll(round={self.round}, invs={repr(self.invs)})"
class AvalancheVoteError(IntEnum):
@@ -1049,8 +1045,7 @@
return r
def __repr__(self):
- return "AvalancheVote(error={}, hash={})".format(
- self.error, uint256_hex(self.hash))
+ return f"AvalancheVote(error={self.error}, hash={uint256_hex(self.hash)})"
class AvalancheResponse:
@@ -1099,8 +1094,7 @@
return r
def __repr__(self):
- return "TCPAvalancheResponse(response={}, sig={})".format(
- repr(self.response), self.sig)
+ return f"TCPAvalancheResponse(response={repr(self.response)}, sig={self.sig})"
class AvalancheDelegationLevel:
@@ -1121,8 +1115,7 @@
return r
def __repr__(self):
- return "AvalancheDelegationLevel(pubkey={}, sig={})".format(
- self.pubkey.hex(), self.sig)
+ return f"AvalancheDelegationLevel(pubkey={self.pubkey.hex()}, sig={self.sig})"
class AvalancheDelegation:
@@ -1185,8 +1178,7 @@
return r
def __repr__(self):
- return "AvalancheHello(delegation={}, sig={})".format(
- repr(self.delegation), self.sig)
+ return f"AvalancheHello(delegation={repr(self.delegation)}, sig={self.sig})"
def get_sighash(self, node):
b = self.delegation.getid()
@@ -1246,8 +1238,7 @@
return r
def __repr__(self):
- return "CMerkleBlock(header={}, txn={})".format(
- repr(self.header), repr(self.txn))
+ return f"CMerkleBlock(header={repr(self.header)}, txn={repr(self.txn)})"
# Objects that correspond to messages on the wire
@@ -1339,7 +1330,7 @@
return ser_vector(self.addrs)
def __repr__(self):
- return "msg_addr(addrs={})".format(repr(self.addrs))
+ return f"msg_addr(addrs={repr(self.addrs)})"
class msg_addrv2:
@@ -1356,7 +1347,7 @@
return ser_vector(self.addrs, "serialize_v2")
def __repr__(self):
- return "msg_addrv2(addrs={})".format(repr(self.addrs))
+ return f"msg_addrv2(addrs={repr(self.addrs)})"
class msg_sendaddrv2:
@@ -1393,7 +1384,7 @@
return ser_vector(self.inv)
def __repr__(self):
- return "msg_inv(inv={})".format(repr(self.inv))
+ return f"msg_inv(inv={repr(self.inv)})"
class msg_getdata:
@@ -1410,7 +1401,7 @@
return ser_vector(self.inv)
def __repr__(self):
- return "msg_getdata(inv={})".format(repr(self.inv))
+ return f"msg_getdata(inv={repr(self.inv)})"
class msg_getblocks:
@@ -1451,7 +1442,7 @@
return self.tx.serialize()
def __repr__(self):
- return "msg_tx(tx={})".format(repr(self.tx))
+ return f"msg_tx(tx={repr(self.tx)})"
class msg_block:
@@ -1471,7 +1462,7 @@
return self.block.serialize()
def __repr__(self):
- return "msg_block(block={})".format(repr(self.block))
+ return f"msg_block(block={repr(self.block)})"
# for cases where a user needs tighter control over what is sent over the wire
@@ -1523,7 +1514,7 @@
return r
def __repr__(self):
- return "msg_ping(nonce={:08x})".format(self.nonce)
+ return f"msg_ping(nonce={self.nonce:08x})"
class msg_pong:
@@ -1542,7 +1533,7 @@
return r
def __repr__(self):
- return "msg_pong(nonce={:08x})".format(self.nonce)
+ return f"msg_pong(nonce={self.nonce:08x})"
class msg_mempool:
@@ -1576,7 +1567,7 @@
return ser_vector(self.vec)
def __repr__(self):
- return "msg_notfound(vec={})".format(repr(self.vec))
+ return f"msg_notfound(vec={repr(self.vec)})"
class msg_sendheaders:
@@ -1644,7 +1635,7 @@
return ser_vector(blocks)
def __repr__(self):
- return "msg_headers(headers={})".format(repr(self.headers))
+ return f"msg_headers(headers={repr(self.headers)})"
class msg_merkleblock:
@@ -1664,7 +1655,7 @@
return self.merkleblock.serialize()
def __repr__(self):
- return "msg_merkleblock(merkleblock={})".format(repr(self.merkleblock))
+ return f"msg_merkleblock(merkleblock={repr(self.merkleblock)})"
class msg_filterload:
@@ -1712,7 +1703,7 @@
return r
def __repr__(self):
- return "msg_filteradd(data={})".format(self.data)
+ return f"msg_filteradd(data={self.data})"
class msg_filterclear:
@@ -1748,7 +1739,7 @@
return r
def __repr__(self):
- return "msg_feefilter(feerate={:08x})".format(self.feerate)
+ return f"msg_feefilter(feerate={self.feerate:08x})"
class msg_sendcmpct:
@@ -1770,8 +1761,7 @@
return r
def __repr__(self):
- return "msg_sendcmpct(announce={}, version={})".format(
- self.announce, self.version)
+ return f"msg_sendcmpct(announce={self.announce}, version={self.version})"
class msg_cmpctblock:
@@ -1791,8 +1781,7 @@
return r
def __repr__(self):
- return "msg_cmpctblock(HeaderAndShortIDs={})".format(
- repr(self.header_and_shortids))
+ return f"msg_cmpctblock(HeaderAndShortIDs={repr(self.header_and_shortids)})"
class msg_getblocktxn:
@@ -1812,8 +1801,7 @@
return r
def __repr__(self):
- return "msg_getblocktxn(block_txn_request={})".format(
- repr(self.block_txn_request))
+ return f"msg_getblocktxn(block_txn_request={repr(self.block_txn_request)})"
class msg_blocktxn:
@@ -1832,8 +1820,7 @@
return r
def __repr__(self):
- return "msg_blocktxn(block_transactions={})".format(
- repr(self.block_transactions))
+ return f"msg_blocktxn(block_transactions={repr(self.block_transactions)})"
class msg_getcfilters:
@@ -2009,7 +1996,7 @@
return r
def __repr__(self):
- return "msg_avaproof(proof={})".format(repr(self.proof))
+ return f"msg_avaproof(proof={repr(self.proof)})"
class msg_avapoll:
@@ -2028,7 +2015,7 @@
return r
def __repr__(self):
- return "msg_avapoll(poll={})".format(repr(self.poll))
+ return f"msg_avapoll(poll={repr(self.poll)})"
class msg_avaresponse:
@@ -2047,7 +2034,7 @@
return r
def __repr__(self):
- return "msg_avaresponse(response={})".format(repr(self.response))
+ return f"msg_avaresponse(response={repr(self.response)})"
class msg_tcpavaresponse:
@@ -2066,7 +2053,7 @@
return r
def __repr__(self):
- return "msg_tcpavaresponse(response={})".format(repr(self.response))
+ return f"msg_tcpavaresponse(response={repr(self.response)})"
class msg_avahello:
@@ -2085,7 +2072,7 @@
return r
def __repr__(self):
- return "msg_avahello(response={})".format(repr(self.hello))
+ return f"msg_avahello(response={repr(self.hello)})"
class msg_getavaaddr:
diff --git a/test/functional/test_framework/netutil.py b/test/functional/test_framework/netutil.py
--- a/test/functional/test_framework/netutil.py
+++ b/test/functional/test_framework/netutil.py
@@ -31,7 +31,7 @@
'''
Get list of socket inodes for process pid.
'''
- base = '/proc/{}/fd'.format(pid)
+ base = f'/proc/{pid}/fd'
inodes = []
for item in os.listdir(base):
try:
@@ -62,7 +62,7 @@
host_out = ''
for x in range(0, len(host) // 4):
(val,) = struct.unpack('=I', host[x * 4:(x + 1) * 4])
- host_out += '{:08x}'.format(val)
+ host_out += f'{val:08x}'
return host_out, int(port, 16)
@@ -73,7 +73,7 @@
To get pid of all network process running on system, you must run this script
as superuser
'''
- with open('/proc/net/' + typ, 'r', encoding='utf8') as f:
+ with open(f"/proc/net/{typ}", 'r', encoding='utf8') as f:
content = f.readlines()
content.pop(0)
result = []
@@ -161,7 +161,7 @@
assert (x == 0 and nullbytes == 0) or (x == 1 and nullbytes > 0)
addr = sub[0] + ([0] * nullbytes) + sub[1]
else:
- raise ValueError('Could not parse address {}'.format(addr))
+ raise ValueError(f'Could not parse address {addr}')
return bytearray(addr).hex()
diff --git a/test/functional/test_framework/p2p.py b/test/functional/test_framework/p2p.py
--- a/test/functional/test_framework/p2p.py
+++ b/test/functional/test_framework/p2p.py
@@ -179,7 +179,7 @@
loop = NetworkThread.network_event_loop
logger.debug(
- 'Connecting to Bitcoin ABC Node: {}:{}'.format(self.dstaddr, self.dstport))
+ f'Connecting to Bitcoin ABC Node: {self.dstaddr}:{self.dstport}')
coroutine = loop.create_connection(
lambda: self, host=self.dstaddr, port=self.dstport)
return lambda: loop.call_soon_threadsafe(loop.create_task, coroutine)
@@ -189,7 +189,7 @@
self.peer_connect_helper('0', 0, net, timeout_factor)
logger.debug(
- 'Listening for Bitcoin ABC Node with id: {}'.format(connect_id))
+ f'Listening for Bitcoin ABC Node with id: {connect_id}')
return lambda: NetworkThread.listen(self, connect_cb, idx=connect_id)
def peer_disconnect(self):
@@ -202,8 +202,7 @@
def connection_made(self, transport):
"""asyncio callback when a connection is opened."""
assert not self._transport
- logger.debug("Connected & Listening: {}:{}".format(
- self.dstaddr, self.dstport))
+ logger.debug(f"Connected & Listening: {self.dstaddr}:{self.dstport}")
self._transport = transport
if self.on_connection_send_msg:
if self.on_connection_send_msg_is_raw:
@@ -220,8 +219,7 @@
logger.warning("Connection lost to {}:{} due to {}".format(
self.dstaddr, self.dstport, exc))
else:
- logger.debug("Closed connection to: {}:{}".format(
- self.dstaddr, self.dstport))
+ logger.debug(f"Closed connection to: {self.dstaddr}:{self.dstport}")
self._transport = None
self.recvbuf = b""
self.on_close()
@@ -267,7 +265,7 @@
msg = self.recvbuf[4 + 12 + 4 + 4:4 + 12 + 4 + 4 + msglen]
h = sha256(sha256(msg))
if checksum != h[:4]:
- raise ValueError("got bad checksum " + repr(self.recvbuf))
+ raise ValueError(f"got bad checksum {repr(self.recvbuf)}")
self.recvbuf = self.recvbuf[4 + 12 + 4 + 4 + msglen:]
if msgtype not in MESSAGEMAP:
raise ValueError("Received unknown msgtype from {}:{}: '{}' {}".format(
@@ -336,8 +334,7 @@
log_message = "Send message to "
elif direction == "receive":
log_message = "Received message from "
- log_message += "{}:{}: {}".format(
- self.dstaddr, self.dstport, repr(msg)[:500])
+ log_message += f"{self.dstaddr}:{self.dstport}: {repr(msg)[:500]}"
if len(log_message) > 500:
log_message += "... (msg truncated)"
logger.debug(log_message)
@@ -415,10 +412,9 @@
msgtype = message.msgtype.decode('ascii')
self.message_count[msgtype] += 1
self.last_message[msgtype] = message
- getattr(self, 'on_' + msgtype)(message)
+ getattr(self, f"on_{msgtype}")(message)
except Exception:
- print("ERROR delivering {} ({})".format(
- repr(message), sys.exc_info()[0]))
+ print(f"ERROR delivering {repr(message)} ({sys.exc_info()[0]})")
raise
# Callback methods. Can be overridden by subclasses in individual test
@@ -718,7 +714,7 @@
listener = await cls.network_event_loop.create_server(peer_protocol, addr, port)
logger.debug(
- "Listening server on {}:{} should be started".format(addr, port))
+ f"Listening server on {addr}:{port} should be started")
cls.listeners[(addr, port)] = listener
cls.protos[(addr, port)] = proto
@@ -749,7 +745,7 @@
self.send_message(msg_block(self.block_store[inv.hash]))
else:
logger.debug(
- 'getdata message type {} received.'.format(hex(inv.type)))
+ f'getdata message type {hex(inv.type)} received.')
def on_getheaders(self, message):
"""Search back through our block store for the locator, and reply with a headers message if found."""
@@ -860,13 +856,11 @@
if success:
# Check that all txs are now in the mempool
for tx in txs:
- assert tx.hash in raw_mempool, "{} not found in mempool".format(
- tx.hash)
+ assert tx.hash in raw_mempool, f"{tx.hash} not found in mempool"
else:
# Check that none of the txs are now in the mempool
for tx in txs:
- assert tx.hash not in raw_mempool, "{} tx found in mempool".format(
- tx.hash)
+ assert tx.hash not in raw_mempool, f"{tx.hash} tx found in mempool"
if reject_reason:
with node.assert_debug_log(expected_msgs=[reject_reason]):
diff --git a/test/functional/test_framework/script.py b/test/functional/test_framework/script.py
--- a/test/functional/test_framework/script.py
+++ b/test/functional/test_framework/script.py
@@ -72,7 +72,7 @@
"""Encode a small integer op, returning an opcode"""
if not (0 <= n <= 16):
raise ValueError(
- 'Integer must be in range 0 <= n <= 16, got {}'.format(n))
+ f'Integer must be in range 0 <= n <= 16, got {n}')
if n == 0:
return OP_0
@@ -85,7 +85,7 @@
return 0
if not (self == OP_0 or OP_1 <= self <= OP_16):
- raise ValueError('op {!r} is not an OP_N'.format(self))
+ raise ValueError(f'op {self!r} is not an OP_N')
return int(self - OP_1 + 1)
@@ -103,7 +103,7 @@
if self in OPCODE_NAMES:
return OPCODE_NAMES[self]
else:
- return 'CScriptOp(0x{:x})'.format(self)
+ return f'CScriptOp(0x{self:x})'
def __new__(cls, n):
try:
@@ -517,7 +517,7 @@
datasize = None
pushdata_type = None
if opcode < OP_PUSHDATA1:
- pushdata_type = 'PUSHDATA({})'.format(opcode)
+ pushdata_type = f'PUSHDATA({opcode})'
datasize = opcode
elif opcode == OP_PUSHDATA1:
@@ -553,7 +553,7 @@
# Check for truncation
if len(data) < datasize:
raise CScriptTruncatedPushDataError(
- '{}: truncated data'.format(pushdata_type), data)
+ f'{pushdata_type}: truncated data', data)
i += datasize
@@ -582,7 +582,7 @@
def __repr__(self):
def _repr(o):
if isinstance(o, bytes):
- return "x('{}')".format(o.hex())
+ return f"x('{o.hex()}')"
else:
return repr(o)
@@ -593,10 +593,10 @@
try:
op = _repr(next(i))
except CScriptTruncatedPushDataError as err:
- op = '{}...<ERROR: {}>'.format(_repr(err.data), err)
+ op = f'{_repr(err.data)}...<ERROR: {err}>'
break
except CScriptInvalidError as err:
- op = '<ERROR: {}>'.format(err)
+ op = f'<ERROR: {err}>'
break
except StopIteration:
break
@@ -604,7 +604,7 @@
if op is not None:
ops.append(op)
- return "CScript([{}])".format(', '.join(ops))
+ return f"CScript([{', '.join(ops)}])"
SIGHASH_ALL = 1
@@ -641,8 +641,7 @@
HASH_ONE = b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
if inIdx >= len(txTo.vin):
- return (HASH_ONE, "inIdx {} out of range ({})".format(
- inIdx, len(txTo.vin)))
+ return (HASH_ONE, f"inIdx {inIdx} out of range ({len(txTo.vin)})")
txtmp = CTransaction(txTo)
for txin in txtmp.vin:
@@ -660,8 +659,7 @@
elif (hashtype & 0x1f) == SIGHASH_SINGLE:
outIdx = inIdx
if outIdx >= len(txtmp.vout):
- return (HASH_ONE, "outIdx {} out of range ({})".format(
- outIdx, len(txtmp.vout)))
+ return (HASH_ONE, f"outIdx {outIdx} out of range ({len(txtmp.vout)})")
tmp = txtmp.vout[outIdx]
txtmp.vout = []
diff --git a/test/functional/test_framework/socks5.py b/test/functional/test_framework/socks5.py
--- a/test/functional/test_framework/socks5.py
+++ b/test/functional/test_framework/socks5.py
@@ -77,7 +77,7 @@
# Verify socks version
ver = recvall(self.conn, 1)[0]
if ver != 0x05:
- raise IOError('Invalid socks version {}'.format(ver))
+ raise IOError(f'Invalid socks version {ver}')
# Choose authentication method
nmethods = recvall(self.conn, 1)[0]
methods = bytearray(recvall(self.conn, nmethods))
@@ -96,7 +96,7 @@
if method == 0x02:
ver = recvall(self.conn, 1)[0]
if ver != 0x01:
- raise IOError('Invalid auth packet version {}'.format(ver))
+ raise IOError(f'Invalid auth packet version {ver}')
ulen = recvall(self.conn, 1)[0]
username = str(recvall(self.conn, ulen))
plen = recvall(self.conn, 1)[0]
@@ -108,10 +108,10 @@
ver, cmd, _, atyp = recvall(self.conn, 4)
if ver != 0x05:
raise IOError(
- 'Invalid socks version {} in connect request'.format(ver))
+ f'Invalid socks version {ver} in connect request')
if cmd != Command.CONNECT:
raise IOError(
- 'Unhandled command {} in connect request'.format(cmd))
+ f'Unhandled command {cmd} in connect request')
if atyp == AddressType.IPV4:
addr = recvall(self.conn, 4)
@@ -121,7 +121,7 @@
elif atyp == AddressType.IPV6:
addr = recvall(self.conn, 16)
else:
- raise IOError('Unknown address type {}'.format(atyp))
+ raise IOError(f'Unknown address type {atyp}')
port_hi, port_lo = recvall(self.conn, 2)
port = (port_hi << 8) | port_lo
@@ -131,7 +131,7 @@
cmdin = Socks5Command(cmd, atyp, addr, port, username, password)
self.serv.queue.put(cmdin)
- logger.info('Proxy: {}'.format(cmdin))
+ logger.info(f'Proxy: {cmdin}')
# Fall through to disconnect
except Exception as e:
logger.exception("socks5 request handling failed.")
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -138,7 +138,7 @@
self.log.exception("JSONRPC error")
self.success = TestStatus.FAILED
except SkipTest as e:
- self.log.warning("Test Skipped: {}".format(e.message))
+ self.log.warning(f"Test Skipped: {e.message}")
self.success = TestStatus.SKIPPED
except AssertionError:
self.log.exception("Assertion failed")
@@ -165,7 +165,7 @@
help="Leave bitcoinds and test.* datadir on exit or error")
parser.add_argument("--noshutdown", dest="noshutdown", default=False, action="store_true",
help="Don't stop bitcoinds after the test execution")
- parser.add_argument("--cachedir", dest="cachedir", default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../cache"),
+ parser.add_argument("--cachedir", dest="cachedir", default=os.path.abspath(f"{os.path.dirname(os.path.realpath(__file__))}/../../cache"),
help="Directory for caching pregenerated datadirs (default: %(default)s)")
parser.add_argument("--tmpdir", dest="tmpdir",
help="Root directory for datadirs")
@@ -192,7 +192,7 @@
parser.add_argument("--descriptors", default=False, action="store_true",
help="Run test using a descriptor wallet")
parser.add_argument("--with-wellingtonactivation", dest="wellingtonactivation", default=False, action="store_true",
- help="Activate wellington update on timestamp {}".format(TIMESTAMP_IN_THE_PAST))
+ help=f"Activate wellington update on timestamp {TIMESTAMP_IN_THE_PAST}")
parser.add_argument(
'--timeout-factor',
dest="timeout_factor",
@@ -218,12 +218,12 @@
fname_bitcoind = os.path.join(
config["environment"]["BUILDDIR"],
"src",
- "bitcoind" + config["environment"]["EXEEXT"]
+ f"bitcoind{config['environment']['EXEEXT']}"
)
fname_bitcoincli = os.path.join(
config["environment"]["BUILDDIR"],
"src",
- "bitcoin-cli" + config["environment"]["EXEEXT"]
+ f"bitcoin-cli{config['environment']['EXEEXT']}"
)
self.options.bitcoind = os.getenv("BITCOIND", default=fname_bitcoind)
self.options.bitcoincli = os.getenv(
@@ -253,10 +253,10 @@
if seed is None:
seed = random.randrange(sys.maxsize)
else:
- self.log.debug("User supplied random seed {}".format(seed))
+ self.log.debug(f"User supplied random seed {seed}")
random.seed(seed)
- self.log.debug("PRNG seed is: {}".format(seed))
+ self.log.debug(f"PRNG seed is: {seed}")
self.log.debug('Setting up network thread')
self.network_thread = NetworkThread()
@@ -298,16 +298,15 @@
not self.options.perf
)
if should_clean_up:
- self.log.info("Cleaning up {} on exit".format(self.options.tmpdir))
+ self.log.info(f"Cleaning up {self.options.tmpdir} on exit")
cleanup_tree_on_exit = True
elif self.options.perf:
self.log.warning(
- "Not cleaning up dir {} due to perf data".format(
- self.options.tmpdir))
+ f"Not cleaning up dir {self.options.tmpdir} due to perf data")
cleanup_tree_on_exit = False
else:
self.log.warning(
- "Not cleaning up dir {}".format(self.options.tmpdir))
+ f"Not cleaning up dir {self.options.tmpdir}")
cleanup_tree_on_exit = False
if self.success == TestStatus.PASSED:
@@ -318,10 +317,10 @@
exit_code = TEST_EXIT_SKIPPED
else:
self.log.error(
- "Test failed. Test logging available at {}/test_framework.log".format(self.options.tmpdir))
+ f"Test failed. Test logging available at {self.options.tmpdir}/test_framework.log")
self.log.error("")
self.log.error("Hint: Call {} '{}' to consolidate all logs".format(os.path.normpath(
- os.path.dirname(os.path.realpath(__file__)) + "/../combine_logs.py"), self.options.tmpdir))
+ f"{os.path.dirname(os.path.realpath(__file__))}/../combine_logs.py"), self.options.tmpdir))
self.log.error("")
self.log.error(
"If this failure happened unexpectedly or intermittently, please"
@@ -362,7 +361,7 @@
def setup_chain(self):
"""Override this method to customize blockchain setup"""
- self.log.info("Initializing test directory " + self.options.tmpdir)
+ self.log.info(f"Initializing test directory {self.options.tmpdir}")
if self.setup_clean_chain:
self._initialize_chain_clean()
else:
@@ -478,7 +477,7 @@
if self.options.wellingtonactivation:
self.nodes[i].extend_default_args(
- ["-wellingtonactivationtime={}".format(TIMESTAMP_IN_THE_PAST)])
+ [f"-wellingtonactivationtime={TIMESTAMP_IN_THE_PAST}"])
def start_node(self, i, *args, **kwargs):
"""Start a bitcoind"""
@@ -541,7 +540,7 @@
host = to_node.host
if host is None:
host = '127.0.0.1'
- ip_port = host + ':' + str(to_node.p2p_port)
+ ip_port = f"{host}:{str(to_node.p2p_port)}"
from_node.addnode(ip_port, "onetry")
# poll until version handshake complete to avoid race conditions
# with transaction relaying
@@ -714,7 +713,7 @@
self.log.setLevel(logging.DEBUG)
# Create file handler to log all messages
fh = logging.FileHandler(
- self.options.tmpdir + '/test_framework.log', encoding='utf-8')
+ f"{self.options.tmpdir}/test_framework.log", encoding='utf-8')
fh.setLevel(logging.DEBUG)
# Create console handler to log messages to stderr. By default this
# logs only error messages, but can be configured with --loglevel.
@@ -755,7 +754,7 @@
if not os.path.isdir(cache_node_dir):
self.log.debug(
- "Creating cache directory {}".format(cache_node_dir))
+ f"Creating cache directory {cache_node_dir}")
initialize_datadir(
self.options.cachedir,
@@ -785,7 +784,7 @@
if self.options.wellingtonactivation:
self.nodes[CACHE_NODE_ID].extend_default_args(
- ["-wellingtonactivationtime={}".format(TIMESTAMP_IN_THE_PAST)])
+ [f"-wellingtonactivationtime={TIMESTAMP_IN_THE_PAST}"])
self.start_node(CACHE_NODE_ID)
cache_node = self.nodes[CACHE_NODE_ID]
@@ -833,8 +832,7 @@
for i in range(self.num_nodes):
self.log.debug(
- "Copy cache directory {} to node {}".format(
- cache_node_dir, i))
+ f"Copy cache directory {cache_node_dir} to node {i}")
to_dir = get_datadir_path(self.options.tmpdir, i)
shutil.copytree(cache_node_dir, to_dir)
# Overwrite port/rpcport in bitcoin.conf
diff --git a/test/functional/test_framework/test_shell.py b/test/functional/test_framework/test_shell.py
--- a/test/functional/test_framework/test_shell.py
+++ b/test/functional/test_framework/test_shell.py
@@ -39,7 +39,7 @@
elif hasattr(self.options, key):
setattr(self.options, key, value)
else:
- raise KeyError(key + " not a valid parameter key!")
+ raise KeyError(f"{key} not a valid parameter key!")
super().setup()
self.running = True
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -31,11 +31,9 @@
def assert_approx(v, vexp, vspan=10):
"""Assert that `v` is within `vspan` of `vexp`"""
if v < vexp - vspan:
- raise AssertionError("{} < [{}..{}]".format(
- str(v), str(vexp - vspan), str(vexp + vspan)))
+ raise AssertionError(f"{str(v)} < [{str(vexp - vspan)}..{str(vexp + vspan)}]")
if v > vexp + vspan:
- raise AssertionError("{} > [{}..{}]".format(
- str(v), str(vexp - vspan), str(vexp + vspan)))
+ raise AssertionError(f"{str(v)} > [{str(vexp - vspan)}..{str(vexp + vspan)}]")
def assert_fee_amount(fee, tx_size, fee_per_kB, wiggleroom=2):
@@ -50,10 +48,10 @@
target_fee = satoshi_round(tx_size * fee_per_kB / 1000)
if fee < (tx_size - wiggleroom) * fee_per_kB / 1000:
raise AssertionError(
- "Fee of {} XEC too low! (Should be {} XEC)".format(str(fee), str(target_fee)))
+ f"Fee of {str(fee)} XEC too low! (Should be {str(target_fee)} XEC)")
if fee > (tx_size + wiggleroom) * fee_per_kB / 1000:
raise AssertionError(
- "Fee of {} XEC too high! (Should be {} XEC)".format(str(fee), str(target_fee)))
+ f"Fee of {str(fee)} XEC too high! (Should be {str(target_fee)} XEC)")
def assert_equal(thing1, thing2, *args):
@@ -64,12 +62,12 @@
def assert_greater_than(thing1, thing2):
if thing1 <= thing2:
- raise AssertionError("{} <= {}".format(str(thing1), str(thing2)))
+ raise AssertionError(f"{str(thing1)} <= {str(thing2)}")
def assert_greater_than_or_equal(thing1, thing2):
if thing1 < thing2:
- raise AssertionError("{} < {}".format(str(thing1), str(thing2)))
+ raise AssertionError(f"{str(thing1)} < {str(thing2)}")
def assert_raises(exc, fun, *args, **kwds):
@@ -89,7 +87,7 @@
message, e.error['message']))
except Exception as e:
raise AssertionError(
- "Unexpected exception raised: " + type(e).__name__)
+ f"Unexpected exception raised: {type(e).__name__}")
else:
raise AssertionError("No exception raised")
@@ -114,9 +112,9 @@
except CalledProcessError as e:
if returncode != e.returncode:
raise AssertionError(
- "Unexpected returncode {}".format(e.returncode))
+ f"Unexpected returncode {e.returncode}")
if output not in e.output:
- raise AssertionError("Expected substring not found:" + e.output)
+ raise AssertionError(f"Expected substring not found:{e.output}")
else:
raise AssertionError("No exception raised")
@@ -153,7 +151,7 @@
# values are correct.
if (code is not None) and (code != e.error["code"]):
raise AssertionError(
- "Unexpected JSONRPC error code {}".format(e.error["code"]))
+ f"Unexpected JSONRPC error code {e.error['code']}")
if (message is not None) and (message not in e.error['message']):
raise AssertionError(
"Expected substring not found in error message:\nsubstring: '{}'\nerror message: '{}'.".format(
@@ -161,7 +159,7 @@
return True
except Exception as e:
raise AssertionError(
- "Unexpected exception raised: " + type(e).__name__)
+ f"Unexpected exception raised: {type(e).__name__}")
else:
return False
@@ -171,19 +169,19 @@
int(string, 16)
except Exception as e:
raise AssertionError(
- "Couldn't interpret {!r} as hexadecimal; raised: {}".format(string, e))
+ f"Couldn't interpret {string!r} as hexadecimal; raised: {e}")
def assert_is_hash_string(string, length=64):
if not isinstance(string, str):
raise AssertionError(
- "Expected a string, got type {!r}".format(type(string)))
+ f"Expected a string, got type {type(string)!r}")
elif length and len(string) != length:
raise AssertionError(
- "String of length {} expected; got {}".format(length, len(string)))
+ f"String of length {length} expected; got {len(string)}")
elif not re.match('[abcdef0-9]+$', string):
raise AssertionError(
- "String {!r} contains invalid characters for a hash.".format(string))
+ f"String {string!r} contains invalid characters for a hash.")
def assert_array_result(object_array, to_match, expected,
@@ -209,13 +207,12 @@
num_matched = num_matched + 1
for key, value in expected.items():
if item[key] != value:
- raise AssertionError("{} : expected {}={}".format(
- str(item), str(key), str(value)))
+ raise AssertionError(f"{str(item)} : expected {str(key)}={str(value)}")
num_matched = num_matched + 1
if num_matched == 0 and not should_not_find:
- raise AssertionError("No objects matched {}".format(str(to_match)))
+ raise AssertionError(f"No objects matched {str(to_match)}")
if num_matched > 0 and should_not_find:
- raise AssertionError("Objects were found {}".format(str(to_match)))
+ raise AssertionError(f"Objects were found {str(to_match)}")
# Utility functions
###################
@@ -233,7 +230,7 @@
def EncodeDecimal(o):
if isinstance(o, Decimal):
return str(o)
- raise TypeError(repr(o) + " is not JSON serializable")
+ raise TypeError(f"{repr(o)} is not JSON serializable")
def count_bytes(hex_string):
@@ -276,14 +273,14 @@
time.sleep(0.05)
# Print the cause of the timeout
- predicate_source = "''''\n" + inspect.getsource(predicate) + "'''"
- logger.error("wait_until() failed. Predicate: {}".format(predicate_source))
+ predicate_source = f"''''\n{inspect.getsource(predicate)}'''"
+ logger.error(f"wait_until() failed. Predicate: {predicate_source}")
if attempt >= attempts:
raise AssertionError("Predicate {} not true after {} attempts".format(
predicate_source, attempts))
elif time.time() >= time_end:
raise AssertionError(
- "Predicate {} not true after {} seconds".format(predicate_source, timeout))
+ f"Predicate {predicate_source} not true after {timeout} seconds")
raise RuntimeError('Unreachable')
# RPC/P2P connection constants and functions
@@ -398,7 +395,7 @@
rpc_u, rpc_p = get_auth_cookie(datadir, chain)
if host is None:
host = '127.0.0.1'
- return "http://{}:{}@{}:{}".format(rpc_u, rpc_p, host, int(port))
+ return f"http://{rpc_u}:{rpc_p}@{host}:{int(port)}"
# Node functions
################
@@ -416,10 +413,10 @@
chain_name_conf_arg = chain
chain_name_conf_section = chain
with open(os.path.join(datadir, "bitcoin.conf"), 'w', encoding='utf8') as f:
- f.write("{}=1\n".format(chain_name_conf_arg))
- f.write("[{}]\n".format(chain_name_conf_section))
- f.write("port=" + str(p2p_port(n)) + "\n")
- f.write("rpcport=" + str(rpc_port(n)) + "\n")
+ f.write(f"{chain_name_conf_arg}=1\n")
+ f.write(f"[{chain_name_conf_section}]\n")
+ f.write(f"port={str(p2p_port(n))}\n")
+ f.write(f"rpcport={str(rpc_port(n))}\n")
f.write("fallbackfee=200\n")
f.write("server=1\n")
f.write("keypool=1\n")
@@ -445,13 +442,13 @@
def get_datadir_path(dirname, n):
- return os.path.join(dirname, "node" + str(n))
+ return os.path.join(dirname, f"node{str(n)}")
def append_config(datadir, options):
with open(os.path.join(datadir, "bitcoin.conf"), 'a', encoding='utf8') as f:
for option in options:
- f.write(option + "\n")
+ f.write(f"{option}\n")
def get_auth_cookie(datadir, chain):
@@ -510,8 +507,7 @@
for i in range(len(txdata["vout"])):
if txdata["vout"][i]["value"] == amount:
return i
- raise RuntimeError("find_output txid {} : {} not found".format(
- txid, str(amount)))
+ raise RuntimeError(f"find_output txid {txid} : {str(amount)} not found")
# Create large OP_RETURN txouts that can be appended to a transaction
@@ -524,7 +520,7 @@
# create one script_pubkey
script_pubkey = "6a4d0200" # OP_RETURN OP_PUSH2 512 bytes
for _ in range(512):
- script_pubkey = script_pubkey + "01"
+ script_pubkey = f"{script_pubkey}01"
# concatenate 128 txouts of above script_pubkey which we'll insert before
# the txout for change
txouts = []
@@ -573,7 +569,7 @@
if any([addr == a for a in tx["vout"][i]["scriptPubKey"]["addresses"]]):
return i
raise RuntimeError(
- "Vout not found for address: txid={}, addr={}".format(txid, addr))
+ f"Vout not found for address: txid={txid}, addr={addr}")
def modinv(a, n):
diff --git a/test/functional/test_framework/wallet_util.py b/test/functional/test_framework/wallet_util.py
--- a/test/functional/test_framework/wallet_util.py
+++ b/test/functional/test_framework/wallet_util.py
@@ -89,7 +89,7 @@
if value is None:
if key in addr_info.keys():
raise AssertionError(
- "key {} unexpectedly returned in getaddressinfo.".format(key))
+ f"key {key} unexpectedly returned in getaddressinfo.")
elif addr_info[key] != value:
raise AssertionError(
"key {} value {} did not match expected value {}".format(
diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py
--- a/test/functional/tool_wallet.py
+++ b/test/functional/tool_wallet.py
@@ -29,8 +29,8 @@
def bitcoin_wallet_process(self, *args):
binary = self.config["environment"]["BUILDDIR"] + \
'/src/bitcoin-wallet' + self.config["environment"]["EXEEXT"]
- args = ['-datadir={}'.format(self.nodes[0].datadir),
- '-chain={}'.format(self.chain)] + list(args)
+ args = [f'-datadir={self.nodes[0].datadir}',
+ f'-chain={self.chain}'] + list(args)
command_line = [binary] + args
if self.config["environment"]["EMULATOR"]:
@@ -70,7 +70,7 @@
def log_wallet_timestamp_comparison(self, old, new):
result = 'unchanged' if new == old else 'increased!'
- self.log.debug('Wallet file timestamp {}'.format(result))
+ self.log.debug(f'Wallet file timestamp {result}')
def test_invalid_tool_commands_and_args(self):
self.log.info(
@@ -88,7 +88,7 @@
"wallets")
self.assert_raises_tool_error(
f'Error initializing wallet database environment "{locked_dir}"!',
- '-wallet=' + self.default_wallet_name,
+ f"-wallet={self.default_wallet_name}",
'info',
)
path = os.path.join(self.options.tmpdir, "node0", "regtest",
@@ -113,7 +113,7 @@
# shasum_before = self.wallet_shasum()
timestamp_before = self.wallet_timestamp()
self.log.debug(
- 'Wallet file timestamp before calling info: {}'.format(timestamp_before))
+ f'Wallet file timestamp before calling info: {timestamp_before}')
out = textwrap.dedent('''\
Wallet info
===========
@@ -125,11 +125,11 @@
''')
self.assert_tool_output(
out,
- '-wallet=' + self.default_wallet_name,
+ f"-wallet={self.default_wallet_name}",
'info')
timestamp_after = self.wallet_timestamp()
self.log.debug(
- 'Wallet file timestamp after calling info: {}'.format(timestamp_after))
+ f'Wallet file timestamp after calling info: {timestamp_after}')
self.log_wallet_timestamp_comparison(timestamp_before, timestamp_after)
self.log.debug(
'Setting wallet file permissions back to 600 (read/write)')
@@ -160,7 +160,7 @@
shasum_before = self.wallet_shasum()
timestamp_before = self.wallet_timestamp()
self.log.debug(
- 'Wallet file timestamp before calling info: {}'.format(timestamp_before))
+ f'Wallet file timestamp before calling info: {timestamp_before}')
out = textwrap.dedent('''\
Wallet info
===========
@@ -172,12 +172,12 @@
''')
self.assert_tool_output(
out,
- '-wallet=' + self.default_wallet_name,
+ f"-wallet={self.default_wallet_name}",
'info')
shasum_after = self.wallet_shasum()
timestamp_after = self.wallet_timestamp()
self.log.debug(
- 'Wallet file timestamp after calling info: {}'.format(timestamp_after))
+ f'Wallet file timestamp after calling info: {timestamp_after}')
self.log_wallet_timestamp_comparison(timestamp_before, timestamp_after)
#
# TODO: Wallet tool info should not write to the wallet file.
@@ -192,7 +192,7 @@
shasum_before = self.wallet_shasum()
timestamp_before = self.wallet_timestamp()
self.log.debug(
- 'Wallet file timestamp before calling create: {}'.format(timestamp_before))
+ f'Wallet file timestamp before calling create: {timestamp_before}')
out = textwrap.dedent('''\
Topping up keypool...
Wallet info
@@ -207,7 +207,7 @@
shasum_after = self.wallet_shasum()
timestamp_after = self.wallet_timestamp()
self.log.debug(
- 'Wallet file timestamp after calling create: {}'.format(timestamp_after))
+ f'Wallet file timestamp after calling create: {timestamp_after}')
self.log_wallet_timestamp_comparison(timestamp_before, timestamp_after)
assert_equal(timestamp_before, timestamp_after)
assert_equal(shasum_before, shasum_after)
@@ -222,14 +222,14 @@
shasum_before = self.wallet_shasum()
timestamp_before = self.wallet_timestamp()
self.log.debug(
- 'Wallet file timestamp before calling getwalletinfo: {}'.format(timestamp_before))
+ f'Wallet file timestamp before calling getwalletinfo: {timestamp_before}')
out = self.nodes[0].getwalletinfo()
self.stop_node(0)
shasum_after = self.wallet_shasum()
timestamp_after = self.wallet_timestamp()
self.log.debug(
- 'Wallet file timestamp after calling getwalletinfo: {}'.format(timestamp_after))
+ f'Wallet file timestamp after calling getwalletinfo: {timestamp_after}')
assert_equal(0, out['txcount'])
assert_equal(1000, out['keypoolsize'])

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 26, 11:21 (16 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573396
Default Alt Text
D13199.id.diff (53 KB)

Event Timeline