8000 rpc: Avoid useless mempool query in gettxoutproof by maflcko · Pull Request #19589 · bitcoin/bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rpc: Avoid useless mempool query in gettxoutproof #19589

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

Merged
merged 2 commits into from
Jul 28, 2020

Conversation

maflcko
Copy link
Member
@maflcko maflcko commented Jul 26, 2020

GetTransaction implicitly and unconditionally asks the mempool global for a transaction. This is problematic for several reasons:

  • gettxoutproof is for on-chain txs only and asking the mempool for on-chain txs is confusing and minimally wasteful
  • Globals are confusing and make code harder to test with unit tests

Fix both issues by passing in an optional mempool. This also helps with #19556

@maflcko
Copy link
Member Author
maflcko commented Jul 26, 2020

Based on feedback by @jnewbery in #19556 (comment)

@maflcko maflcko mentioned this pull request Jul 26, 2020
@bitcoin bitcoin deleted a comment from amirofski Jul 26, 2020
Copy link
Contributor
@promag promag left a comment

Choose a reason for hiding this comment

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

Code review ACK, refactor looks good with the following exception.

Copy link
Member
@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

ACK fa6e74b, I have reviewed the code and it looks OK, I agree it can be merged.

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.

@maflcko maflcko force-pushed the 2007-rpcMempool branch 2 times, most recently from fa612a7 to fadd84b Compare July 26, 2020 14:37
@maflcko
Copy link
Member Author
maflcko commented Jul 26, 2020

Addressed all feedback

@jnewbery
Copy link
Contributor

utACK fa5979d

Nice tidy-up. Thanks Marco!

@DrahtBot
Copy link
Contributor

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

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
@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

re-ACK fa5979d

@promag
Copy link
Contributor
promag commented Jul 26, 2020

Code review ACK fa5979d.

@fanquake fanquake merged commit a1da180 into bitcoin:master Jul 28, 2020
@maflcko maflcko deleted the 2007-rpcMempool branch July 28, 2020 09:02
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 28, 2020
fa5979d rpc: Avoid useless mempool query in gettxoutproof (MarcoFalke)
fa1f7f2 rpc: Style fixups in gettxoutproof (MarcoFalke)

Pull request description:

  `GetTransaction` implicitly and unconditionally asks the mempool global for a transaction. This is problematic for several reasons:

  * `gettxoutproof` is for on-chain txs only and asking the mempool for on-chain txs is confusing and minimally wasteful
  * Globals are confusing and make code harder to test with unit tests

  Fix both issues by passing in an optional mempool. This also helps with bitcoin#19556

ACKs for top commit:
  hebasto:
    re-ACK fa5979d
  jnewbery:
    utACK fa5979d
  promag:
    Code review ACK fa5979d.

Tree-SHA512: 048361b82abfcc40481181bd44f70cfc9e97d5d6356549df34bbe30b9de7a0a72d2207a3ad0279b21f06293509b284d8967f58ca7e716263a22b20aa4e7f9c54
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jul 15, 2021
Summary:
> GetTransaction implicitly and unconditionally asks the mempool global for a transaction. This is problematic for several reasons:
>
>  - gettxoutproof is for on-chain txs only and asking the mempool for on-chain txs is confusing and minimally wasteful
>  - Globals are confusing and make code harder to test with unit tests
>
> Fix both issues by passing in an optional mempool. This also helps with [[bitcoin/bitcoin#19556 | core#19556]]

This is a backport of [[bitcoin/bitcoin#19589 | core#19589]]

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D9783
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0