test: add pre-`LogPeer` net log assertion
What changed, and why it matters
This commit only adds a new test to Bitcoin Core's functional test suite. It checks that network log messages include the peer number and peer address in a specific format before a planned formatting change. There is no change to production code, no bug fix, and no security-relevant behavior.
No action needed; this is a benign test-only commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a test case in test/functional/feature_logging.py that restarts a node with -debug=net and -logips=1, opens a P2P connection, and asserts the debug log contains the substring ‘peer=0 peeraddr=’. It imports P2PInterface to do so. This is purely an additive regression test for log formatting.
Changed components
test/functional/feature_logging.pyInspect captured patch +8 / −0
diff --git a/test/functional/feature_logging.py b/test/functional/feature_logging.py
index b04cd48c..5a4ef515 100755
--- a/test/functional/feature_logging.py
+++ b/test/functional/feature_logging.py
@@ -7,6 +7,7 @@
import os
from test_framework.test_framework import BitcoinTestFramework
+from test_framework.p2p import P2PInterface
from test_framework.test_node import ErrorMatch
@@ -115,5 +116,12 @@ class LoggingTest(BitcoinTestFramework):
assert logging['rpc']
assert logging['net']
+ self.log.info("Test -logips formatting in net logs")
+ self.restart_node(0, ['-debug=net', '-logips=1'])
+ with self.nodes[0].assert_debug_log(["peer=0 peeraddr="]):
+ p2p = self.nodes[0].add_p2p_connection(P2PInterface())
+ p2p.wait_for_verack()
+ self.nodes[0].disconnect_p2ps()
+
if __name__ == '__main__':
LoggingTest(__file__).main()
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.