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

Use full block hash as unique identifier in debug.log #1670

Merged
merged 2 commits into from
Nov 16, 2012

Conversation

luke-jr
Copy link
Member

@luke-jr luke-jr commented Aug 13, 2012

This is a rebase and cleanup of #1426

Note that while these bits are less significant numerically, they are more useful because they are likely to be unique (whereas the most significant bits will generally be zero)

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/0e6b9c809b4941d3062f092743df8d8e5588e7c9 for binaries and test log.

@sipa
Copy link
Member

sipa commented Aug 17, 2012

I believe @gmaxwell argued in an earlier request for just using the full string. I wouldn't mind, and it enables using getblock directly, for example, without extra lookup. It's still a debug log file, right?

@@ -114,6 +114,8 @@



#define BlockSubstr(hash) hash.ToString().substr(48)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use an inline function, not a macro

@laanwj
Copy link
Member

laanwj commented Aug 20, 2012

How long is the full string? 64? I suppose so. This patch makes it print 48 characters, so I guess you could just as well go all the way print the full string.

@luke-jr
Copy link
Member Author

luke-jr commented Aug 20, 2012

No, this patch skips 48 characters, so prints 16. I don't care either way, and it seems there's support for the full hash, so might as well do that anyway...

@@ -114,6 +114,13 @@



static inline
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you always trying to introduce new and weird coding conventions?
static inline std::string BlockSubstr(const uint256& hash) would do the job, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a convention we use, but in some places it is. Still, can you change it, @luke-jr?

EDIT: apparently it's used in some test cases already. Nevermind.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also for changing it. Splitting up lines can be useful when they get too long for convenient reading, but this really breaks the flow of reading.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was changed by another dev and we need a rebase for this pull.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/508c455bc337c3a56d1499c5cd691114427c8f46 for binaries and test log.

@rebroad
Copy link
Contributor

rebroad commented Sep 1, 2012

So.. this patch now makes the lines in debug.log longer instead of shorter?

@jgarzik
Copy link
Contributor

jgarzik commented Sep 4, 2012

ACK save for bikeshedding: "BlockSubstr" is a misleading name, because the end result of this changeset is not a substring, but rather the full hash string. Maybe "BlockHashStr".

@luke-jr
Copy link
Member Author

luke-jr commented Sep 4, 2012

Renamed.

@rebroad
Copy link
Contributor

rebroad commented Sep 5, 2012

How long will the line in the debug.log file now be with this change? What width of window is needed for it to look sufficiently neat? Is it worth adding a command line option to specify the length or format of the block string perhaps?

@luke-jr
Copy link
Member Author

luke-jr commented Sep 5, 2012

It's a debug log; it doesn't have to look neat. NACK on a command line option...

@laanwj
Copy link
Member

laanwj commented Sep 5, 2012

Agree with @luke-jr here. The point of the log is simply to give as much as
possible info for debugging issues.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/c97992845777f0625552153b5644f556fa15c8f4 for binaries and test log.

@sipa
Copy link
Member

sipa commented Sep 21, 2012

ACK

@sipa
Copy link
Member

sipa commented Oct 28, 2012

Needs rebase.

@luke-jr
Copy link
Member Author

luke-jr commented Nov 13, 2012

Rebased

@sipa
Copy link
Member

sipa commented Nov 13, 2012

Hmm just realized that this is only for blocks. Any reason not to print full hashes for transactions?

jgarzik pushed a commit that referenced this pull request Nov 16, 2012
Use full block hash as unique identifier in debug.log
@jgarzik jgarzik merged commit 3ef292d into bitcoin:master Nov 16, 2012
laudney pushed a commit to reddcoin-project/reddcoin-3.10 that referenced this pull request Mar 19, 2014
Use full block hash as unique identifier in debug.log
@luke-jr luke-jr deleted the blksubstr branch January 1, 2015 10:14
suprnurd pushed a commit to chaincoin-legacy/chaincoin that referenced this pull request Dec 5, 2017
- Convert satoshis to duffs
 - Correct order of fields in GetAddressUtxos
 - Add missing field from GetAddressDeltas (blockindex)
 - Add HelpExamples to gettxoutproof and verifytxoutproof
suprnurd pushed a commit to chaincoin-legacy/chaincoin that referenced this pull request Dec 5, 2017
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants