forked from Qortal/qortal
Transaction expiry wasn't happening. Use NTP.getTime to check whether transactions have expired. Also reject expired transactions when trying to add them to unconfirmed pool. Sometimes producing a task took way too long, causing massive spikes in the number of threads and peer disconnections. This is down to a repository pool exhaustion, so RepositoryManager.getRepository() would block (for up to 5 minutes). The key method at fault was Network.getConnectablePeer(). Various fixes: NetworkProcessor's executor now reaps old threads after only 10 seconds instead of the usual 60 seconds. Change logging in Network to help diagnose disconnection and repository issues. RepositoryManager now has a tryRepository() call that is non-blocking and returns null if repository pool is exhausted. Repository pool size increased from default (10) to 100. Pruning peers is now opportunistic, using tryRepository(), and returns early if repository pool is exhausted. getConnectablePeer() is now opportunistic, using tryRepository(), and returns null (no peer candidate for connection) if repository pool is exhausted. Merging peers is not opportunistic, using tryRepository(). Peer ping interval increased from 8s to 20s. HSQLDBRepositoryFactory now logs when getConnection() takes over 1000ms. Added more trace-level logging to ExecuteProduceConsume to highlight slow produceTask() calls.