public IActionResult Status() { // Output has been merged with RPC's GetInfo() since they provided similar functionality. var model = new StatusModel { Version = this.fullNode.Version?.ToString() ?? "0", ProtocolVersion = (uint)(this.nodeSettings.ProtocolVersion), Difficulty = GetNetworkDifficulty(this.networkDifficulty)?.Difficulty ?? 0, Agent = this.connectionManager.ConnectionSettings.Agent, ProcessId = Process.GetCurrentProcess().Id, Network = this.fullNode.Network.Name, ConsensusHeight = this.chainState.ConsensusTip?.Height, DataDirectoryPath = this.nodeSettings.DataDir, Testnet = this.network.IsTest(), RelayFee = this.nodeSettings.MinRelayTxFeeRate?.FeePerK?.ToUnit(MoneyUnit.AtomicUnit) ?? 0, RunningTime = this.dateTimeProvider.GetUtcNow() - this.fullNode.StartTime, CoinTicker = this.network.CoinTicker, State = this.fullNode.State.ToString() }; // Add the list of features that are enabled. foreach (IFullNodeFeature feature in this.fullNode.Services.Features) { model.EnabledFeatures.Add(feature.GetType().ToString()); } // Include BlockStore Height if enabled if (this.chainState.BlockStoreTip != null) { model.BlockStoreHeight = this.chainState.BlockStoreTip.Height; } // Add the details of connected nodes. foreach (INetworkPeer peer in this.connectionManager.ConnectedPeers) { var connectionManagerBehavior = peer.Behavior <IConnectionManagerBehavior>(); var chainHeadersBehavior = peer.Behavior <ConsensusManagerBehavior>(); var connectedPeer = new ConnectedPeerModel { Version = peer.PeerVersion != null ? peer.PeerVersion.UserAgent : "[Unknown]", RemoteSocketEndpoint = peer.RemoteSocketEndpoint.ToString(), TipHeight = chainHeadersBehavior.BestReceivedTip != null ? chainHeadersBehavior.BestReceivedTip.Height : peer.PeerVersion?.StartHeight ?? -1, IsInbound = peer.Inbound }; if (connectedPeer.IsInbound) { model.InboundPeers.Add(connectedPeer); } else { model.OutboundPeers.Add(connectedPeer); } } return(this.Json(model)); }
public IActionResult Status() { StatusModel model = new StatusModel { Version = this.fullNode.Version?.ToString() ?? "0", Agent = this.nodeSettings.Agent, ProcessId = Process.GetCurrentProcess().Id, Network = this.fullNode.Network.Name, ConsensusHeight = this.chainState.ConsensusTip.Height, DataDirectoryPath = this.nodeSettings.DataDir, RunningTime = this.dateTimeProvider.GetUtcNow() - this.fullNode.StartTime }; // Add the list of features that are enabled. foreach (IFullNodeFeature feature in this.fullNode.Services.Features) { model.EnabledFeatures.Add(feature.GetType().ToString()); } // Include BlockStore Height if enabled if (this.chainState.BlockStoreTip != null) { model.BlockStoreHeight = this.chainState.BlockStoreTip.Height; } // Add the details of connected nodes. foreach (INetworkPeer peer in this.connectionManager.ConnectedPeers) { ConnectionManagerBehavior connectionManagerBehavior = peer.Behavior <ConnectionManagerBehavior>(); ChainHeadersBehavior chainHeadersBehavior = peer.Behavior <ChainHeadersBehavior>(); ConnectedPeerModel connectedPeer = new ConnectedPeerModel { Version = peer.PeerVersion != null ? peer.PeerVersion.UserAgent : "[Unknown]", RemoteSocketEndpoint = peer.RemoteSocketEndpoint.ToString(), TipHeight = chainHeadersBehavior.PendingTip != null ? chainHeadersBehavior.PendingTip.Height : peer.PeerVersion?.StartHeight ?? -1, IsInbound = connectionManagerBehavior.Inbound }; if (connectedPeer.IsInbound) { model.InboundPeers.Add(connectedPeer); } else { model.OutboundPeers.Add(connectedPeer); } } return(this.Json(model)); }
private async void SendButton_OnClick(object sender, RoutedEventArgs e) { ConnectedPeerModel.AddMessage(ServerName, MessageTextBox.Text); await ConnectedPeerModel.Peer.IpcMessageWriter.WriteMessageAsync(MessageTextBox.Text, "CharPage").ConfigureAwait(false); }
public IActionResult Status([FromQuery] bool publish) { // Output has been merged with RPC's GetInfo() since they provided similar functionality. var model = new StatusModel { Version = this.fullNode.Version?.ToString() ?? "0", ProtocolVersion = (uint)(this.nodeSettings.ProtocolVersion), Difficulty = GetNetworkDifficulty(this.networkDifficulty)?.Difficulty ?? 0, Agent = this.connectionManager.ConnectionSettings.Agent, ExternalAddress = this.selfEndpointTracker.MyExternalAddress.Address.ToString(), ProcessId = Process.GetCurrentProcess().Id, Network = this.fullNode.Network.Name, ConsensusHeight = this.chainState.ConsensusTip?.Height, DataDirectoryPath = this.nodeSettings.DataDir, Testnet = this.network.IsTest(), RelayFee = this.nodeSettings.MinRelayTxFeeRate?.FeePerK?.ToUnit(MoneyUnit.BTC) ?? 0, RunningTime = this.dateTimeProvider.GetUtcNow() - this.fullNode.StartTime, CoinTicker = this.network.CoinTicker, State = this.fullNode.State.ToString(), BestPeerHeight = this.chainState.BestPeerTip?.Height, InIbd = this.initialBlockDownloadState.IsInitialBlockDownload() }; try { model.HeaderHeight = this.consensusManager.HeaderTip; } catch (Exception) { // It is possible that consensus manager has not yet initialized when calling this. model.HeaderHeight = 0; } if (publish) { this.signals.Publish(new FullNodeEvent() { Message = "Full State Requested", State = this.fullNode.State.ToString() }); } // Add the list of features that are enabled. foreach (IFullNodeFeature feature in this.fullNode.Services.Features) { model.FeaturesData.Add(new FeatureData { Namespace = feature.GetType().ToString(), State = feature.State.ToString() }); } // Include BlockStore Height if enabled if (this.chainState.BlockStoreTip != null) { model.BlockStoreHeight = this.chainState.BlockStoreTip.Height; } // Add the details of connected nodes. foreach (INetworkPeer peer in this.connectionManager.ConnectedPeers) { ConsensusManagerBehavior chainHeadersBehavior = peer.Behavior <ConsensusManagerBehavior>(); var connectedPeer = new ConnectedPeerModel { Version = peer.PeerVersion != null ? peer.PeerVersion.UserAgent : "[Unknown]", RemoteSocketEndpoint = peer.RemoteSocketEndpoint.ToString(), TipHeight = chainHeadersBehavior.BestReceivedTip != null ? chainHeadersBehavior.BestReceivedTip.Height : peer.PeerVersion?.StartHeight ?? -1, IsInbound = peer.Inbound }; if (connectedPeer.IsInbound) { model.InboundPeers.Add(connectedPeer); } else { model.OutboundPeers.Add(connectedPeer); } } return(this.Json(model)); }