use of org.aion.txpool.zero.TxPoolA0 in project aion by aionnetwork.
the class TxnPoolTest method addTxWithSameNonce.
@Test
public void addTxWithSameNonce() {
Properties config = new Properties();
config.put("txn-timeout", "10");
ITxPool<ITransaction> tp = new TxPoolA0<>(config);
ITransaction txn = genTransaction(ByteUtils.fromHexString("0000000000000001"));
txn.setNrgConsume(100);
List<ITransaction> txnl = new ArrayList<>();
((AionTransaction) txn).sign(key.get(0));
txnl.add(txn);
((AionTransaction) txn).sign(key.get(0));
txnl.add(txn);
long t = new BigInteger(txn.getTimeStamp()).longValue();
tp.add(txnl);
assertTrue(tp.size() == 1);
List<ITransaction> txl = tp.snapshot();
assertTrue(txl.size() == 1);
assertTrue(new BigInteger(txl.get(0).getTimeStamp()).longValue() == t);
}
Aggregations