use of org.aion.zero.types.AionTransaction in project aion by aionnetwork.
the class PendingTxCacheTest method addCacheTxTest.
@Test
public void addCacheTxTest() {
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() == txn.size());
}
use of org.aion.zero.types.AionTransaction in project aion by aionnetwork.
the class PendingTxCacheTest method addCacheTxTest3.
@Test
public void addCacheTxTest3() {
PendingTxCache cache = new PendingTxCache(1000);
List<AionTransaction> txn = new ArrayList<>();
for (int i = 0; i < key.size(); i++) {
txn.add(getMockTransaction(0, 1, i).get(0));
}
for (AionTransaction tx : txn) {
cache.addCacheTx(tx);
}
assertTrue(cache.getCacheTxAccount().size() == key.size() - 1);
}
use of org.aion.zero.types.AionTransaction in project aion by aionnetwork.
the class PendingTxCacheTest method maxPendingSizeTest6.
@Test
public void maxPendingSizeTest6() {
PendingTxCache cache = new PendingTxCache(1);
List<AionTransaction> txn = getMockTransaction(0, 100, 0);
txn.addAll(getMockTransaction(101, 600, 0));
List<AionTransaction> newCache = new ArrayList<>();
for (AionTransaction tx : txn) {
newCache.add(cache.addCacheTx(tx).get(0));
}
assertTrue(newCache.size() == 700);
Map<BigInteger, AionTransaction> cacheMap = cache.geCacheTx(Address.wrap(key.get(0).getAddress()));
assertTrue(cacheMap.size() == 659);
AionTransaction tx = getMockBigTransaction(100, 1, 0, 199_500).get(0);
newCache = cache.addCacheTx(tx);
assertTrue(newCache.size() == 659);
}
use of org.aion.zero.types.AionTransaction in project aion by aionnetwork.
the class PendingTxCacheTest method maxPendingSizeTest5.
@Test
public void maxPendingSizeTest5() {
PendingTxCache cache = new PendingTxCache(1);
List<AionTransaction> txn = getMockTransaction(0, 100, 0);
txn.addAll(getMockTransaction(101, 600, 0));
List<AionTransaction> newCache = new ArrayList<>();
for (AionTransaction tx : txn) {
newCache.add(cache.addCacheTx(tx).get(0));
}
assertTrue(newCache.size() == 700);
Map<BigInteger, AionTransaction> cacheMap = cache.geCacheTx(Address.wrap(key.get(0).getAddress()));
assertTrue(cacheMap.size() == 659);
AionTransaction tx = getMockBigTransaction(100, 1, 0, 2000).get(0);
newCache = cache.addCacheTx(tx);
assertTrue(newCache.size() == 652);
}
use of org.aion.zero.types.AionTransaction in project aion by aionnetwork.
the class ApiAion method doCall.
public byte[] doCall(ArgTxCall _params) {
AionTransaction tx = new AionTransaction(_params.getNonce().toByteArray(), _params.getTo(), _params.getValue().toByteArray(), _params.getData(), _params.getNrg(), _params.getNrgPrice());
AionTxReceipt rec = this.ac.callConstant(tx, this.ac.getAionHub().getBlockchain().getBestBlock());
return rec.getExecutionResult();
}
Aggregations