/// <summary> /// Constructs the AzureIndexerLoop. /// </summary> /// <param name="fullNode">The full node that will be indexed.</param> /// <param name="loggerFactory">The logger factory.</param> public AzureIndexerLoop(FullNode fullNode, ILoggerFactory loggerFactory) { this.asyncLoopFactory = fullNode.AsyncLoopFactory; this.FullNode = fullNode; this.Chain = fullNode.Chain; this.nodeLifetime = fullNode.NodeLifetime; this.indexerSettings = fullNode.NodeService <AzureIndexerSettings>(); this.logger = loggerFactory.CreateLogger(GetType().FullName); }
static void TryCopyWalletForUpdate() { var currentWalletPath = _fullNode.NodeService <DataFolder>().WalletPath; var currentSegments = currentWalletPath.Split(Path.DirectorySeparatorChar); var oldSegments = new List <string>(); bool found = false; foreach (var seg in currentSegments) { if (!found && (seg == ".obsidian" || seg == "Obsidian")) { if (seg == ".obsidian") { oldSegments.Add(".stratisnode"); } else { oldSegments.Add("StratisNode"); } found = true; } else { oldSegments.Add(seg); } } var oldWalletDirPath = string.Join(Path.DirectorySeparatorChar, oldSegments); var oldWalletPath = Path.Combine(oldWalletDirPath, "new1.ODX.x1wallet.json"); var newWalletPath = Path.Combine(currentWalletPath, "new1.ODX.x1wallet.json"); if (!File.Exists(newWalletPath)) { if (File.Exists(oldWalletPath)) { File.Copy(oldWalletPath, newWalletPath); } } }
public static async void RunTestCodeAsync(FullNode fullNode) { var i = 0; try { _logger = fullNode.NodeService <ILoggerFactory>().CreateLogger(typeof(TestBench).FullName); _fullNode = fullNode; //TryCopyWalletForUpdate(); await LoadOrCreateWalletAsync(); //Controller.EnsureDummyMultiSig1Of2Address(); //SpendFromMultiSig(); //await StartMiningAsync(); await Task.Delay(20000, fullNode.NodeLifetime.ApplicationStopping); //await SplitAsync(); // await SplitForColdStakingAsync(); for (i = 0; i < 50; i++) { //await Send(100 * Satoshi.Long, "odx1qjdldsm72vr4tmlecjfstr5clkk6pzux47f3e8x"); // buta ///await Send(10 * Satoshi.Long, "odx1qvar8r29r8llzj53q5utmcewpju59263h38250ws33lp2q45lmalqg5lmdd"); // blacky #2 //await Send(100_000 * Satoshi.Long, "odx1q0p84t3whrflupcw5nrax2le7c2jpn67erpymnx"); // blacky stratis core wallet //await Task.Delay(1000); } //await SplitAsync(); await TryStakingAsync(); } catch (Exception e) { _logger.LogError($"Error at {i}:{e}"); } }
public static IWebHost Initialize(IEnumerable <ServiceDescriptor> services, FullNode fullNode) { Guard.NotNull(fullNode, nameof(fullNode)); Uri apiUri = fullNode.NodeService <ApiSettings>().ApiUri; IWebHost host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseUrls(apiUri.ToString()) .ConfigureServices(collection => { if (services == null) { return; } // copies all the services defined for the full node to the Api. // also copies over singleton instances already defined foreach (ServiceDescriptor service in services) { var obj = fullNode.Services.ServiceProvider.GetService(service.ServiceType); if (obj != null && service.Lifetime == ServiceLifetime.Singleton && service.ImplementationInstance == null) { collection.AddSingleton(service.ServiceType, obj); } else { collection.Add(service); } } }) .UseStartup <Startup>() .Build(); host.Start(); return(host); }
public static ChainedHeader GetBlockStoreTip(this FullNode fullNode) { return(fullNode.NodeService <IChainState>().BlockStoreTip); }
public static BlockStoreManager BlockStoreManager(this FullNode fullNode) { return(fullNode.NodeService <BlockStoreManager>()); }
public static MempoolManager MempoolManager(this FullNode fullNode) { return(fullNode.NodeService <MempoolManager>()); }
public static ICoinView CoinView(this FullNode fullNode) { return(fullNode.NodeService <ICoinView>()); }
public static ConsensusLoop ConsensusLoop(this FullNode fullNode) { return(fullNode.NodeService <IConsensusLoop>() as ConsensusLoop); }
public static WalletTransactionHandler WalletTransactionHandler(this FullNode fullNode) { return(fullNode.NodeService <IWalletTransactionHandler>() as WalletTransactionHandler); }
public static WalletManager WalletManager(this FullNode fullNode) { return(fullNode.NodeService <IWalletManager>() as WalletManager); }
public static ChainedBlock HighestPersistedBlock(this FullNode fullNode) { return((fullNode.NodeService <IBlockRepository>() as BlockRepository).HighestPersistedBlock); }
public NodeBlockStore(FullNode fullNode) { _fullNode = fullNode; _repo = fullNode.NodeService <IBlockRepository>() as BlockRepository; }
public static IBlockStore BlockStore(this FullNode fullNode) { return fullNode.NodeService<IBlockStore>(); }
public static IConsensusManager ConsensusManager(this FullNode fullNode) { return fullNode.NodeService<IConsensusManager>() as IConsensusManager; }
public FullNodeBlocksRepository(FullNode node) { _Node = node; _Repo = node.NodeService <BlockStore.IBlockRepository>() as BlockStore.BlockRepository; }