public void Restore() { var txHashes = _poolRepository.GetTransactionPool(); Logger.LogTrace($"restoring transactions from pool to in-memory storage"); // transactionsToRemove stores all the transactions that was not added to // the in-memory pool from persistent storage List <UInt256> transactionsToRemove = new List <UInt256>(); foreach (var txHash in txHashes) { Logger.LogTrace($"Tx from pool: {txHash.ToHex()}"); var tx = _poolRepository.GetTransactionByHash(txHash); if (tx is null) { continue; } if (Add(tx, false) != OperatingError.Ok) { transactionsToRemove.Add(tx.Hash); } } // if a transaction was not added to the pool, that means it's not a valid // transactions, so we should also erase it from the persistent storage _poolRepository.RemoveTransactions(transactionsToRemove); _lastSanitized = _blockManager.GetHeight(); CheckConsistency(); }