Make sure to check the received digest on download
This helped me find a bug in a rewrite of the remote worker, which is
independent of this change.
@@ -218,8 +218,13 @@ public class GrpcRemoteCache implements RemoteActionCache {
while (replies.hasNext()) {
replies.next().getData().writeTo(stream);
}
- return null;
}
+ Digest receivedDigest = Digests.computeDigest(path);
+ if (!receivedDigest.equals(digest)) {
+ throw new IOException(
+ "Digest does not match " + receivedDigest + " != " + digest);
+ }
+ return null;
});
} catch (RetryException e) {
Throwables.throwIfInstanceOf(e.getCause(), CacheNotFoundException.class);
