use of org.aion.base.type.ITransaction in project aion by aionnetwork.
the class PendingTxCacheTest method flushTest2.
@Test
public void flushTest2() {
PendingTxCache cache = new PendingTxCache(1);
List<AionTransaction> txn = getMockTransaction(0, 10, 0);
List<AionTransaction> newCache = new ArrayList<>();
for (ITransaction tx : txn) {
newCache.add(cache.addCacheTx((AionTransaction) tx).get(0));
}
assertTrue(newCache.size() == 10);
Map<Address, BigInteger> map = new HashMap<>();
map.put(Address.wrap(key.get(1).getAddress()), BigInteger.TWO);
cache.flush(map);
Map<BigInteger, AionTransaction> cacheMap = cache.geCacheTx(Address.wrap(key.get(0).getAddress()));
assertTrue(cacheMap.size() == 10);
}
use of org.aion.base.type.ITransaction in project aion by aionnetwork.
the class PendingTxCacheTest method maxPendingSizeTest2.
@Test
public void maxPendingSizeTest2() {
PendingTxCache cache = new PendingTxCache(1);
List<AionTransaction> txn = getMockTransaction(0, 659, 0);
List<AionTransaction> newCache = new ArrayList<>();
for (ITransaction tx : txn) {
newCache.add(cache.addCacheTx((AionTransaction) tx).get(0));
}
assertTrue(newCache.size() == 659);
AionTransaction tx = getMockTransaction(50, 1, 0).get(0);
newCache = cache.addCacheTx(tx);
assertTrue(newCache.size() == 659);
Map<BigInteger, AionTransaction> cacheMap = cache.geCacheTx(Address.wrap(key.get(0).getAddress()));
assertTrue(cacheMap.size() == 659);
}
use of org.aion.base.type.ITransaction in project aion by aionnetwork.
the class PendingTxCacheTest method maxPendingSizeTest1.
@Test
public void maxPendingSizeTest1() {
PendingTxCache cache = new PendingTxCache(1);
List<AionTransaction> txn = getMockTransaction(0, 680, 0);
List<AionTransaction> newCache = new ArrayList<>();
for (ITransaction tx : txn) {
newCache.add(cache.addCacheTx((AionTransaction) tx).get(0));
}
Map<BigInteger, AionTransaction> cacheMap = cache.geCacheTx(Address.wrap(key.get(0).getAddress()));
assertTrue(cacheMap.size() == 659);
}
use of org.aion.base.type.ITransaction in project aion by aionnetwork.
the class PendingTxCacheTest method addCacheTxTest2.
@Test
public void addCacheTxTest2() {
PendingTxCache cache = new PendingTxCache(1);
List<AionTransaction> txn = getMockTransaction(0, 10, 0);
txn.addAll(getMockTransaction(0, 10, 1));
List<AionTransaction> newCache = new ArrayList<>();
for (ITransaction tx : txn) {
newCache.add(cache.addCacheTx((AionTransaction) tx).get(0));
}
assertTrue(newCache.size() == txn.size());
}
Aggregations