import { type ProtocolMismatch } from "./types"; export interface ProtocolMismatchSnapshot { revision: number; mismatch: ProtocolMismatch | null; } export const INITIAL_PROTOCOL_MISMATCH_SNAPSHOT: ProtocolMismatchSnapshot = { revision: 0, mismatch: null, }; /** Keeps listener events and bootstrap queries monotonic across async races. */ export const newestProtocolMismatchSnapshot = ( current: ProtocolMismatchSnapshot, candidate: ProtocolMismatchSnapshot, ): ProtocolMismatchSnapshot => candidate.revision > current.revision ? candidate : current;