public BlockChain(DagSystem sys) { if (Singleton != null) { throw new Exception("Blockchain reinitialization"); } _sys = sys; _stateMachine = new StateMachine <BlockChainState, BlockChainTrigger>(BlockChainState.Initializing); _engageTriggerStartupSync = _stateMachine.SetTriggerParameters <long>(BlockChainTrigger.ConsensusNodesSynced); _engageTriggerConsolidateFailed = _stateMachine.SetTriggerParameters <string>(BlockChainTrigger.LocalNodeOutOfSync); CreateStateMachine(); var nodeConfig = Neo.Settings.Default.LyraNode; _store = new MongoAccountCollection(); //_store = new LiteAccountCollection(Utilities.LyraDataDir); _log = new SimpleLogger("BlockChain").Logger; _nodeConfig = nodeConfig; NetworkID = nodeConfig.Lyra.NetworkId; Singleton = this; }
public BlockChain(DagSystem sys, IAccountCollectionAsync store) { _sys = sys; var nodeConfig = Neo.Settings.Default.LyraNode; _store = store; //new MongoAccountCollection(); //_store = new LiteAccountCollection(Utilities.LyraDataDir); _log = new SimpleLogger("BlockChain").Logger; _nodeConfig = nodeConfig; NetworkID = nodeConfig.Lyra.NetworkId; Receive <Startup>(_ => { }); Receive <Idle>(_ => { }); }
public DagSystem(IHostEnv hostEnv, IAccountCollectionAsync store, IHubContext <LyraEventHub, ILyraEvent> hub, Wallet posWallet, IActorRef localNode) { _hostEnv = hostEnv; _log = new SimpleLogger("DagSystem").Logger; FullStarted = false; _hub = hub; Storage = new TracedStorage(store); PosWallet = posWallet; LocalNode = localNode; this.LocalNode.Tell(this); if (hostEnv != null) // for unit test { TheBlockchain = ActorSystem.ActorOf(BlockChain.Props(this, Storage)); TaskManager = ActorSystem.ActorOf(Neo.Network.P2P.TaskManager.Props(this)); //TradeEngine = new TradeMatchEngine(Storage); } Singleton = this; }
public static Props Props(DagSystem system, IAccountCollectionAsync store) { return(Akka.Actor.Props.Create(() => new BlockChain(system, store)).WithMailbox("blockchain-mailbox")); }
public static Props Props(DagSystem system) { return(Akka.Actor.Props.Create(() => new BlockChain(system)).WithMailbox("blockchain-mailbox")); }