Search in sources :

Example 6 with ConfigMem

use of duckutil.ConfigMem 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));
}
Also used : PoolMiner(snowblossom.miner.PoolMiner) NetworkParams(snowblossom.lib.NetworkParams) ByteString(com.google.protobuf.ByteString) ConfigMem(duckutil.ConfigMem)

Example 7 with ConfigMem

use of duckutil.ConfigMem 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));
}
Also used : SnowBlossomMiner(snowblossom.miner.SnowBlossomMiner) NetworkParams(snowblossom.lib.NetworkParams) ByteString(com.google.protobuf.ByteString) ConfigMem(duckutil.ConfigMem)

Example 8 with ConfigMem

use of duckutil.ConfigMem 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));
}
Also used : PoolMiner(snowblossom.miner.PoolMiner) NetworkParams(snowblossom.lib.NetworkParams) ByteString(com.google.protobuf.ByteString) ConfigMem(duckutil.ConfigMem)

Example 9 with ConfigMem

use of duckutil.ConfigMem in project snowblossom by snowblossomcoin.

the class WalletTest method testWalletSerialize.

@Test
public void testWalletSerialize() throws Exception {
    ConfigMem config = new ConfigMem(ImmutableMap.of());
    WalletDatabase.Builder builder = WalletDatabase.newBuilder();
    WalletUtil.genNewKey(WalletDatabase.newBuilder().build(), builder, config, new NetworkParamsRegtest());
    WalletDatabase a = builder.build();
    ByteString str = a.toByteString();
    WalletDatabase b = WalletDatabase.parseFrom(str);
    Assert.assertEquals(a, b);
}
Also used : NetworkParamsRegtest(snowblossom.lib.NetworkParamsRegtest) ByteString(com.google.protobuf.ByteString) ConfigMem(duckutil.ConfigMem) Test(org.junit.Test)

Example 10 with ConfigMem

use of duckutil.ConfigMem in project snowblossom by snowblossomcoin.

the class NodePanel method startNode.

private void startNode() throws Exception {
    // There are too many side effects to try this more than once
    start_attempt = true;
    TreeMap<String, String> config_map = new TreeMap();
    config_map.put("network", ice_leaf.getParams().getNetworkName());
    config_map.put("service_port", ice_leaf_prefs.get("node_service_port", null));
    config_map.put("tls_service_port", ice_leaf_prefs.get("node_tls_service_port", null));
    config_map.put("db_path", ice_leaf_prefs.get("node_db_path", null));
    config_map.put("db_type", "rocksdb");
    config_map.put("tls_key_path", ice_leaf_prefs.get("node_tls_key_path", null));
    config_map.put("tx_index", "" + ice_leaf_prefs.getBoolean("node_tx_index", true));
    config_map.put("addr_index", "" + ice_leaf_prefs.getBoolean("node_addr_index", true));
    setMessageBox(config_map.toString());
    ConfigMem config = new ConfigMem(config_map);
    node = new SnowBlossomNode(config, ImmutableList.of(new StatusLogger(), this));
    setStatusBox("Node started");
    setMessageBox("");
}
Also used : StatusLogger(snowblossom.node.StatusLogger) SnowBlossomNode(snowblossom.node.SnowBlossomNode) TreeMap(java.util.TreeMap) ConfigMem(duckutil.ConfigMem)

Aggregations

ConfigMem (duckutil.ConfigMem)18 ByteString (com.google.protobuf.ByteString)12 TreeMap (java.util.TreeMap)8 File (java.io.File)6 Test (org.junit.Test)5 NetworkParams (snowblossom.lib.NetworkParams)5 Purse (snowblossom.client.Purse)3 SnowBlossomClient (snowblossom.client.SnowBlossomClient)3 Config (duckutil.Config)2 TaskMaster (duckutil.TaskMaster)2 HashSet (java.util.HashSet)2 Callable (java.util.concurrent.Callable)2 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)2 NetworkParamsRegtest (snowblossom.lib.NetworkParamsRegtest)2 PoolMiner (snowblossom.miner.PoolMiner)2 SnowBlossomNode (snowblossom.node.SnowBlossomNode)2 AtomicFileOutputStream (duckutil.AtomicFileOutputStream)1 ConfigCat (duckutil.ConfigCat)1 ConfigFile (duckutil.ConfigFile)1 FileOutputStream (java.io.FileOutputStream)1