Search in sources :

Example 1 with NetworkParamsProd

use of snowblossom.lib.NetworkParamsProd in project snowblossom by snowblossomcoin.

the class IceLeaf method main.

public static void main(String[] args) throws Exception {
    Globals.addCryptoProvider();
    new IceLeaf(new NetworkParamsProd(), null);
}
Also used : NetworkParamsProd(snowblossom.lib.NetworkParamsProd)

Example 2 with NetworkParamsProd

use of snowblossom.lib.NetworkParamsProd in project snowblossom by snowblossomcoin.

the class AddressUtilTest method testAddressConversions.

@Test
public void testAddressConversions() throws ValidationException {
    ArrayList<NetworkParams> plist = new ArrayList<NetworkParams>();
    plist.add(new NetworkParamsProd());
    plist.add(new NetworkParamsTestnet());
    plist.add(new NetworkParamsRegtest());
    byte[] buff = new byte[Globals.ADDRESS_SPEC_HASH_LEN];
    Random rnd = new Random();
    HashSet<String> addresses = new HashSet<>();
    for (int i = 0; i < 1000; i++) {
        if (i > 0) {
            rnd.nextBytes(buff);
        }
        AddressSpecHash spec = new AddressSpecHash(buff);
        for (NetworkParams p : plist) {
            String addr = spec.toAddressString(p);
            Assert.assertFalse(addresses.contains(addr));
            addresses.add(addr);
            System.out.println("Address: " + addr);
            AddressSpecHash dec = new AddressSpecHash(addr, p);
            Assert.assertEquals(spec, dec);
            int colon = addr.indexOf(":");
            String without = addr.substring(colon + 1);
            AddressSpecHash dec2 = new AddressSpecHash(without, p);
            Assert.assertEquals(spec, dec2);
        }
    }
}
Also used : NetworkParamsRegtest(snowblossom.lib.NetworkParamsRegtest) ArrayList(java.util.ArrayList) ByteString(com.google.protobuf.ByteString) NetworkParamsTestnet(snowblossom.lib.NetworkParamsTestnet) Random(java.util.Random) NetworkParams(snowblossom.lib.NetworkParams) NetworkParamsProd(snowblossom.lib.NetworkParamsProd) AddressSpecHash(snowblossom.lib.AddressSpecHash) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 3 with NetworkParamsProd

use of snowblossom.lib.NetworkParamsProd in project snowblossom by snowblossomcoin.

the class PowUtilTest method testReward.

@Test
public void testReward() {
    NetworkParams params = new NetworkParamsProd();
    int n = 4 * 365 * 144;
    long reward = 50000000;
    for (int b = 1; b < 10; b++) {
        Assert.assertEquals(reward, PowUtil.getBlockReward(params, n * b - 1));
        reward /= 2;
        Assert.assertEquals(reward, PowUtil.getBlockReward(params, n * b));
    }
}
Also used : NetworkParams(snowblossom.lib.NetworkParams) NetworkParamsProd(snowblossom.lib.NetworkParamsProd) Test(org.junit.Test)

Aggregations

NetworkParamsProd (snowblossom.lib.NetworkParamsProd)3 Test (org.junit.Test)2 NetworkParams (snowblossom.lib.NetworkParams)2 ByteString (com.google.protobuf.ByteString)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Random (java.util.Random)1 AddressSpecHash (snowblossom.lib.AddressSpecHash)1 NetworkParamsRegtest (snowblossom.lib.NetworkParamsRegtest)1 NetworkParamsTestnet (snowblossom.lib.NetworkParamsTestnet)1