methodtDoublePirServer.Answer
procedure Answer(const aQuery: tPirWordArray; aHintVersion: UInt32; const aHintDigest: tBytes; var aAnswer: tPirWordArray);
The answer to one query, from every database.
aHintVersion and aHintDigest ARE THE CLIENT'S, not this server's: they name the hint the query was formed against, and they are what the client's own HintVersion and HintDigest read. They are here so that a query whose answer the client would refuse is refused BEFORE the tables are read - which for this scheme is the first-level MatVec over every octet of every database, the one product a lookup cannot avoid.
IT COMPUTES NOTHING BUT THE ANSWER, and that is a statement about WRITES: it reads the parameters, the tables, both hints, the written mark, the version and the stamp, and it assigns to none of them, so any number of threads may answer from one server at once. The stamp it compares against is the FIELD and not the getter, which is what keeps that true; the getter computes nothing either.
IT REFUSES, with ePirDimensionMismatch, when no hint has been built at all - as it always has - and with ePirHintStale when a hint stands with no stamp over it, which no call that returned can leave behind, because BuildHint seals what it built. What can is a BuildHint that RAISED before it sealed: it allocates both hints before it accumulates, so a failure inside the accumulation leaves them standing and unstamped. The guard is also what keeps a future partial rebuild from quietly putting the digest back on the serving path.
IT REFUSES, with ePirHintStale, when the tables have been written through PutRecord since the last BuildHint - and only then. A write through the Table property sets nothing, so on its own it causes no refusal; what it equally cannot do is CLEAR the mark, so a Table write standing beside a PutRecord of its own is refused along with it, and accounting for that is the caller's. Nothing the client holds could catch the marked case - the hint a write leaves standing is byte for byte the one the client downloaded, and its digest is unchanged - so the check is here, on the server's own state, before any answer exists.
IT REFUSES, with ePirHintVersionMismatch, when aHintVersion is not this server's, and with ePirHintMismatch when aHintDigest is not the stamp over the hint this server holds. THEY ARE THE CLIENT'S OWN CLASSES, the ones Recover would have raised on the same disagreement one round trip later. The stale refusal is kept AHEAD of both, because a write to the tables leaves the version and the digest agreeing and a client sent to refresh its hint would fetch one its next query was refused against anyway.
THIS DOES NOT WEAKEN THE CLIENT'S CHECK AND CANNOT REPLACE IT. It is an optimisation for an HONEST server: a dishonest one can answer anything and stamp it anything, so Recover still makes both comparisons itself and nothing on the client was removed for this.
A CLIENT THAT DECLINES TO NAME ITS HINT - an empty aHintDigest - IS SERVED, at the cost of the scan, exactly as every client was before the arguments existed; aHintVersion is then not read either. The server refuses what it KNOWS will fail, and about an unidentified query it knows nothing. A deployment that wants identification to be mandatory refuses the empty stamp itself, before the call.