public static void Initialize() { var notify = new NotifyComponent(); BlockchainComponent blockChainComponent = new BlockchainComponent(); AccountComponent accountComponent = new AccountComponent(); UtxoComponent utxoComponent = new UtxoComponent(); //从配置文件中读取 ConfigurationTool tool = new ConfigurationTool(); NodeConfig config = tool.GetAppSettings <NodeConfig>("NodeConfig"); notify.SetCallbackApp(config.WalletNotify); if (GlobalActions.TransactionNotifyAction == null) { GlobalActions.TransactionNotifyAction = NewTransactionNotify; } blockChainComponent.Initialize(); var accounts = accountComponent.GetAllAccounts(); if (accounts.Count == 0) { var account = accountComponent.GenerateNewAccount(); accountComponent.SetDefaultAccount(account.Id); } BlockchainJob.Current = new BlockchainJob(); utxoComponent.Initialize(); }
public static void Initialize() { var notify = new NotifyComponent(); BlockchainComponent blockChainComponent = new BlockchainComponent(); AccountComponent accountComponent = new AccountComponent(); BlockchainJob.Current = new BlockchainJob(); BlockDac.Default.GetAccountByLockScript = BlockchainJob.Current.GetAccountByLockScript; //从配置文件中读取 ConfigurationTool tool = new ConfigurationTool(); config = tool.GetAppSettings <NodeConfig>("NodeConfig"); if (config == null) { GlobalParameters.IsPool = false; config = new NodeConfig(); } else { notify.SetCallbackApp(config.WalletNotify); BlockchainJob.Current.P2PJob.LocalIP = config.LocalIP; GlobalParameters.IsPool = config.IsPool; } ConfigCenter.ConfigNode = config; //TODO 待验证删除 //if (config != null) //{ // notify.SetCallbackApp(config.WalletNotify); // BlockchainJob.Current.P2PJob.IPAddress = config.Ip; // GlobalParameters.IsPool = config.IsPool; //} //else //{ // GlobalParameters.IsPool = false; //} if (GlobalActions.TransactionNotifyAction == null) { GlobalActions.TransactionNotifyAction = NewTransactionNotify; } blockChainComponent.Initialize(); var accounts = AccountDac.Default.GetAccountBook(); if (accounts.Count == 0) { var account = accountComponent.GenerateNewAccount(false); accountComponent.SetDefaultAccount(account.Id); } var defaultAccount = AppDac.Default.GetDefaultAccount(); if (string.IsNullOrEmpty(defaultAccount)) { var first = AccountDac.Default.GetAccountBook().FirstOrDefault(); UserSettingComponent component = new UserSettingComponent(); component.SetDefaultAccount(first); } TransactionPool.Instance.Load(); }