Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix logical inconsistency in log entry formatting in index.html #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mdqst
Copy link

@mdqst mdqst commented Jan 28, 2025

I noticed a logical inconsistency in the log entry formatting. The current code uses padStart(5) on newBlock.hash, which doesn't make sense for cryptographic hashes as they are typically much longer than 5 characters.

To address this, I replaced padStart(5) with slice(0, 5) to ensure only the first 5 characters of the hash are displayed. This change aligns with the intended behavior of showing a concise representation of the hash.

addLogEntry(`${newBlock.height}: ${newBlock.hash.slice(0, 5)}`);

This adjustment ensures the log entries are both meaningful and consistent.

@Twey
Copy link
Collaborator

Twey commented Feb 6, 2025

Hi @mdqst, can you elaborate a bit more on what this change aims to accomplish? So long as the hash is longer than 5 characters long it seems that these calls should be equivalent — but slice will not behave as well if the hash is shorter (which it shouldn't be — but technically from our perspective this is a freeform string).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants