decred / dcrd

Decred daemon in Go (golang).
https://decred.org
ISC License
731 stars 288 forks source link

peer,server: Hash mix messages ASAP #3328

Closed jrick closed 3 months ago

jrick commented 3 months ago

When a mixing message (implementing the WriteHash(hash.Hash) method) is read from another peer, it is improper to use its Hash() method before calculating and storing the hash using WriteHash. Do this as early as possible in readMessage in the peer package. This avoids the need for callers to remember to do this step manually in the OnMix* callbacks.