Page MenuHomePhabricator

rpc: Avoid useless mempool query in gettxoutproof
ClosedPublic

Authored by PiRK on Jul 14 2021, 07:55.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCd23ae6f6ee5a: 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

Event Timeline

PiRK requested review of this revision.Jul 14 2021, 07:55

@bot build-master

src/validation.h
244 ↗(On Diff #29174)

txid

hash -> txid in GetTransaction function documentation

This revision is now accepted and ready to land.Jul 15 2021, 09:35
This revision was landed with ongoing or failed builds.Jul 15 2021, 09:48
This revision was automatically updated to reflect the committed changes.