@Test public void testAddMultipleTimes(){ TransactionsPool transactionsPool = new TransactionsPool(); TestCase.assertTrue(transactionsPool.addTransaction("aaaa")); TestCase.assertFalse(transactionsPool.addTransaction("aaaa")); }
public boolean addTransaction(String transactionHash) { Util.check(transactionHash != null, "transaction != null"); synchronized (locker) { if (!checkExistsNoLock(transactionHash)) { transactions.add(transactionHash); logger.trace("Added {}", transactionHash); return (true); } else { logger.debug("Transaction {} already in pool/processed!", transactionHash); return (false); } } }
TransactionsPool { public boolean addTransaction(String transactionHash) { Util.check(transactionHash != null, "transaction != null"); synchronized (locker) { if (!checkExistsNoLock(transactionHash)) { transactions.add(transactionHash); logger.trace("Added {}", transactionHash); return (true); } else { logger.debug("Transaction {} already in pool/processed!", transactionHash); return (false); } } } }
TransactionsPool { public boolean addTransaction(String transactionHash) { Util.check(transactionHash != null, "transaction != null"); synchronized (locker) { if (!checkExistsNoLock(transactionHash)) { transactions.add(transactionHash); logger.trace("Added {}", transactionHash); return (true); } else { logger.debug("Transaction {} already in pool/processed!", transactionHash); return (false); } } }  }
TransactionsPool { public boolean addTransaction(String transactionHash) { Util.check(transactionHash != null, "transaction != null"); synchronized (locker) { if (!checkExistsNoLock(transactionHash)) { transactions.add(transactionHash); logger.trace("Added {}", transactionHash); return (true); } else { logger.debug("Transaction {} already in pool/processed!", transactionHash); return (false); } } }  List<String> getTransactions(); boolean addTransaction(String transactionHash); boolean checkExists(String transactionHash); void addBlock(Block block); }
TransactionsPool { public boolean addTransaction(String transactionHash) { Util.check(transactionHash != null, "transaction != null"); synchronized (locker) { if (!checkExistsNoLock(transactionHash)) { transactions.add(transactionHash); logger.trace("Added {}", transactionHash); return (true); } else { logger.debug("Transaction {} already in pool/processed!", transactionHash); return (false); } } }  List<String> getTransactions(); boolean addTransaction(String transactionHash); boolean checkExists(String transactionHash); void addBlock(Block block);  }