test: Avoid logging error when logging error

This commit is contained in:
MarcoFalke 2024-12-03 09:40:47 +01:00
parent ebe4cac38b
commit cccca8a77f
No known key found for this signature in database
2 changed files with 4 additions and 3 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2022 The Bitcoin Core developers
# Copyright (c) 2010-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test objects for interacting with a bitcoind node over the p2p protocol.
@ -369,7 +369,7 @@ class P2PConnection(asyncio.Protocol):
self.on_message(t)
except Exception as e:
if not self.reconnect:
logger.exception('Error reading message:', repr(e))
logger.exception(f"Error reading message: {repr(e)}")
raise
def on_message(self, message):
@ -659,7 +659,7 @@ class P2PInterface(P2PConnection):
def test_function():
last_getheaders = self.last_message.pop("getheaders", None)
if block_hash is None:
return last_getheaders
return last_getheaders
if last_getheaders is None:
return False
return block_hash == last_getheaders.locator.vHave[0]

View file

@ -236,6 +236,7 @@ fn lint_py_lint() -> LintResult {
"F822", // undefined name name in __all__
"F823", // local variable name … referenced before assignment
"F841", // local variable 'foo' is assigned to but never used
"PLE", // Pylint errors
"W191", // indentation contains tabs
"W291", // trailing whitespace
"W292", // no newline at end of file