HomePhabricator

rpc: Avoid useless mempool query in gettxoutproof

Description

rpc: Avoid useless mempool query in gettxoutproof

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 core#19556

This is a backport of 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

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Jul 26 2020, 07:59
PiRKCommitted on Jul 15 2021, 09:48
PiRKPushed on Jul 15 2021, 09:48
Reviewer
Restricted Project
Differential Revision
D9783: rpc: Avoid useless mempool query in gettxoutproof
Parents
rABC0158b5aeebf6: Pass mempool reference to chainstate constructor
Branches
Unknown
Tags
Unknown