[fix]#1029 blockstamp in raw documents incoherence
Pull request for code reviewing :
If we follow the state of peerEntityOld :
- if we found a peer in database, it is built from it
- if we didn't found a peer, it is built from received peer
thePeer
When we found a peer, we compare the blockstamp and updates peerEntityOld to thePeer values only if it is more recent.
But when we update peerEntityOld, the blockstamp field is not updated ! Thus, the peerEntity objects gets corrupted with 2 different data :
-
peerEntity.blockis the most recent, fromthePeer.block -
peerEntity.rawis the older data, frompeerEntityOld.getRaw()
And peerEntity gets saved in database...
PS : If there is a part of the code which you would like to clean, I would start with this PeeringService code, it's pretty hard to follow the states of the different variables other here ^^