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

Quieter initial block download #1337

Closed
wants to merge 1 commit into from
Closed

Conversation

rebroad
Copy link
Contributor

@rebroad rebroad commented May 17, 2012

This pull is a subset of pull #1311, which many said was too big, and did too many things. It wasn't easy to break it up into smaller pieces as so many are interdependent. Anyway, here goes. Comments welcome.

This pull adds a command line argument "-quietinitial", which is intended to make the "traffic" in debug.log less so that the block download progress can be more easily seen. It's off by default, and without using it, things look the same as usual.

I realise that some of what this does can be achieved with 3rd party log file filterers, but some of it can't, and it's mostly developers that use such 3rd party tools, and I'd like to help enable bitcoin to be useful to less technical people too.

This sub-pull, IMHO, isn't as useful unless combined with some of the other pull requests I've raised (and am still raising, due to hacking #1311 into smaller pieces).

I suspect the others will need rebasing depending on what order the pulls are effected. ho hum..!

Heh... #1337 is a cool pull number :) Not sure this one deserves such a number though!

Anyway, comments welcomed - I need to get a better idea of what makes a good pull or not.

bool CaughtUp()
{
int BlocksOfPeers = GetNumBlocksOfPeers();
//printf("CaughtUp: nBestHeight=%d, GetNumBlocksOfPeers()=%d\n", nBestHeight, BlocksOfPeers);
Copy link

Choose a reason for hiding this comment

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

I dislike commented out code and you have re-introduced "int BlocksOfPeers" here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.. These lines now removed. I obviously didn't update something somewhere in git. :-s

@Diapolo
Copy link

Diapolo commented May 17, 2012

As "Add build directory to .gitignore, so that it's not tracked." was merged to master, you should rebase this to not include that commit again.

And I'm sure (as you change more stuff and not only add "-quietinitial") you should split things up and explain more what your changes are doing.

@@ -303,7 +303,8 @@ void CAddrMan::Good_(const CService &addr, int64 nTime)
// TODO: maybe re-add the node, but for now, just bail out
if (nUBucket == -1) return;

printf("Moving %s to tried\n", addr.ToString().c_str());
if (CaughtUp() || !fQuietInitial)
Copy link
Member

Choose a reason for hiding this comment

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

Minor(?) nitpick: please check fQuietinitial (simple) before CaughtUp() (a function call)

Copy link

Choose a reason for hiding this comment

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

I like this suggestion, as it's a nice coding style. Perhaps someone should look all over the code and check if we can optimize control-flow statements!?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@luke-jr good point. I shall change these. Thanks. Now changed. Also, the fLogPeers was a rebase error, which belongs in a separate commit. I've finally gotten the hang of rebasing now I think!

@luke-jr
Copy link
Member

luke-jr commented May 19, 2012

src/main.cpp: In function ‘bool ProcessMessage(CNode*, std::string, CDataStream&)’:
src/main.cpp:2592:46: error: ‘fLogPeers’ was not declared in this scope

@rebroad
Copy link
Contributor Author

rebroad commented May 31, 2012

I've refactored this, making it simpler, and also separating the AskFor into two functions now, one for txs and one for blocks. This will make it easier to merge in #1404.

This makes debugg.log quieter during block chain catch up, so that it is easier to see the block download process.
@sipa
Copy link
Member

sipa commented Jun 12, 2012

Why does this add a function AskForBlock? It seems to change more than just disabling some debug output.

@Diapolo
Copy link

Diapolo commented Jun 12, 2012

I think rebroad is currently learning the tricks and handling of Github, this took me a while, too :).

@rebroad
Copy link
Contributor Author

rebroad commented Jun 14, 2012

@sipa The addition of AskForBlock is explained above. It's due to #1404.

@jgarzik
Copy link
Contributor

jgarzik commented Jul 5, 2012

Sorry... in general this is just a huge amount of changes for little value, during a special condition (IBD). These are events that might be interesting (if they fail or have problems or simply do not appear, when they should), even during initial block download.

NAK from me.... though if the other devs want to override the NAK, I won't complain.

Leaving pull request open due to this "weak NAK."

@jgarzik
Copy link
Contributor

jgarzik commented Aug 1, 2012

Consensus does not seem to want this, closing.

@jgarzik jgarzik closed this Aug 1, 2012
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Jan 22, 2019
changes to aid in testing and debugging
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request May 6, 2020
7e493df Using WAIT_LOCK macro instead of WaitableLock. (furszy)
a0d0e33 [Refactor] Complete move from CCriticalSection to identical RecursiveMutex (both are AnnotatedMixin<std::recursive_mutex>). (furszy)
6608757 doc: Add comment to cs_main and mempool::cs (furszy)

Pull request description:

  This was done on top of bitcoin#1335 and bitcoin#1336 (Starting in bb575f8). Effort to bring us up up-to-date with upstream's sync.h/cpp sources.

  This PR contains:

  * A complete move from CCriticalSection to identical RecursiveMutex (both are AnnotatedMixin<std::recursive_mutex>).

  * Using WAIT_LOCK macro instead of WaitableLock.

ACKs for top commit:
  random-zebra:
    utACK 7e493df
  Fuzzbawls:
    utACK 7e493df

Tree-SHA512: 539fe93566f90246409606acb0aaeb3a5f839110cb96af7868654738685a07b9e1332f8362a04d328825291007d24c80d0b34b1318edc4afe84a8ac8e5affe61
@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.

None yet

5 participants