Пример #1
0
 public WalletService_old(
     ILoggerFactory loggerFactory,
     IWalletManager walletManager,
     IWalletTransactionHandler walletTransactionHandler,
     IWalletSyncManager walletSyncManager,
     IConnectionManager connectionManager,
     Network network,
     ConcurrentChain chain,
     IBroadcasterManager broadcasterManager,
     IDateTimeProvider dateTimeProvider)
 {
     this.walletManager            = walletManager;
     this.walletTransactionHandler = walletTransactionHandler;
     this.walletSyncManager        = walletSyncManager;
     this.connectionManager        = connectionManager;
     this.network            = network;
     this.coinType           = (CoinType)network.Consensus.CoinType;
     this.chain              = chain;
     this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
     this.broadcasterManager = broadcasterManager;
     this.dateTimeProvider   = dateTimeProvider;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="WalletFeature"/> class.
        /// </summary>
        /// <param name="walletSyncManager">The synchronization manager for the wallet, tasked with keeping the wallet synced with the network.</param>
        /// <param name="walletManager">The wallet manager.</param>
        /// <param name="signals">The signals responsible for receiving blocks and transactions from the network.</param>
        /// <param name="chain">The chain of blocks.</param>
        /// <param name="connectionManager">The connection manager.</param>
        /// <param name="broadcasterBehavior">The broadcaster behavior.</param>
        /// <param name="nodeSettings">The settings for the node.</param>
        /// <param name="walletSettings">The settings for the wallet.</param>
        public WalletFeature(
            IWalletSyncManager walletSyncManager,
            IWalletManager walletManager,
            Signals.Signals signals,
            ConcurrentChain chain,
            IConnectionManager connectionManager,
            BroadcasterBehavior broadcasterBehavior,
            NodeSettings nodeSettings,
            WalletSettings walletSettings,
            INodeStats nodeStats)
        {
            this.walletSyncManager   = walletSyncManager;
            this.walletManager       = walletManager;
            this.signals             = signals;
            this.chain               = chain;
            this.connectionManager   = connectionManager;
            this.broadcasterBehavior = broadcasterBehavior;
            this.nodeSettings        = nodeSettings;
            this.walletSettings      = walletSettings;

            nodeStats.RegisterStats(this.AddComponentStats, StatsType.Component);
            nodeStats.RegisterStats(this.AddInlineStats, StatsType.Inline, 800);
        }
        public RegistrationFeature(ILoggerFactory loggerFactory,
                                   NodeSettings nodeSettings,
                                   RegistrationManager registrationManager,
                                   RegistrationStore registrationStore,
                                   ConcurrentChain chain,
                                   Signals signals,
                                   IWatchOnlyWalletManager watchOnlyWalletManager,
                                   IBlockNotification blockNotification,
                                   IWalletSyncManager walletSyncManager)
        {
            this.loggerFactory       = loggerFactory;
            this.logger              = loggerFactory.CreateLogger(this.GetType().FullName);
            this.nodeSettings        = nodeSettings;
            this.registrationManager = registrationManager;
            this.registrationStore   = registrationStore;
            this.chain   = chain;
            this.signals = signals;
            this.network = nodeSettings.Network;
            this.watchOnlyWalletManager = watchOnlyWalletManager;
            this.blockNotification      = blockNotification as BlockNotification;
            this.walletSyncManager      = walletSyncManager;

            if (nodeSettings.Network == Network.Main || nodeSettings.Network == Network.TestNet || nodeSettings.Network == Network.RegTest)
            {
                // Bitcoin networks - these currently only interrogate the registration store for initial masternode selection
                this.isBitcoin = true;
            }
            else
            {
                // Stratis networks - these write to the registration store as new registrations come in via blocks
                this.isBitcoin = false;

                // Force registration store to be kept in same folder as other node data
                this.registrationStore.SetStorePath(this.nodeSettings.DataDir);
            }
        }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LightWalletFeature"/> class.
 /// </summary>
 /// <param name="walletSyncManager">The synchronization manager for the wallet, tasked with keeping the wallet synced with the network.</param>
 /// <param name="walletManager">The wallet manager.</param>
 /// <param name="connectionManager">The connection manager.</param>
 /// <param name="chain">The chain of blocks.</param>
 /// <param name="nodeDeployments">The node deployments.</param>
 /// <param name="asyncLoopFactory">The asynchronous loop factory.</param>
 /// <param name="nodeLifetime">The node lifetime.</param>
 /// <param name="walletFeePolicy">The wallet fee policy.</param>
 /// <param name="broadcasterBehavior">The broadcaster behavior.</param>
 /// <param name="loggerFactory">Factory to be used to create logger for the puller.</param>
 public LightWalletFeature(
     IWalletSyncManager walletSyncManager,
     IWalletManager walletManager,
     IConnectionManager connectionManager,
     ConcurrentChain chain,
     NodeDeployments nodeDeployments,
     IAsyncLoopFactory asyncLoopFactory,
     INodeLifetime nodeLifetime,
     IWalletFeePolicy walletFeePolicy,
     BroadcasterBehavior broadcasterBehavior,
     ILoggerFactory loggerFactory)
 {
     this.walletSyncManager   = walletSyncManager;
     this.walletManager       = walletManager;
     this.connectionManager   = connectionManager;
     this.chain               = chain;
     this.nodeDeployments     = nodeDeployments;
     this.asyncLoopFactory    = asyncLoopFactory;
     this.nodeLifetime        = nodeLifetime;
     this.walletFeePolicy     = walletFeePolicy;
     this.broadcasterBehavior = broadcasterBehavior;
     this.logger              = loggerFactory.CreateLogger(this.GetType().FullName);
     this.loggerFactory       = loggerFactory;
 }
Пример #5
0
 public LightWalletFeature(IWalletSyncManager walletSyncManager, IWalletManager walletManager)
 {
     this.walletSyncManager = walletSyncManager;
     this.walletManager     = walletManager;
 }
Пример #6
0
 public BlockObserver(ConcurrentChain chain, IWalletSyncManager walletSyncManager)
 {
     this.chain             = chain;
     this.walletSyncManager = walletSyncManager;
 }
Пример #7
0
 public WalletFeature(IWalletSyncManager walletSyncManager, IWalletManager walletManager, Signals.Signals signals)
 {
     this.walletSyncManager = walletSyncManager;
     this.walletManager     = walletManager;
     this.signals           = signals;
 }
Пример #8
0
        public TumbleBitManager(
            ILoggerFactory loggerFactory,
            NodeSettings nodeSettings,
            IWalletManager walletManager,
            IWatchOnlyWalletManager watchOnlyWalletManager,
            ConcurrentChain chain,
            Network network,
            Signals signals,
            IWalletTransactionHandler walletTransactionHandler,
            IWalletSyncManager walletSyncManager,
            IWalletFeePolicy walletFeePolicy,
            IBroadcasterManager broadcasterManager,
            FullNode fullNode,
            ConfigurationOptionWrapper <string>[] configurationOptions)
        {
            this.walletManager            = walletManager as WalletManager;
            this.watchOnlyWalletManager   = watchOnlyWalletManager;
            this.walletSyncManager        = walletSyncManager as WalletSyncManager;
            this.walletTransactionHandler = walletTransactionHandler as WalletTransactionHandler;
            this.chain              = chain;
            this.signals            = signals;
            this.network            = network;
            this.nodeSettings       = nodeSettings;
            this.loggerFactory      = loggerFactory;
            this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
            this.walletFeePolicy    = walletFeePolicy;
            this.broadcasterManager = broadcasterManager;
            this.connectionManager  = fullNode.ConnectionManager as ConnectionManager;
            this.fullNode           = fullNode;

            foreach (var option in configurationOptions)
            {
                if (option.Name.Equals("RegistrationStoreDirectory"))
                {
                    if (option.Value != null)
                    {
                        this.registrationStore = new RegistrationStore(option.Value);
                    }
                    else
                    {
                        this.registrationStore = new RegistrationStore(this.nodeSettings.DataDir);
                    }
                }

                if (option.Name.Equals("MasterNodeUri"))
                {
                    if (option.Value != null)
                    {
                        this.TumblerAddress = option.Value;
                    }
                }
            }

            this.tumblingState = new TumblingState(
                this.loggerFactory,
                this.chain,
                this.walletManager,
                this.watchOnlyWalletManager,
                this.network,
                this.walletTransactionHandler,
                this.walletSyncManager,
                this.walletFeePolicy,
                this.nodeSettings,
                this.broadcasterManager,
                this.connectionManager);

            // Load saved state e.g. previously selected server
            if (File.Exists(this.tumblingState.GetStateFilePath()))
            {
                try
                {
                    this.tumblingState.LoadStateFromMemory();
                }
                catch (NullReferenceException)
                {
                    // The file appears to get corrupted sometimes, not clear why
                    // May be if the node is not shut down correctly
                }
            }

            this.tumblingState.Save();

            // If there was a server address saved, that means we were previously
            // connected to it, and should try to reconnect to it by default when
            // the connect method is invoked by the UI
            if ((this.TumblerAddress == null) && (this.tumblingState.TumblerUri != null))
            {
                this.TumblerAddress = this.tumblingState.TumblerUri.ToString();
            }

            // Remove the progress file from previous session as it is now stale
            ProgressInfo.RemoveProgressFile();
        }
Пример #9
0
 public WalletController(IWalletManager walletManager, IWalletTransactionHandler walletTransactionHandler, IWalletSyncManager walletSyncManager, IConnectionManager connectionManager, Network network,
                         ConcurrentChain chain, DataFolder dataFolder)
 {
     this.walletManager            = walletManager;
     this.walletTransactionHandler = walletTransactionHandler;
     this.walletSyncManager        = walletSyncManager;
     this.connectionManager        = connectionManager;
     this.network    = network;
     this.coinType   = (CoinType)network.Consensus.CoinType;
     this.chain      = chain;
     this.dataFolder = dataFolder;
 }
Пример #10
0
 public ColdStakingWalletService(ILoggerFactory loggerFactory, IWalletManager walletManager, IConsensusManager consensusManager, IWalletTransactionHandler walletTransactionHandler, IWalletSyncManager walletSyncManager, IConnectionManager connectionManager, Network network, ChainIndexer chainIndexer, IBroadcasterManager broadcasterManager, IDateTimeProvider dateTimeProvider, IUtxoIndexer utxoIndexer, IWalletFeePolicy walletFeePolicy) : base(loggerFactory, walletManager, consensusManager, walletTransactionHandler, walletSyncManager, connectionManager, network, chainIndexer, broadcasterManager, dateTimeProvider, utxoIndexer, walletFeePolicy)
 {
 }
Пример #11
0
        public BlockObserver(IWalletSyncManager walletSyncManager)
        {
            Guard.NotNull(walletSyncManager, nameof(walletSyncManager));

            this.walletSyncManager = walletSyncManager;
        }
Пример #12
0
        public TumbleBitManager(
            ILoggerFactory loggerFactory,
            NodeSettings nodeSettings,
            IWalletManager walletManager,
            IWatchOnlyWalletManager watchOnlyWalletManager,
            ConcurrentChain chain,
            Network network,
            Signals signals,
            IWalletTransactionHandler walletTransactionHandler,
            IWalletSyncManager walletSyncManager,
            IWalletFeePolicy walletFeePolicy,
            IBroadcasterManager broadcasterManager,
            FullNode fullNode,
            ConfigurationOptionWrapper <string> registrationStoreDirectory)
        {
            this.walletManager            = walletManager as WalletManager;
            this.watchOnlyWalletManager   = watchOnlyWalletManager;
            this.walletSyncManager        = walletSyncManager as WalletSyncManager;
            this.walletTransactionHandler = walletTransactionHandler as WalletTransactionHandler;
            this.chain              = chain;
            this.signals            = signals;
            this.network            = network;
            this.nodeSettings       = nodeSettings;
            this.loggerFactory      = loggerFactory;
            this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
            this.walletFeePolicy    = walletFeePolicy;
            this.broadcasterManager = broadcasterManager;
            this.fullNode           = fullNode;

            if (registrationStoreDirectory.Value != null)
            {
                this.registrationStore = new RegistrationStore(registrationStoreDirectory.Value);
            }
            else
            {
                this.registrationStore = new RegistrationStore(this.nodeSettings.DataDir);
            }

            this.tumblingState = new TumblingState(
                this.loggerFactory,
                this.chain,
                this.walletManager,
                this.watchOnlyWalletManager,
                this.network,
                this.walletTransactionHandler,
                this.walletSyncManager,
                this.walletFeePolicy,
                this.nodeSettings,
                this.broadcasterManager);

            // Load saved state e.g. previously selected server
            if (File.Exists(this.tumblingState.GetStateFilePath()))
            {
                try
                {
                    this.tumblingState.LoadStateFromMemory();
                }
                catch (NullReferenceException)
                {
                    // The file appears to get corrupted sometimes, not clear why
                    // May be if the node is not shut down correctly
                }
            }

            this.tumblingState.Save();

            // Remove the progress file from previous session as it is now stale
            ProgressInfo.RemoveProgressFile();
        }
Пример #13
0
 public TransactionObserver(IWalletSyncManager walletSyncManager)
 {
     this.walletSyncManager = walletSyncManager;
 }
Пример #14
0
 public BlockObserver(IWalletSyncManager walletSyncManager)
 {
     this.walletSyncManager = walletSyncManager;
 }
Пример #15
0
 public MineNavigationItem(Network network, IWalletSyncManager walletSyncManager)
 {
     this.network           = network;
     this.walletSyncManager = walletSyncManager;
 }