Can failed Transactions figure out which Channel is exhausted? According to information in this LND PR the sender of an TemporaryChannelFailure can be determined:


  In many cases it is impossible for the sender to determine which of the two nodes in a pair is responsible for the failure. In this situation, we now penalize bidirectionally. This does not hurt the good node of the pair, because only its connection to a bad node is penalized.


So my understanding of this comment is, the channel, or at least the node next to one of the exhausted channels can be identified quite easily. Is it really that easy? Can TemporaryChannelFailure and therefore channel exhaustions always be assigned to two nodes or one channel?

I always assumed, the error cannot be assigned to a node or channel at all.

This might simplify the work of some papers, such as On the Difficulty of Hiding the Balance
of Lightning Network Channels by J Herrera-Joancomarti et al., or open new attack vectors.

Edit: more links for further research

In case someone wants to give a more in-depth answer or do research on top of this, here are some links to the code in the lnd client github code base:


In lightningnetwork/lightning-onion crypto.go, function DecryptError, the client cycles through the secrets to unwrap the error and identify the sender index.
In lightningnetwork/lnd htlcswitch/switch.go, function parseFailedPayment this DecryptError function is used to access the failure.
Later this value will be accessed e. g. in missioncontrol.go or result_interpretation.go as FailureSourceIdx, failureSourceIdx or failureSrcIdx.
As far as I understand (but I did not double check the code) the answer is yes. The error messages in the onion seem to be encrypted in a way so that only the origanal sender of the onion can decrypt it. Since the error also had to be padded to keep the error onion of constant length the key derivation scheme for sending onions is kind of reused. In that sense the receiver of the error message unwraps all the envelopes and thus should know from which node the error arose.