This changes how block height of a transaction in the memory pool is obtained, so that instead of being stored in CTxMemPoolEntry, it is derived when asked for.
This has a few advantages:-
- It reduces the memory usage of TxMemPoolEntry
- It allows the correct height to be used for transactions loaded from mempool.dat
- It allows the correct height to be used for transactions saved to the memory pool during initial block download.
- It therefore improves fee estimation given that correct values are being used.
Disadvantages:-
- It requires access to the active chain by various functions that previously did not require access, and a lock on cs_main while doing this.
Draft as still testing, but opening to request comments.