public SQLiteBannedNames(NodeConfig config) { sqliteConnection = new SQLiteConnection("Data Source=" + config.Path_BannedNamesDB + ";Version=3;"); sqliteConnection.Open(); VerifyTables(); }
public SecureNetwork(NodeConfig nodeConfig, NodeState nodeState) { this.nodeConfig = nodeConfig; this.nodeState = nodeState; messageTypePairs = new NetworkMessagePairs(); }
public SQLiteAccountStore(NodeConfig config) { sqliteConnection = new SQLiteConnection("Data Source=" + config.Path_AccountDB + ";Version=3;"); sqliteConnection.Open(); VerifyTables(); }
public SQLiteCloseHistory(NodeConfig config) { sqliteConnection = new SQLiteConnection("Data Source=" + config.Path_CloseHistoryDB + ";Version=3;"); sqliteConnection.Open(); VerifyTables(); }
public TimeSync(NodeState nodeState, NodeConfig nodeConfig, NetworkPacketSwitch networkPacketSwitch) { this.nodeState = nodeState; this.nodeConfig = nodeConfig; this.networkPacketSwitch = networkPacketSwitch; networkPacketSwitch.TimeSyncEvent += networkHandler_TimeSyncEvent; collectedResponses = new ConcurrentDictionary<Hash, ResponseStruct>(); }
public OutgoingConnection(NodeSocketData nodeSocketData, NodeConfig nodeConfig) { this.nodeConfig = nodeConfig; this.nodeSocketData = nodeSocketData; updateTimer = new Timer(TimerCallback, null, 0, Constants.Network_UpdateFrequencyMS); Connect(); }
public PeerData(NodeSocketData socketInfo, NodeState nodeState, NodeConfig nodeConfig) { this.IP = socketInfo.IP; this.ListenPort = socketInfo.ListenPort; this.PubKey = socketInfo.PublicKey; this.Name = socketInfo.Name; TimeStamp = nodeState.NetworkTime; Signature = new Hash(nodeConfig.SignDataWithPrivateKey(signableData())); }
public NetworkPacketSwitch(NodeConfig nodeConfig, NodeState nodeState, GlobalConfiguration globalConfiguration) { this.nodeConfig = nodeConfig; this.nodeState = nodeState; this.globalConfiguration = globalConfiguration; network = new SecureNetwork(nodeConfig, nodeState); network.PacketReceived += network_PacketReceived; network.Initialize(); }
public PeerDiscovery(NodeState nodeState, NodeConfig nodeConfig, NetworkPacketSwitch networkPacketSwitch) { this.nodeState = nodeState; this.nodeConfig = nodeConfig; this.networkPacketSwitch = networkPacketSwitch; requestRecipient = null; requestToken = null; KnownPeers = new ConcurrentDictionary<Hash, PeerData>(); networkPacketSwitch.PeerDiscoveryEvent += networkHandler_PeerDiscoveryEvent; // maybe replace by better rng, but no crypo here anyway rng = new Random(); }
public IncomingTransactionMap(NodeState nodeState, NodeConfig nodeConfig, TransactionStateManager transactionStateManager) { this.nodeState = nodeState; this.nodeConfig = nodeConfig; this.transactionStateManager = transactionStateManager; IncomingTransactions = new ConcurrentDictionary<Hash, TransactionContent>(); System.Timers.Timer Tmr = new System.Timers.Timer(); Tmr.Elapsed += Tmr_Elapsed; Tmr.Enabled = true; Tmr.Interval = nodeConfig.UpdateFrequencyPacketProcessMS; Tmr.Start(); }
public IncomingConnectionHander(int ListenPort, NodeConfig nodeConfig) { this.nodeConfig = nodeConfig; listener = new TcpListener(IPAddress.Any, ListenPort); timer = new Timer(TimerCallback_Housekeeping, null, 0, 2000); //timer_hello = new Timer(TimerCallback_Hello, null, 0, 500); Observable.Interval(TimeSpan.FromMilliseconds(Constants.Network_UpdateFrequencyMS)) .Subscribe(async x => await TimerCallback_Hello(x)); ServicePointManager.DefaultConnectionLimit = 32768; // Start a new thread to accept new incoming connections. StartListening(); }
public NodeState(NodeConfig nodeConfig) { PersistentAccountStore = new SQLiteAccountStore(nodeConfig); PersistentTransactionStore = new SQLiteTransactionStore(nodeConfig); PersistentBannedNameStore = new SQLiteBannedNames(nodeConfig); PersistentCloseHistory = new SQLiteCloseHistory(nodeConfig); Ledger = new Ledger(PersistentAccountStore); TransactionStateManager = new TransactionStateManager(); IncomingTransactionMap = new IncomingTransactionMap(this, nodeConfig, TransactionStateManager); GlobalBlacklistedValidators = new ConcurrentBag<Hash>(); GlobalBlacklistedUsers = new ConcurrentBag<Hash>(); ConnectedValidators = new HashSet<Hash>(); PendingNetworkRequests = new ConcurrentDictionary<Hash, PendingNetworkRequest>(); SystemTime = DateTime.UtcNow.ToFileTimeUtc(); NetworkTime = DateTime.UtcNow.ToFileTimeUtc(); }
public LedgerSync(NodeState nodeState, NodeConfig nodeConfig, NetworkPacketSwitch networkPacketSwitch) { this.nodeState = nodeState; this.nodeConfig = nodeConfig; this.networkPacketSwitch = networkPacketSwitch; this.LedgerTree = nodeState.Ledger.LedgerTree; // Just aliasing. LedgerState = LedgerSyncStateTypes.ST_GOOD; this.networkPacketSwitch.LedgerSyncEvent += networkHandler_LedgerSyncEvent; TimerLedgerSync = new System.Timers.Timer(); if (Enable) TimerLedgerSync.Elapsed += TimerLedgerSync_Elapsed; TimerLedgerSync.Enabled = true; TimerLedgerSync.Interval = nodeConfig.UpdateFrequencyLedgerSyncMS; TimerLedgerSync.Start(); TimerLedgerSync_Root = new System.Timers.Timer(); if (Enable) TimerLedgerSync_Root.Elapsed += TimerLedgerSync_Root_Elapsed; TimerLedgerSync_Root.Enabled = true; TimerLedgerSync_Root.Interval = nodeConfig.UpdateFrequencyLedgerSyncMS_Root; TimerLedgerSync_Root.Start(); }