if you want to actualy be safe from races here you need to check under the lock

i.e.
lock()
if p.vesrionKNown {
     unlock()
     return error
}
p.versionKnown = true
unlock()

else the above is arguably racy (though not in practis since we run inbound messages in series)