function encodeSyncState(syncState) {
  const encoder = new Encoder()
  encoder.appendByte(PEER_STATE_TYPE)
  encodeHashes(encoder, syncState.sharedHeads)
  return encoder.buffer
}
Takes a SyncState and encodes as a byte array those parts of the state that should persist across
an application restart or disconnect and reconnect. The ephemeral parts of the state that should
be cleared on reconnect are not encoded.