I'm a bit confused by something regarding Tor. As per what I have read and confirmed in this answer Tor: Is a Diffie-Hellman key exchange being done over recipient of traffic? the client does a DH key exchange with each node in the relay.
This results in 3 shared secrets and the client encrypts the message 3 times with each different key.
To decrypt the node uses its shared DH key to peel off a layer.
Problem is that the node must know which DH shared secret to use as I assume there are many clients doing this and the node may have many of these. So in order to use the correct shared secret it needs to know which DH exchange this specific message is for and it can then know the sender.
What an I missing?