Skip to content

Conversation

sdaftuar
Copy link
Member

filterInventoryKnown is only used when relaying transactions, so stop adding block hashes to the filter.

Also updates a comment that is no longer correct.

filterInventoryKnown is only used when relaying transactions,
so stop adding block hashes to the filter.
@maflcko maflcko added the P2P label Apr 27, 2016
@theuni
Copy link
Member

theuni commented Apr 27, 2016

May as well skip in the fBlocksOnly case too?

@laanwj
Copy link
Member

laanwj commented Apr 28, 2016

May as well skip in the fBlocksOnly case too?

Agree, seems to be no reason to add it to AddInventoryKnown in that case.

@laanwj
Copy link
Member

laanwj commented Apr 28, 2016

Concept ACK

@sdaftuar
Copy link
Member Author

Yeah, I think that makes sense. I thought at first that maybe we'd want filterInventoryKnown to be as correct as possible even in the fBlocksOnly case, since we might still relay transactions to that peer (eg if we have a whitelisted peer and -whitelistrelay is on), but given that it's a protocol violation this seems like a silly thing to worry about.

I was thinking we could probably use a p2p regression test that exercises filterInventoryKnown, as I don't believe any of our tests would fail if it were broken?

I'll plan to update this PR at some point with a test and the change for the fBlocksOnly case.

@sipa
Copy link
Member

sipa commented May 5, 2016

utACK 383fc10

@gmaxwell
Copy link
Contributor

utACK.

I think blocks only will later be generalized to more degrees than just literally blocks only yes or no, and we probably shouldn't go around adding too much specialization in the codebase for a global blocks only mode unless it's a pretty big win. (and maybe saving the memory of ever allocating some transaction related filters in the first place might be... but insertions? not so much)

@sdaftuar
Copy link
Member Author

Ok I'll leave this alone then.

@sipa
Copy link
Member

sipa commented May 25, 2016

Given that the scope of AddInventoryKnown changes, perhaps it should be renamed to AddInventoryTxKnown, and only take a uint256 rather than a CInv? That may reduce confusion in upcoming refactors.

@sipa sipa mentioned this pull request May 26, 2016
@sipa
Copy link
Member

sipa commented May 31, 2016

Lightly tested ACK. Setup: two mainnet full nodes with this patch (A publicly reachable, B -connect'ed to A) and a lightweight node C (connected to the public network). Tested block synchronization/relay of B from A, relay of transactions to from A to B, relay of newly created transactions by B and C through A. Nothing unusual.

@sipa sipa merged commit 383fc10 into bitcoin:master Jun 1, 2016
sipa added a commit that referenced this pull request Jun 1, 2016
383fc10 Only use AddInventoryKnown for transactions (Suhas Daftuar)
codablock pushed a commit to codablock/dash that referenced this pull request Dec 22, 2017
383fc10 Only use AddInventoryKnown for transactions (Suhas Daftuar)
codablock added a commit to codablock/dash that referenced this pull request Dec 27, 2017
This should have been part of Bitcoin bitcoin#7960 but was missed in merge
conflict resolution.
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
383fc10 Only use AddInventoryKnown for transactions (Suhas Daftuar)
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
This should have been part of Bitcoin bitcoin#7960 but was missed in merge
conflict resolution.
zkbot added a commit to zcash/zcash that referenced this pull request Aug 17, 2021
ZIP 239 preparations 4

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#5913
  - Replaces #3111.
  - Includes an extra commit included by upstream in the merge outside the PR.
- bitcoin/bitcoin#6519
- bitcoin/bitcoin#7179
- bitcoin/bitcoin#7853
- bitcoin/bitcoin#7960
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants