Skip to content

Conversation

glozow
Copy link
Member

@glozow glozow commented Mar 1, 2021

This is basically a mini, IBD-only version of #21224

Incoming transactions aren't really relevant until we're caught up. That's why we send a giant feefilter and don't send tx getdatas, but we also shouldn't process them if peers send them anyway. Simply ignore them.

@DrahtBot DrahtBot added the P2P label Mar 1, 2021
@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 1, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #20277 (test: Extend p2p_ibd_tx_relay.py to verify no-transaction are requested during IBD by ariard)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

While this probably has no effect in practice, it shouldn't hurt to do either.

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

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

Concept ACK. Thanks for adding tests!

@glozow glozow force-pushed the 2021-02-ibd-txrelay branch from 5b9036e to d631448 Compare March 2, 2021 19:17
Copy link

@ariard ariard left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this, I exercised new test coverage, works as expected!

W.r.t to Marco point, I don't think logging this minor rejection case is that important.

@jnewbery
Copy link
Contributor

jnewbery commented Mar 3, 2021

utACK d631448

Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

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

utACK

@sdaftuar
Copy link
Member

sdaftuar commented Mar 9, 2021

Issues like those being explored in #21106 — where IBD may kick in at unintuitive times, complicating our understanding of the network due to special-case interactions throughout our codebase — are why I think we should hesitate before adding more checks gated on IBD and ensure we have a good reason for doing so.

In this case, I think our code is simpler to understand if we either always or never processed unrequested transactions (and the benefit to skipping this while in IBD seems small in comparison).

Copy link
Contributor

@brunoerg brunoerg left a comment

Choose a reason for hiding this comment

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

tACK d631448

Ubuntu 20.04

  • Ran the test individually and via test_runner (with all tests)
  • Code looks fine (comments/docs are very good - they explains each test step perfectly)

@DrahtBot
Copy link
Contributor

🕵️ @sipa has been requested to review this pull request as specified in the REVIEWERS file.

@glozow glozow force-pushed the 2021-02-ibd-txrelay branch from d631448 to 89ebd01 Compare March 24, 2021 21:56
@glozow
Copy link
Member Author

glozow commented Mar 24, 2021

Just pushed some changes addressing @ariard’s review comment and clarifying the comment about “not a protocol violation.”

On why add a gate for unsolicited transactions in IBD but not the general case:

There can perhaps be an observable difference if we stop processing unsolicited transactions in the general case - someone mentioned in #21224 that there are clients that wouldn’t be able to broadcast their transactions because they don’t follow the inv/getdata dialogue. I'm not sure what the status is on that discussion so I won't speak to it too much.

On the other hand, I don’t think there’s any downside to ignoring unsolicited transactions in IBD. We just have less wasted effort: Right now, if we can’t validate the transaction yet, we waste time putting it into orphan pool. If it conflicts with a block tx we see later on, we need to go through removing it from our mempool. If it’s valid and we can validate it, doing so while in IBD doesn’t benefit us - even if we come out of IBD really quickly (e.g. on a restart), we can download it again in a rebroadcast (or, later on, a reconciliation with Erlay). My personal opinion is that getting to exit early is worth the complexity of an extra IsIBD check, even if we later change it to ignore all unsolicited transactions.

@jnewbery
Copy link
Contributor

jnewbery commented Jun 9, 2021

Code review ACK 89ebd01

@glozow glozow force-pushed the 2021-02-ibd-txrelay branch from 89ebd01 to 1665bbd Compare June 11, 2021 09:47
@glozow glozow force-pushed the 2021-02-ibd-txrelay branch from 1665bbd to 648c5c7 Compare June 11, 2021 10:23
@jnewbery
Copy link
Contributor

ACK 648c5c7

Copy link
Contributor

@lsilva01 lsilva01 left a comment

Choose a reason for hiding this comment

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

Tested ACK 648c5c7 on Ubuntu 20.04.
This simplifies the IBD logic a bit.

luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 27, 2021
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>

Github-Pull: bitcoin#21327
Rebased-From: 8d5697c
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 27, 2021
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>

Github-Pull: bitcoin#21327
Rebased-From: 648c5c7
@naumenkogs
Copy link
Member

The code 648c5c7 looks correct, but I share the hesitation suhas expressed above.

glozow and others added 2 commits October 28, 2021 16:31
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
@glozow glozow force-pushed the 2021-02-ibd-txrelay branch from 648c5c7 to 6aed8b7 Compare October 28, 2021 15:36
@jnewbery
Copy link
Contributor

jnewbery commented Nov 2, 2021

reACK 6aed8b7

@laanwj
Copy link
Member

laanwj commented Nov 30, 2021

Code review ACK 6aed8b7
I've always shared Suhas' hesitation with regard to gating things on some (pretty arbitrary) "initial block download" criterion. But in this specific case, without an up-to-date view of blocks it's not that useful to process transactions, so I think it makes sense.

@laanwj laanwj merged commit 63c0d0e into bitcoin:master Nov 30, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 1, 2021
RandyMcMillan pushed a commit to RandyMcMillan/mempool-tab that referenced this pull request Dec 23, 2021
…e in IBD

3f4019a [test] tx processing before and after ibd (glozow)
ef3eea0 [net_processing] ignore all transactions during ibd (glozow)

Pull request description:

  This is basically a mini, IBD-only version of #21224

  Incoming transactions aren't really relevant until we're caught up. That's why we send a giant feefilter and don't send tx getdatas, but we also shouldn't process them if peers send them anyway. Simply ignore them.

ACKs for top commit:
  jnewbery:
    reACK 3f4019a
  laanwj:
    Code review ACK 3f4019a

Tree-SHA512: 8e1616bf355f9d0b180bdbc5461f24c757dc5d7bc7bf651470f3b0bffcca5d5e68287106255b5cede2d96b42bce448a0f8c0649de35a530c5e079f7c89c70a35
@glozow glozow deleted the 2021-02-ibd-txrelay branch January 27, 2022 15:11
@bitcoin bitcoin locked and limited conversation to collaborators Jan 27, 2023
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.