Skip to content

[fix]#1029 blockstamp in raw documents incoherence

inso requested to merge fix_block_peer_documents into dev

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.block is the most recent, from thePeer.block
  • peerEntity.raw is the older data, from peerEntityOld.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 ^^

Merge request reports