internal static void LoadPlugins(OXSystem system) { System = system; if (!Directory.Exists(pluginsPath)) { return; } foreach (string filename in Directory.EnumerateFiles(pluginsPath, "*.dll", SearchOption.TopDirectoryOnly)) { var file = File.ReadAllBytes(filename); Assembly assembly = Assembly.Load(file); foreach (Type type in assembly.ExportedTypes) { if (!type.IsSubclassOf(typeof(Plugin))) { continue; } if (type.IsAbstract) { continue; } ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes); try { constructor?.Invoke(null); } catch (Exception ex) { Log(nameof(Plugin), LogLevel.Error, $"Failed to initialize plugin: {ex.Message}"); } } } }
public RpcServer(OXSystem system, Wallet wallet = null, Fixed8 maxGasInvoke = default(Fixed8), int maxConcurrentConnections = Peer.DefaultMaxConnections) { this.system = system; this.Wallet = wallet; this.MaxGasInvoke = maxGasInvoke; this.MaxConcurrentConnections = maxConcurrentConnections; }
public RemoteNode(OXSystem system, object connection, IPEndPoint remote, IPEndPoint local) : base(connection, remote, local) { this.system = system; this.protocol = Context.ActorOf(ProtocolHandler.Props(system)); LocalNode.Singleton.RemoteNodes.TryAdd(Self, this); SendMessage(Message.Create("version", VersionPayload.Create(LocalNode.Singleton.ListenerPort, LocalNode.Nonce, LocalNode.UserAgent, Blockchain.Singleton.Height))); }
public LocalNode(OXSystem system) { lock (lockObj) { if (singleton != null) { throw new InvalidOperationException(); } this.system = system; singleton = this; } }
public Blockchain(OXSystem system, Store store) { this.system = system; this.MemPool = new MemoryPool(system, MemoryPoolMaxTransactions); this.Store = store; lock (lockObj) { if (singleton != null) { throw new InvalidOperationException(); } header_index.AddRange(store.GetHeaderHashList().Find().OrderBy(p => (uint)p.Key).SelectMany(p => p.Value.Hashes)); stored_header_count += (uint)header_index.Count; if (stored_header_count == 0) { header_index.AddRange(store.GetBlocks().Find().OrderBy(p => p.Value.TrimmedBlock.Index).Select(p => p.Key)); } else { HashIndexState hashIndex = store.GetHeaderHashIndex().Get(); if (hashIndex.Index >= stored_header_count) { DataCache <UInt256, BlockState> cache = store.GetBlocks(); for (UInt256 hash = hashIndex.Hash; hash != header_index[(int)stored_header_count - 1];) { header_index.Insert((int)stored_header_count, hash); hash = cache[hash].TrimmedBlock.PrevHash; } } } if (header_index.Count == 0) { Persist(GenesisBlock); } else { UpdateCurrentSnapshot(); } singleton = this; } }
public Coins(Wallet wallet, OXSystem system) { this.current_wallet = wallet; this.system = system; }
public MemoryPool(OXSystem system, int capacity) { _system = system; Capacity = capacity; LoadMaxTxLimitsFromPolicyPlugins(); }
public static Props Props(OXSystem system) { return(Akka.Actor.Props.Create(() => new LocalNode(system))); }
internal static Props Props(OXSystem system, object connection, IPEndPoint remote, IPEndPoint local) { return(Akka.Actor.Props.Create(() => new RemoteNode(system, connection, remote, local)).WithMailbox("remote-node-mailbox")); }
public static Props Props(OXSystem system, Store store) { return(Akka.Actor.Props.Create(() => new Blockchain(system, store)).WithMailbox("blockchain-mailbox")); }
public TaskManager(OXSystem system) { this.system = system; }
public static Props Props(OXSystem system) { return(Akka.Actor.Props.Create(() => new TaskManager(system)).WithMailbox("task-manager-mailbox")); }