use of com.icodici.universa.node.StateRecord in project universa by UniversaBlockchain.
the class Main method startNode.
private void startNode() throws SQLException, IOException {
config.setConsensusConfigUpdater((config, n) -> {
// Until we fix the announcer
int negative = (int) Math.ceil(n * 0.11);
if (negative < 1)
negative = 1;
int positive = (int) Math.floor(n * 0.90);
if (negative + positive == n)
negative += 1;
int resyncBreak = (int) Math.ceil(n * 0.2);
if (resyncBreak < 1)
resyncBreak = 1;
if (resyncBreak + positive == n)
resyncBreak += 1;
log(myInfo.getNumber() + ": Network consensus is set to (negative/positive/resyncBreak): " + negative + " / " + positive + " / " + resyncBreak);
config.setPositiveConsensus(positive);
config.setNegativeConsensus(negative);
config.setResyncBreakConsensus(resyncBreak);
});
network = new NetworkV2(netConfig, myInfo, nodeKey);
node = new Node(config, myInfo, ledger, network);
cache = node.getCache();
parcelCache = node.getParcelCache();
StateRecord r = ledger.getRecord(HashId.withDigest("bS/c4YMidaVuzTBhHLkGPFAvPbZQHybzQnXAoBwaZYM8eLYb7mAkVYEpuqKRXYc7anqX47BeNdvFN1n7KluH9A=="));
if (r != null)
r.destroy();
clientHTTPServer.setConfig(config);
clientHTTPServer.setNode(node);
clientHTTPServer.setCache(cache);
clientHTTPServer.setParcelCache(parcelCache);
clientHTTPServer.setLocalCors(myInfo.getPublicHost().equals("localhost"));
}
Aggregations