Search in sources :

Example 11 with TransactionViewModel

use of com.iota.iri.controllers.TransactionViewModel in project iri by iotaledger.

the class BundleValidatorTest method validate.

@Test
public void validate() throws Exception {
    String[] trytes = { "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999SQYSGYNQDUEMYK9RSEJXLBSGWBSEVIMZWQPHLMPKBAIJCTAEPDYLLRTESZSW9FMQYNSGQZKRKCXGNUWDOA99999999999999999999999999999999999999999999999999999RMADHWD99999999999D99999999GIXTMJIGESMVEKQNM9JOEUNO9CRQVIRTRVXOBV9ODB9MUAHOVAONAFHZLIQLWTQWTZUYGPEAORENMU9CBOFPLCLN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THO9DVGIIWWUNRHAOLHTY9ZXMYWTAVGIACISUAWMDBRISSUBGYIW9PPJMUJTXMSIHM9CCSWXAABTQRYSSOZHWDRJDXFQMBXTFHJMGTPJHZYYAWTB9CFNQNEHDJVIQDLXYEDILOTZK9G9HVNYKKFBVSHCWUMBOZZOL9ER9HJUMGSGZPOFEE9LXRQWBJQNVZTDUPVANILWHUVDKZYGTIKMJQQFXDNAIYWWEJHGBCPAMCOCPKGTEAAVBJUJFLQUNHKPVED9TDBOQKGLHUUGVSMZBSVGGFXBFBNCPKVJLTLPVFBXRGDFVPEGUWELMHHMXKNT9HIFOIHM9JQWNWKKBZTULZYBQPBJKEXJXVGWCYMZESZP9BSMR9RVP999999999999999999999999999999999999999999999999999999RMADHWD99C99999999D99999999GIXTMJIGESMVEKQNM9JOEUNO9CRQVIRTRVXOBV9ODB9MUAHOVAONAFHZLIQLWTQWTZUYGPEAORENMU9CBLBKHIWPHSOQRNKCRNEBRWRFVPPSQHENFAPJKLMWZOTVWXDDALUMLVCOXTWEEL9PRYD9CMVTUULUCC9999IHAVDVHYJDKRYAOTUYNJCSNERFHACSDTCQIO9IPWSUGQN9DAVNJRUNLMZSRRFLUFLTRSGYVJLKOCW9999LAAIEDNOAODKHWVDSHBPTASMYDJUIXNIHROGKQOKUYEGEDSGXPBKCLPVHKGSGRGXKZGQKTRCMMNWZODSX", "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999XXIOBS9NSVFA9AUBBOLXBNXNEXIEYAXVXITMWRGUCJNSMPGDZNCZUVAKPG9NNWLKLQJIINXLD9HVEBPVWC99999999999999999999999999999999999999999999999999999VMADHWD99D99999999D99999999GIXTMJIGESMVEKQNM9JOEUNO9CRQVIRTRVXOBV9ODB9MUAHOVAONAFHZLIQLWTQWTZUYGPEAORENMU9CBIHAVDVHYJDKRYAOTUYNJCSNERFHACSDTCQIO9IPWSUGQN9DAVNJRUNLMZSRRFLUFLTRSGYVJLKOCW9999MYZPDMYYXPQGOANGLNMWZPAD9WNKKASTLDROFMAEZHXDTMTDCPSGTVMUMSXPEWIWLXMIUQTOAEMRX9999YSXGJFBLETJTPG9LTUJPPZYCSORFLSFUXVREBLQ9XAASFHSXGFKRPGQLIVOJRDFECSDJPEWQUKTXKWGDD" };
    List<TransactionViewModel> transactions = Arrays.stream(trytes).map(Converter::allocatingTritsFromTrytes).map(t -> new TransactionViewModel(t, Hash.calculate(SpongeFactory.Mode.CURLP81, t))).map(t -> {
        try {
            t.store(tangle);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return t;
    }).collect(Collectors.toList());
// Assert.assertTrue(BundleValidator.validate(tangle,transactions.get(0).getBundleHash()).get(0).size() == transactions.size());
}
Also used : AfterClass(org.junit.AfterClass) Arrays(java.util.Arrays) Tangle(com.iota.iri.storage.Tangle) BeforeClass(org.junit.BeforeClass) RocksDBPersistenceProvider(com.iota.iri.storage.rocksDB.RocksDBPersistenceProvider) Test(org.junit.Test) Hash(com.iota.iri.model.Hash) Collectors(java.util.stream.Collectors) List(java.util.List) SpongeFactory(com.iota.iri.hash.SpongeFactory) Converter(com.iota.iri.utils.Converter) TransactionViewModel(com.iota.iri.controllers.TransactionViewModel) TemporaryFolder(org.junit.rules.TemporaryFolder) TransactionViewModel(com.iota.iri.controllers.TransactionViewModel) Test(org.junit.Test)

Example 12 with TransactionViewModel

use of com.iota.iri.controllers.TransactionViewModel in project iri by iotaledger.

the class TipsManagerTest method updateLinearRatingsTestWorks.

@Test
public void updateLinearRatingsTestWorks() throws Exception {
    TransactionViewModel transaction, transaction1, transaction2;
    transaction = new TransactionViewModel(getRandomTransactionTrits(), getRandomTransactionHash());
    transaction1 = new TransactionViewModel(getRandomTransactionWithTrunkAndBranch(transaction.getHash(), transaction.getHash()), getRandomTransactionHash());
    transaction2 = new TransactionViewModel(getRandomTransactionWithTrunkAndBranch(transaction1.getHash(), transaction1.getHash()), getRandomTransactionHash());
    transaction.store(tangle);
    transaction1.store(tangle);
    transaction2.store(tangle);
    Map<Hash, Set<Hash>> ratings = new HashMap<>();
    tipsManager.updateHashRatings(transaction.getHash(), ratings, new HashSet<>());
    Assert.assertEquals(ratings.get(transaction.getHash()).size(), 3);
    Assert.assertEquals(ratings.get(transaction1.getHash()).size(), 2);
    Assert.assertEquals(ratings.get(transaction2.getHash()).size(), 1);
}
Also used : TransactionViewModel(com.iota.iri.controllers.TransactionViewModel) Hash(com.iota.iri.model.Hash) TransactionViewModelTest.getRandomTransactionHash(com.iota.iri.controllers.TransactionViewModelTest.getRandomTransactionHash) Test(org.junit.Test)

Example 13 with TransactionViewModel

use of com.iota.iri.controllers.TransactionViewModel in project iri by iotaledger.

the class TipsManagerTest method updateRatingsSerialWorks2.

@Test
public void updateRatingsSerialWorks2() throws Exception {
    Hash[] hashes = new Hash[5];
    hashes[0] = getRandomTransactionHash();
    new TransactionViewModel(getRandomTransactionTrits(), hashes[0]).store(tangle);
    for (int i = 1; i < hashes.length; i++) {
        hashes[i] = getRandomTransactionHash();
        new TransactionViewModel(getRandomTransactionWithTrunkAndBranch(hashes[i - 1], hashes[i - (i > 1 ? 2 : 1)]), hashes[i]).store(tangle);
    }
    Map<Hash, Long> ratings = new HashMap<>();
    tipsManager.recursiveUpdateRatings(hashes[0], ratings, new HashSet<>());
    Assert.assertTrue(ratings.get(hashes[0]).equals(12L));
}
Also used : TransactionViewModel(com.iota.iri.controllers.TransactionViewModel) Hash(com.iota.iri.model.Hash) TransactionViewModelTest.getRandomTransactionHash(com.iota.iri.controllers.TransactionViewModelTest.getRandomTransactionHash) Test(org.junit.Test)

Example 14 with TransactionViewModel

use of com.iota.iri.controllers.TransactionViewModel in project iri by iotaledger.

the class TipsManagerTest method ratingTime.

public long ratingTime(int size) throws Exception {
    Hash[] hashes = new Hash[size];
    hashes[0] = getRandomTransactionHash();
    new TransactionViewModel(getRandomTransactionTrits(), hashes[0]).store(tangle);
    Random random = new Random();
    for (int i = 1; i < hashes.length; i++) {
        hashes[i] = getRandomTransactionHash();
        new TransactionViewModel(getRandomTransactionWithTrunkAndBranch(hashes[i - random.nextInt(i) - 1], hashes[i - random.nextInt(i) - 1]), hashes[i]).store(tangle);
    }
    Map<Hash, Long> ratings = new HashMap<>();
    long start = System.currentTimeMillis();
    tipsManager.serialUpdateRatings(new HashSet<>(), hashes[0], ratings, new HashSet<>(), null);
    return System.currentTimeMillis() - start;
}
Also used : TransactionViewModel(com.iota.iri.controllers.TransactionViewModel) Hash(com.iota.iri.model.Hash) TransactionViewModelTest.getRandomTransactionHash(com.iota.iri.controllers.TransactionViewModelTest.getRandomTransactionHash)

Example 15 with TransactionViewModel

use of com.iota.iri.controllers.TransactionViewModel in project iri by iotaledger.

the class TipsManagerTest method updateRatingsSerialWorks.

@Test
public void updateRatingsSerialWorks() throws Exception {
    Hash[] hashes = new Hash[5];
    hashes[0] = getRandomTransactionHash();
    new TransactionViewModel(getRandomTransactionTrits(), hashes[0]).store(tangle);
    for (int i = 1; i < hashes.length; i++) {
        hashes[i] = getRandomTransactionHash();
        new TransactionViewModel(getRandomTransactionWithTrunkAndBranch(hashes[i - 1], hashes[i - 1]), hashes[i]).store(tangle);
    }
    Map<Hash, Long> ratings = new HashMap<>();
    tipsManager.recursiveUpdateRatings(hashes[0], ratings, new HashSet<>());
    Assert.assertTrue(ratings.get(hashes[0]).equals(5L));
}
Also used : TransactionViewModel(com.iota.iri.controllers.TransactionViewModel) Hash(com.iota.iri.model.Hash) TransactionViewModelTest.getRandomTransactionHash(com.iota.iri.controllers.TransactionViewModelTest.getRandomTransactionHash) Test(org.junit.Test)

Aggregations

TransactionViewModel (com.iota.iri.controllers.TransactionViewModel)23 Hash (com.iota.iri.model.Hash)14 Test (org.junit.Test)11 TransactionViewModelTest.getRandomTransactionHash (com.iota.iri.controllers.TransactionViewModelTest.getRandomTransactionHash)6 SpongeFactory (com.iota.iri.hash.SpongeFactory)3 Tangle (com.iota.iri.storage.Tangle)3 RocksDBPersistenceProvider (com.iota.iri.storage.rocksDB.RocksDBPersistenceProvider)3 Converter (com.iota.iri.utils.Converter)3 Arrays (java.util.Arrays)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 AfterClass (org.junit.AfterClass)3 BeforeClass (org.junit.BeforeClass)3 TemporaryFolder (org.junit.rules.TemporaryFolder)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 TransactionValidator (com.iota.iri.TransactionValidator)1 Transaction (com.iota.iri.model.Transaction)1 ByteBuffer (java.nio.ByteBuffer)1 MessageDigest (java.security.MessageDigest)1