Esempio n. 1
0
        public override void BuildNode()
        {
            var settings = new NodeSettings(this.Network, args: new string[] { "-conf=bitcoin.conf", "-datadir=" + this.DataFolder });

            var builder = new FullNodeBuilder()
                          .UseNodeSettings(settings)
                          .UseBlockStore()
                          .UsePowConsensus()
                          .UseMempool()
                          .AddMining()
                          .UseWallet()
                          .AddRPC()
                          .UseApi()
                          .MockIBD();

            if (this.InterceptorDisconnect != null)
            {
                builder = builder.InterceptBlockDisconnected(this.InterceptorDisconnect);
            }

            if (this.ServiceToOverride != null)
            {
                builder.OverrideService <BaseFeature>(this.ServiceToOverride);
            }

            this.FullNode = (FullNode)builder.Build();
        }
        public override void BuildNode()
        {
            NodeSettings settings = null;

            if (string.IsNullOrEmpty(this.Agent))
            {
                settings = new NodeSettings(this.Network, args: new string[] { "-conf=bitcoin.conf", "-datadir=" + this.DataFolder });
            }
            else
            {
                settings = new NodeSettings(this.Network, agent: this.Agent, args: new string[] { "-conf=bitcoin.conf", "-datadir=" + this.DataFolder });
            }

            var persistenceProviderManager = new TestPersistenceProviderManager(settings);


            var builder = new FullNodeBuilder()
                          .UsePersistenceProviderMananger(persistenceProviderManager)
                          .UseNodeSettings(settings)
                          .UseBlockStore()
                          .UsePowConsensus()
                          .UseMempool()
                          .AddMining()
                          .UseWallet()
                          .AddRPC()
                          .UseNodeHost()
                          .UseTestChainedHeaderTree()
                          .MockIBD();

            if (this.ServiceToOverride != null)
            {
                builder.OverrideService <BaseFeature>(this.ServiceToOverride);
            }

            if (!this.EnablePeerDiscovery)
            {
                builder.RemoveImplementation <PeerConnectorDiscovery>();
                builder.ReplaceService <IPeerDiscovery, BaseFeature>(new PeerDiscoveryDisabled());
            }

            if (this.AlwaysFlushBlocks)
            {
                builder.ReplaceService <IBlockStoreQueueFlushCondition, BlockStoreFeature>(new BlockStoreAlwaysFlushCondition());
            }

            this.FullNode = (FullNode)builder.Build();
        }
        public override void BuildNode()
        {
            NodeSettings settings = null;

            if (string.IsNullOrEmpty(this.Agent))
            {
                settings = new NodeSettings(this.Network, args: new string[] { "-conf=bitcoin.conf", "-datadir=" + this.DataFolder });
            }
            else
            {
                settings = new NodeSettings(this.Network, agent: this.Agent, args: new string[] { "-conf=bitcoin.conf", "-datadir=" + this.DataFolder });
            }

            var builder = new FullNodeBuilder()
                          .UseNodeSettings(settings)
                          .UseBlockStore()
                          .UsePowConsensus()
                          .UseMempool()
                          .AddMining()
                          .UseWallet()
                          .AddRPC()
                          .UseApi()
                          .UseTestChainedHeaderTree()
                          .MockIBD();

            if (this.InterceptorDisconnect != null)
            {
                builder = builder.InterceptBlockDisconnected(this.InterceptorDisconnect);
            }

            if (this.ServiceToOverride != null)
            {
                builder.OverrideService <BaseFeature>(this.ServiceToOverride);
            }

            if (!this.EnablePeerDiscovery)
            {
                builder.RemoveImplementation <PeerConnectorDiscovery>();
                builder.ReplaceService <IPeerDiscovery>(new PeerDiscoveryDisabled());
            }

            this.FullNode = (FullNode)builder.Build();
        }