How does a client get the merkle branch of a transaction?
There is no way in the current P2P protocol to request a historical (=confirmed) transaction, without requesting the block it is in. Supporting that would require the peer to have a full index of all transactions ever, which isn't necessary for normal operation.

To request a transaction, you will either:


Use getdata MSG_TX &lt;txid&gt; to request a memory pool or recently relayed transaction. In this case, no block information exists.
Use getdata MSG_BLOCK &lt;blkid&gt; to request a full block, in which case you get the block with it, and need to check the full merkle tree anyway.
Use getdata MSG_FILTERED_BLOCK &lt;blkid&gt; to request a filtered block (see BIP37), in which case you can check the partial merkle tree to verify the transaction is indeed part of the block.