List <ACSItem> GetActiveContracts() { using (var dbTx = _DBContext.GetTransactionContext()) { return(ActiveContractSet.All(dbTx).Select(t => t.Item2).ToList()); } }
void UpdateMempool(TransactionContext dbTx, HashDictionary <TransactionValidation.PointedTransaction> confirmedTxs, HashDictionary <Types.Transaction> unconfirmedTxs) { lock (memPool) { dbTx.Commit(); var activeContracts = new HashSet(); foreach (var item in ActiveContractSet.All(dbTx)) { activeContracts.Add(item.Item1); } foreach (var item in memPool.ContractPool) { activeContracts.Add(item.Key); } RemoveConfirmedTxsFromMempool(confirmedTxs); MakeOrphan(dbTx); memPool.TxPool.MoveToICTxPool(activeContracts); RemoveInvalidAutoTxs(dbTx); foreach (var t in unconfirmedTxs) { new HandleTransactionAction { Tx = t.Value, CheckInDb = false }.Publish(); } memPool.ICTxPool.Where(t => { byte[] contractHash; IsContractGeneratedTx(t.Value, out contractHash); return(activeContracts.Contains(contractHash)); }) .ToList().ForEach(t => { memPool.ICTxPool.Remove(t.Key); new HandleTransactionAction { Tx = TransactionValidation.unpoint(t.Value), CheckInDb = false }.Publish(); }); } }