use of snowblossom.lib.SnowMerkle in project snowblossom by snowblossomcoin.
the class SpoonTest method setupSnow.
protected File setupSnow(String network) throws Exception {
TreeMap<String, String> config_map = new TreeMap<>();
config_map.put("network", network);
NetworkParams params = NetworkParams.loadFromConfig(new ConfigMem(config_map));
String test_folder_base = test_folder.newFolder().getPath();
File snow_path = new File(test_folder.newFolder(), "snow");
for (int i = 0; i < 4; i++) {
SnowFieldInfo info = params.getSnowFieldInfo(i);
String name = network + "." + i;
File field_path = new File(snow_path, name);
field_path.mkdirs();
File field = new File(field_path, name + ".snow");
new SnowFall(field.getPath(), name, info.getLength());
ByteString root_hash = new SnowMerkle(field_path, name, true).getRootHash();
Assert.assertEquals(info.getMerkleRootHash(), root_hash);
}
return snow_path;
}
Aggregations