GetTransaction implicitly and unconditionally asks the mempool global for a transaction. This is problematic for several reasons:
- gettxoutproofis 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