> 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