use of org.aion.zero.types.AionTransaction in project aion by aionnetwork.
the class PendingTxCacheTest method maxPendingSizeTest4.
@Test
public void maxPendingSizeTest4() {
PendingTxCache cache = new PendingTxCache(1);
List<AionTransaction> txn = getMockTransaction(0, 659, 0);
List<AionTransaction> newCache = new ArrayList<>();
for (AionTransaction tx : txn) {
newCache.add(cache.addCacheTx(tx).get(0));
}
assertTrue(newCache.size() == 659);
AionTransaction tx = getMockBigTransaction(50, 1, 0, 2000).get(0);
newCache = cache.addCacheTx(tx);
assertTrue(newCache.size() == 652);
Map<BigInteger, AionTransaction> cacheMap = cache.geCacheTx(Address.wrap(key.get(0).getAddress()));
assertTrue(cacheMap.size() == 652);
}
use of org.aion.zero.types.AionTransaction 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.zero.types.AionTransaction 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.zero.types.AionTransaction 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.zero.types.AionTransaction 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