Why is there an addrlocal field in the output of the RPC call getPeerInfo, and how SPVs handle it? According to the Bitcoin core developer reference, the RPC call getPeerInfo has in its output a field called "addrlocal" which holds our IP from the worldview of the peer.

Why is this output there? Is it used anywhere? Does it have a use case?

Furthermore, they commented that "Most SPV nodes set this to 127.0.0.1:8333", why would an SPV node do that?
Why is this output there?


Because it is part of the version P2P message. getpeerinfo largely outputs the information provided by the version message.


  Is it used anywhere? Does it have a use case?


Currently, no. However it may have been included in the version message because Bitcoin was originally designed for things to go directly to IP addresses. There used to be a Pay-to-IP thing where this could have been useful.


  Furthermore, they commented that "Most SPV nodes set this to 127.0.0.1:8333", why would an SPV node do that?


Because it is easier to implement and no one actually uses it.