use of snowblossom.lib.NetworkParams in project snowblossom by snowblossomcoin.
the class BlockIngestorTest method testFirstBlockSummary.
@Test
public void testFirstBlockSummary() {
NetworkParams params = new NetworkParamsTestnet();
BlockHeader header = BlockHeader.newBuilder().setTarget(BlockchainUtil.targetBigIntegerToBytes(params.getMaxTarget())).setTimestamp(System.currentTimeMillis()).build();
BlockSummary prev_summary;
prev_summary = BlockSummary.newBuilder().build();
System.out.println(prev_summary);
BlockSummary s = BlockchainUtil.getNewSummary(header, prev_summary, params, 1L, 600L, new LinkedList());
Assert.assertNotNull(s.getHeader());
Assert.assertEquals("1024", s.getWorkSum());
Assert.assertEquals(params.getMaxTarget().toString(), s.getTargetAverage());
Assert.assertEquals(params.getBlockTimeTarget(), s.getBlocktimeAverageMs());
}
use of snowblossom.lib.NetworkParams in project snowblossom by snowblossomcoin.
the class SpoonTest method startMrPlow.
protected MrPlow startMrPlow(List<Integer> node_ports, AddressSpecHash pool_addr, String network) throws Exception {
NetworkParams params = NetworkParams.loadFromName(network);
String plow_db_path = test_folder.newFolder().getPath();
Map<String, String> config_map = new TreeMap<>();
StringBuilder uris = new StringBuilder();
boolean first = true;
for (int port : node_ports) {
if (!first)
uris.append(",");
uris.append("grpc://localhost:" + port + "/");
first = false;
}
config_map.put("node_uri", uris.toString());
config_map.put("db_type", "rocksdb");
config_map.put("db_type", "atomic_file");
config_map.put("db_path", plow_db_path + "/plowdb");
config_map.put("pool_fee", "0.01");
config_map.put("pool_address", pool_addr.toAddressString(params));
config_map.put("mining_pool_port", "0");
config_map.put("tls_mining_pool_port", "0");
config_map.put("tls_key_path", plow_db_path + "/plow_tls");
config_map.put("network", network);
config_map.put("min_diff", "11");
return new MrPlow(new ConfigMem(config_map));
}
use of snowblossom.lib.NetworkParams in project snowblossom by snowblossomcoin.
the class SpoonTest method startPoolMiner.
protected PoolMiner startPoolMiner(int port, AddressSpecHash mine_to, File snow_path, String network) throws Exception {
NetworkParams params = NetworkParams.loadFromName(network);
String addr = mine_to.toAddressString(params);
System.out.println("Starting miner with " + addr);
Map<String, String> config_map = new TreeMap<>();
config_map.put("pool_host", "localhost");
config_map.put("pool_port", "" + port);
config_map.put("threads", "1");
config_map.put("mine_to_address", addr);
config_map.put("snow_path", snow_path.getPath());
config_map.put("network", network);
config_map.put("rate_limit", "10000.0");
if (port % 2 == 1) {
config_map.put("memfield", "true");
}
return new PoolMiner(new ConfigMem(config_map));
}
use of snowblossom.lib.NetworkParams in project snowblossom by snowblossomcoin.
the class SpoonTest method startMiner.
protected SnowBlossomMiner startMiner(int port, AddressSpecHash mine_to, File snow_path, String network) throws Exception {
Map<String, String> config_map = new TreeMap<>();
config_map.put("node_host", "localhost");
config_map.put("node_port", "" + port);
config_map.put("threads", "1");
config_map.put("snow_path", snow_path.getPath());
config_map.put("network", network);
NetworkParams params = NetworkParams.loadFromConfig(new ConfigMem(config_map));
config_map.put("mine_to_address", mine_to.toAddressString(params));
config_map.put("rate_limit", "10000.0");
if (port % 2 == 1) {
config_map.put("memfield", "true");
}
return new SnowBlossomMiner(new ConfigMem(config_map));
}
use of snowblossom.lib.NetworkParams in project snowblossom by snowblossomcoin.
the class SpoonTest method startPoolMinerUri.
protected PoolMiner startPoolMinerUri(String uri, AddressSpecHash mine_to, File snow_path, String network) throws Exception {
NetworkParams params = NetworkParams.loadFromName(network);
String addr = mine_to.toAddressString(params);
System.out.println("Starting miner with " + addr);
Map<String, String> config_map = new TreeMap<>();
config_map.put("pool_uri", uri);
config_map.put("threads", "1");
config_map.put("mine_to_address", addr);
config_map.put("snow_path", snow_path.getPath());
config_map.put("network", network);
config_map.put("rate_limit", "10000.0");
return new PoolMiner(new ConfigMem(config_map));
}
Aggregations