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

Don't do mempool lookups for "mempool" command without a filter #7174

Merged
merged 1 commit into from Dec 5, 2015

Conversation

@TheBlueMatt
Copy link
Contributor

TheBlueMatt commented Dec 5, 2015

No description provided.

@pstratem
Copy link
Contributor

pstratem commented Dec 5, 2015

utACK

@pstratem
Copy link
Contributor

pstratem commented Dec 5, 2015

This performance regression was introduced in 319b116

@petertodd
Copy link
Contributor

petertodd commented Dec 5, 2015

utACK

1 similar comment
@jgarzik
Copy link
Contributor

jgarzik commented Dec 5, 2015

utACK

@gmaxwell
Copy link
Contributor

gmaxwell commented Dec 5, 2015

ACK. Good catch, it makes a huge performance difference with a large mempool. The problem still exists with a filter set, but it's a nice step forward. This change also makes the code simpler and clearer, which is always a bonus. I think we should take this back to 0.12 as well.

@gmaxwell gmaxwell merged commit 96918a2 into bitcoin:master Dec 5, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
gmaxwell added a commit that referenced this pull request Dec 5, 2015
96918a2 Don't do mempool lookups for "mempool" command without a filter (Matt Corallo)
@gmaxwell gmaxwell added this to the 0.12.0 milestone Dec 6, 2015
@dcousens
Copy link
Contributor

dcousens commented Dec 7, 2015

utACK

@laanwj
Copy link
Member

laanwj commented Dec 7, 2015

Posthumous ACK on the code change.
But this should have had a description and motivation in the commit message and PR description.

laanwj added a commit that referenced this pull request Dec 7, 2015
Github-Pull: #7174
Rebased-From: 96918a2
@luke-jr
Copy link
Member

luke-jr commented Dec 7, 2015

Agreed, I was confused as to its behaviour for a while. The description given sounds like "mempool" wouldn't work at all with non-filter connections.

@jgarzik
Copy link
Contributor

jgarzik commented Dec 7, 2015

Da. The description confused several devs...

@gmaxwell
Copy link
Contributor

gmaxwell commented Dec 7, 2015

Ah, I didn't see the potential for confusion it all. Though the description was complete and accurate, what "mempool lookup" means and is ambigious I could see it how you might extract that from the description without reading the code.

For short patches I try to read the code before the description, so as to not be biased by what it says it does and fail to see what it actually does. I would have expected with three acks from regulars that someone would have pointed out something like that earlier. Live and learn.

@dcousens
Copy link
Contributor

dcousens commented Dec 8, 2015

Title made sense to me, I can understand how the misconception could exist, but, upon reading the code it was clear that it was just moving the branching logic around such that mempool.lookup(...) is only being done when necessary instead of pre-emptively.

bool fInMemPool = mempool.lookup(hash, tx);
if (!fInMemPool) continue; // another thread removed since queryHashes, maybe...
if (!pfrom->pfilter->IsRelevantAndUpdate(tx)) continue;
}

This comment has been minimized.

Copy link
@dcousens

dcousens Dec 8, 2015

Contributor

There is 1 other change that wasn't described here, which is !IsRelevantAndUpdate and vInv.size() === MAX_INV_SZ would previously cause a "inv" message to be pushed.
This does not occur now.

However, given the logic that vInv.size() is only increased if isRelevantAndUpdate was true anyway, means AFAIK this shouldn't be an issue.

I guess, that is a minor performance optimization then 👍 😃

zkbot added a commit to zcash/zcash that referenced this pull request Apr 5, 2018
Add NODE_BLOOM service bit

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6579
  - Zcash equivalent of BIP 111
- bitcoin/bitcoin#6652
  - Docs for BIP 111
- bitcoin/bitcoin#7087
- bitcoin/bitcoin#7174
- bitcoin/bitcoin#8709

Part of #2074. Closes #2738.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants
You can’t perform that action at this time.