When full-node receives a request from SPV client to check if given transaction exists in the blockchain - does it always re-calculate the merkle tree on the fly in order to return merkle path + block header to SPV client for given transaction ID?
How does it look like from performance point of view? Is there is any merkle tree caching for example? Because as I understand the node will have to do the following steps:
- Find a block in which given transaction ID exists
- Fetch all transactions from that block
- Calculate merkle tree
- Return merkle path with relevant hashes necessary to confirm merkle root