Skip to content

Commit 4a0fd85

Browse files
Merge #7295: fix: read governance debug log tail in binary mode
0293c6d fix: read governance debug log tail in binary mode (PastaClaw) Pull request description: # Summary - fix `feature_governance_cl.py` log tail polling to seek `debug.log` in binary mode - decode the tailed bytes after reading so the seek offset stays valid for the stream mode - preserve the existing behavior of scanning only the last 100 KiB for the expected governance tip message ## Context This is a follow-up for a valid review finding from merged PR #7258: <#7258 (comment)> Upstream `develop` currently opens `debug.log` in text mode but computes the seek position with a binary offset. The final fix here uses a fully binary tail read and decodes afterward, which avoids both mixed-mode seek problems and text-stream offset arithmetic. ## Validation - `python3 -m py_compile test/functional/feature_governance_cl.py` - pre-PR code review gate verdict: `ship` I did not run `feature_governance_cl.py` end-to-end because this worktree does not have built `dashd`/test binaries available, and building Dash Core would be disproportionate for this narrowly scoped Python functional-test fix. Top commit has no ACKs. Tree-SHA512: 0f5f4837da1657e35a370e8591a4438c610084ce8f9b277be9e20c7318d48d86ada3c4a78b3e8182a5b61797bd72344addc9e07503581c7095ecb55e17aa8c5b
2 parents 7e524b1 + 0293c6d commit 4a0fd85

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

test/functional/feature_governance_cl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ def run_test(self):
147147
expected_msg = f'CGovernanceManager::UpdatedBlockTip -- nCachedBlockHeight: {tip_height}'
148148

149149
def governance_tip_updated(node):
150-
with open(node.debug_log_path, encoding='utf-8') as dl:
150+
with open(node.debug_log_path, "rb") as dl:
151151
seek_pos = node.debug_log_size(mode="rb") - 100 * 1024 # read the last 100 KiB only
152152
dl.seek(seek_pos if seek_pos > 0 else 0)
153-
debug_log_part = dl.read()
153+
debug_log_part = dl.read().decode("utf-8", errors="replace")
154154
return expected_msg in debug_log_part
155155

156156
for node in self.nodes[0:5]:

0 commit comments

Comments
 (0)