Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
count: BN,
|};
const NAMESPACE = 'blockchain';
const NEO_BLOCKCHAIN_PERSIST_BLOCK_DURATION_SECONDS = metrics.createHistogram({
name: 'neo_blockchain_persist_block_duration_seconds',
});
const NEO_BLOCKCHAIN_PERSIST_BLOCK_FAILURES_TOTAL = metrics.createCounter({
name: 'neo_blockchain_persist_block_failures_total',
});
const NEO_BLOCKCHAIN_BLOCK_INDEX_GAUGE = metrics.createGauge({
name: 'neo_blockchain_block_index',
help: 'The current block index',
});
const NEO_BLOCKCHAIN_PERSISTING_BLOCK_INDEX_GAUGE = metrics.createGauge({
name: 'neo_blockchain_persisting_block_index',
help: 'The current in progress persist index',
});
const NEO_BLOCKCHAIN_PERSIST_BLOCK_LATENCY_SECONDS = metrics.createHistogram({
name: 'neo_blockchain_persist_block_latency_seconds',
help: 'The latency from block timestamp to persist',
buckets: [1, 2, 5, 7.5, 10, 12.5, 15, 17.5, 20],
});
export default class Blockchain {
_monitor: Monitor;
_blockIndexGauge: Gauge;
_persistingBlockIndexGauge: Gauge;
_persistBlockLatencyHistogram: Histogram;
deserializeWireContext: $PropertyType<
BlockchainType,
|};
type Vote = {|
publicKeys: Array,
count: BN,
|};
const NAMESPACE = 'blockchain';
const NEO_BLOCKCHAIN_PERSIST_BLOCK_DURATION_SECONDS = metrics.createHistogram({
name: 'neo_blockchain_persist_block_duration_seconds',
});
const NEO_BLOCKCHAIN_PERSIST_BLOCK_FAILURES_TOTAL = metrics.createCounter({
name: 'neo_blockchain_persist_block_failures_total',
});
const NEO_BLOCKCHAIN_BLOCK_INDEX_GAUGE = metrics.createGauge({
name: 'neo_blockchain_block_index',
help: 'The current block index',
});
const NEO_BLOCKCHAIN_PERSISTING_BLOCK_INDEX_GAUGE = metrics.createGauge({
name: 'neo_blockchain_persisting_block_index',
help: 'The current in progress persist index',
});
const NEO_BLOCKCHAIN_PERSIST_BLOCK_LATENCY_SECONDS = metrics.createHistogram({
name: 'neo_blockchain_persist_block_latency_seconds',
help: 'The latency from block timestamp to persist',
buckets: [1, 2, 5, 7.5, 10, 12.5, 15, 17.5, 20],
});
export default class Blockchain {
_monitor: Monitor;
_blockIndexGauge: Gauge;
const NEO_NETWORK_PEER_CLOSED_TOTAL = metrics.createCounter({
name: 'neo_network_peer_closed_total',
help:
'Total number of times a peer was closed due to error or ending the socket.',
});
const NEO_NETWORK_PEER_CONNECT_TOTAL = metrics.createCounter({
name: 'neo_network_peer_connect_total',
});
const NEO_NETWORK_PEER_CONNECT_FAILURES_TOTAL = metrics.createCounter({
name: 'neo_network_peer_connect_failures_total',
});
const NEO_NETWORK_CONNECTED_PEERS_TOTAL = metrics.createGauge({
name: 'neo_network_connected_peers_total',
});
const NEO_NETWORK_CONNECTING_PEERS_TOTAL = metrics.createGauge({
name: 'neo_network_connecting_peers_total',
});
export default class Network {
_monitor: Monitor;
_started: boolean;
_stopped: boolean;
_externalEndpoints: Set;
_maxConnectedPeers: number;
_connectPeersDelayMS: number;
_options$: Observable;
_socketTimeoutMS: number;
_connectErrorCodes: Set;
_connectedPeers: { [endpoint: Endpoint]: ConnectedPeer };
const messageReceivedLabelNames = [labels.COMMAND_NAME];
const messageReceivedLabels = commonUtils.values(COMMAND).map((command) => ({
[labels.COMMAND_NAME]: command,
}));
const NEO_PROTOCOL_MESSAGES_RECEIVED_TOTAL = metrics.createCounter({
name: 'neo_protocol_messages_received_total',
labelNames: messageReceivedLabelNames,
labels: messageReceivedLabels,
});
const NEO_PROTOCOL_MESSAGES_FAILURES_TOTAL = metrics.createCounter({
name: 'neo_protocol_messages_failures_total',
labelNames: messageReceivedLabelNames,
labels: messageReceivedLabels,
});
const NEO_PROTOCOL_MEMPOOL_SIZE = metrics.createGauge({
name: 'neo_protocol_mempool_size',
});
export type Environment = {|
network?: NetworkEnvironment,
|};
export type Options = {|
consensus?: {|
enabled: boolean,
options: ConsensusOptions,
|},
network?: NetworkOptions,
rpcURLs?: Array,
|};
const createPeerBloomFilter = ({
'EADDRNOTAVAIL',
'ETIMEDOUT',
]);
const NEO_NETWORK_PEER_CLOSED_TOTAL = metrics.createCounter({
name: 'neo_network_peer_closed_total',
help:
'Total number of times a peer was closed due to error or ending the socket.',
});
const NEO_NETWORK_PEER_CONNECT_TOTAL = metrics.createCounter({
name: 'neo_network_peer_connect_total',
});
const NEO_NETWORK_PEER_CONNECT_FAILURES_TOTAL = metrics.createCounter({
name: 'neo_network_peer_connect_failures_total',
});
const NEO_NETWORK_CONNECTED_PEERS_TOTAL = metrics.createGauge({
name: 'neo_network_connected_peers_total',
});
const NEO_NETWORK_CONNECTING_PEERS_TOTAL = metrics.createGauge({
name: 'neo_network_connecting_peers_total',
});
export default class Network {
_monitor: Monitor;
_started: boolean;
_stopped: boolean;
_externalEndpoints: Set;
_maxConnectedPeers: number;
_connectPeersDelayMS: number;
_options$: Observable;
_socketTimeoutMS: number;