Clarifications NewMessageCallback

Re: Clarifications NewMessageCallback

by Samuel Jean Michel Jacquier -
Number of replies: 0
I have questions too.

If I understand correctly, the callback is a function we will call for every message we get from the peers, whatever the message will be.
The NewMessageCallback function need an origin string, which is the original sender of the message, and the gossipPacket which is the packet to send. This function is registerd via the "RegisterCallback" function, which, I guess, should be called only one time during the construction of our gossiper.

But in the subject, we learn that :

If it comes from another peer A, the gossiper (1) stores A’s address from the “relay peer” field in its list of known peers, (2) changes the “relay peer” field to its own address , and (3) sends the message to all known peers besides peer A, leaving the “origin peer name” field unchanged

But as we established in the answers to this question, the gossipPacket should have its RelayPeer address changed before the call with our own address to pass some tests. It means that the original RelayPeerAddress will not be in the gossipPacket... So the callback function will not be able to recover it.

In this case, how would the callback have the address of A ? It is not in the arguments, but we need it to send the packets correctly.

So, am I understanding it wrong here ?