// passing endpoint through here is an ugly hack, which should be removed once network code is refactored. public void onRequestWalletChunk(int chunk_num, RemoteEndpoint endpoint) { // TODO TODO TODO this function really should be done better if (synchronizing == true) { Logging.warn("Neighbor is requesting WalletState chunks, but we are synchronizing!"); return; } lastChunkRequested = DateTime.UtcNow; lock (pendingWsChunks) { if (chunk_num >= 0 && chunk_num < pendingWsChunks.Count) { ProtocolMessage.sendWalletStateChunk(endpoint, pendingWsChunks[chunk_num]); if (chunk_num + 1 == pendingWsChunks.Count) { outgoingSyncComplete(); } } else { Logging.warn(String.Format("Neighbor requested an invalid WalletState chunk: {0}, but the pending array only has 0-{1}.", chunk_num, pendingWsChunks.Count)); } } }