Various logging improvements and fixes.

This commit is contained in:
CalDescent 2022-01-07 14:08:11 +00:00
parent 374f6b8d52
commit d8cbec41d2
3 changed files with 7 additions and 4 deletions

View File

@ -218,7 +218,7 @@ public class ArbitraryDataTransactionBuilder {
// Get chunks metadata file // Get chunks metadata file
ArbitraryDataFile metadataFile = arbitraryDataFile.getMetadataFile(); ArbitraryDataFile metadataFile = arbitraryDataFile.getMetadataFile();
if (metadataFile == null && arbitraryDataFile.chunkCount() > 1) { if (metadataFile == null && arbitraryDataFile.chunkCount() > 1) {
throw new DataException(String.format("Chunks metadata data file is null but there are %i chunks", arbitraryDataFile.chunkCount())); throw new DataException(String.format("Chunks metadata data file is null but there are %d chunks", arbitraryDataFile.chunkCount()));
} }
String digest58 = arbitraryDataFile.digest58(); String digest58 = arbitraryDataFile.digest58();

View File

@ -229,6 +229,7 @@ public class ArbitraryDataFileListManager {
byte[] signature = arbitraryTransactionData.getSignature(); byte[] signature = arbitraryTransactionData.getSignature();
String signature58 = Base58.encode(signature); String signature58 = Base58.encode(signature);
// Require an NTP sync
Long now = NTP.getTime(); Long now = NTP.getTime();
if (now == null) { if (now == null) {
return false; return false;
@ -246,7 +247,8 @@ public class ArbitraryDataFileListManager {
} }
this.addToSignatureRequests(signature58, true, false); this.addToSignatureRequests(signature58, true, false);
LOGGER.debug(String.format("Sending data file list request for signature %s...", Base58.encode(signature))); List<Peer> handshakedPeers = Network.getInstance().getHandshakedPeers();
LOGGER.debug(String.format("Sending data file list request for signature %s to %d peers...", signature58, handshakedPeers.size()));
// Build request // Build request
Message getArbitraryDataFileListMessage = new GetArbitraryDataFileListMessage(signature, now, 0); Message getArbitraryDataFileListMessage = new GetArbitraryDataFileListMessage(signature, now, 0);
@ -402,10 +404,11 @@ public class ArbitraryDataFileListManager {
// If we've seen this request recently, then ignore // If we've seen this request recently, then ignore
if (arbitraryDataFileListRequests.putIfAbsent(message.getId(), newEntry) != null) { if (arbitraryDataFileListRequests.putIfAbsent(message.getId(), newEntry) != null) {
LOGGER.debug("Ignoring hash list request from peer {} for signature {}", peer, signature58);
return; return;
} }
LOGGER.debug("Received hash list request from peer {} for signature {}", peer, Base58.encode(signature)); LOGGER.debug("Received hash list request from peer {} for signature {}", peer, signature58);
List<byte[]> hashes = new ArrayList<>(); List<byte[]> hashes = new ArrayList<>();
ArbitraryTransactionData transactionData = null; ArbitraryTransactionData transactionData = null;

View File

@ -135,7 +135,7 @@ public class HSQLDBArbitraryRepository implements ArbitraryRepository {
return; return;
} }
throw new IllegalStateException(String.format("Supplied data is larger than maximum size (%i bytes). Please use ArbitraryDataWriter.", MAX_RAW_DATA_SIZE)); throw new IllegalStateException(String.format("Supplied data is larger than maximum size (%d bytes). Please use ArbitraryDataWriter.", MAX_RAW_DATA_SIZE));
} }
@Override @Override