Request only the missing hashes, not all of them.

This commit is contained in:
CalDescent 2022-02-14 19:33:36 +00:00
parent 58f11489db
commit 538ac30b4e

View File

@ -266,18 +266,16 @@ public class ArbitraryDataFileListManager {
List<Peer> handshakedPeers = Network.getInstance().getHandshakedPeers(); List<Peer> handshakedPeers = Network.getInstance().getHandshakedPeers();
List<byte[]> missingHashes = null; List<byte[]> missingHashes = null;
// // TODO: uncomment after GetArbitraryDataFileListMessage updates are deployed // Find hashes that we are missing
// // Find hashes that we are missing try {
// try { ArbitraryDataFile arbitraryDataFile = ArbitraryDataFile.fromHash(digest, signature);
// ArbitraryDataFile arbitraryDataFile = ArbitraryDataFile.fromHash(digest, signature); arbitraryDataFile.setMetadataHash(metadataHash);
// arbitraryDataFile.setMetadataHash(metadataHash); missingHashes = arbitraryDataFile.missingHashes();
// missingHashes = arbitraryDataFile.missingHashes(); } catch (DataException e) {
// } catch (DataException e) { // Leave missingHashes as null, so that all hashes are requested
// // Leave missingHashes as null, so that all hashes are requested }
// } int hashCount = missingHashes != null ? missingHashes.size() : 0;
// int hashCount = missingHashes != null ? missingHashes.size() : 0;
int hashCount = 0;
LOGGER.debug(String.format("Sending data file list request for signature %s with %d hashes to %d peers...", signature58, hashCount, handshakedPeers.size())); LOGGER.debug(String.format("Sending data file list request for signature %s with %d hashes to %d peers...", signature58, hashCount, handshakedPeers.size()));
// Build request // Build request